Changeset 3804 for trunk/src


Ignore:
Timestamp:
Jul 6, 2000, 11:18:45 PM (25 years ago)
Author:
sandervl
Message:

strncpy call changes + language api updates/fixes

Location:
trunk/src/kernel32
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.CPP

    r3794 r3804  
    1 /* $Id: KERNEL32.CPP,v 1.48 2000-07-03 12:12:37 bird Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.49 2000-07-06 21:18:38 sandervl Exp $ */
    22
    33/*
     
    899899{
    900900    // quick hack!  this code is not done!
     901    dprintf(("LCMapStringW: NOT IMPLEMENTED!"));
    901902    if(cchSrc == -1)
    902903        cchSrc = strlen((const char *)lpSrcStr);
    903904    if(!cchDest)
    904905        return cchSrc;
    905     strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));
     906    lstrcpynW(lpDestStr, lpSrcStr, max(cchSrc, cchDest));
    906907    return max(cchSrc, cchDest);
    907908}
  • trunk/src/kernel32/console.cpp

    r2802 r3804  
    1 /* $Id: console.cpp,v 1.18 2000-02-16 14:25:34 sandervl Exp $ */
     1/* $Id: console.cpp,v 1.19 2000-07-06 21:18:39 sandervl Exp $ */
    22
    33/*
     
    8383#include "conprop.h"
    8484#include "unicode.h"
     85#include "heapstring.h"
    8586
    8687#define DBG_LOCALLOG    DBG_console
     
    27072708
    27082709DWORD WIN32API GetConsoleTitleA(LPTSTR lpConsoleTitle,
    2709                                    DWORD  nSize)
     2710                                DWORD  nSize)
    27102711{
    27112712  ULONG ulLength;                                          /* length of text */
     
    27252726          ConsoleGlobals.pszWindowTitle,
    27262727          nSize);
     2728  lpConsoleTitle[nSize-1] = 0;
    27272729
    27282730  return (nSize < ulLength) ? nSize : ulLength;
     
    27432745 *****************************************************************************/
    27442746
    2745 DWORD WIN32API GetConsoleTitleW(LPTSTR lpConsoleTitle,
    2746                                    DWORD  nSize)
     2747DWORD WIN32API GetConsoleTitleW(LPWSTR lpConsoleTitle,
     2748                                DWORD  nSize)
    27472749{
    27482750  ULONG ulLength;                                          /* length of text */
    27492751
    27502752#ifdef DEBUG_LOCAL2
    2751   WriteLog("KERNEL32/CONSOLE: OS2GetConsoleTitleW(%08x,%08x).\n",
     2753  WriteLog("KERNEL32/CONSOLE: GetConsoleTitleW(%08x,%08x)",
    27522754           lpConsoleTitle,
    27532755           nSize);
     
    27592761  ulLength = strlen(ConsoleGlobals.pszWindowTitle);        /* length of text */
    27602762
    2761   strncpy(lpConsoleTitle,
    2762           ConsoleGlobals.pszWindowTitle,
    2763           nSize);
     2763  lstrcpynAtoW(lpConsoleTitle,
     2764               ConsoleGlobals.pszWindowTitle,
     2765               nSize);
    27642766
    27652767  /* @@@PH Ascii2Unicode */
  • trunk/src/kernel32/console2.h

    r296 r3804  
    1 /* $Id: console2.h,v 1.7 1999-07-12 17:20:04 phaller Exp $ */
     1/* $Id: console2.h,v 1.8 2000-07-06 21:18:41 sandervl Exp $ */
    22
    33/*
     
    522522                                                  DWORD         nSize);
    523523
    524 DWORD  WIN32API GetConsoleTitleW              (LPTSTR        lpConsoleTitle,
    525                                                   DWORD         nSize);
     524DWORD  WIN32API GetConsoleTitleW              (LPWSTR        lpConsoleTitle,
     525                                               DWORD         nSize);
    526526
    527527COORD  WIN32API GetLargestConsoleWindowSize   (HANDLE        hConsoleOutput);
  • trunk/src/kernel32/heapstring.cpp

    r3730 r3804  
    1 /* $Id: heapstring.cpp,v 1.28 2000-06-18 12:55:17 phaller Exp $ */
     1/* $Id: heapstring.cpp,v 1.29 2000-07-06 21:18:42 sandervl Exp $ */
    22
    33/*
     
    14271427    else           
    14281428    {
    1429         strncpy (lpNumberStr, sDestination, cchNumber-1);
    1430         *(lpNumberStr+cchNumber-1) = '\0';   /* ensure we got a NULL at the end */
     1429        strncpy (lpNumberStr, sDestination, cchNumber);
     1430        lpNumberStr[cchNumber-1] = '\0';   /* ensure we got a NULL at the end */
    14311431        retVal = strlen(lpNumberStr);
    14321432    }
  • trunk/src/kernel32/hmfile.cpp

    r3785 r3804  
    1 /* $Id: hmfile.cpp,v 1.9 2000-07-01 12:51:51 sandervl Exp $ */
     1/* $Id: hmfile.cpp,v 1.10 2000-07-06 21:18:42 sandervl Exp $ */
    22
    33/*
     
    178178  pOFStruct->cBytes = sizeof(OFSTRUCT);
    179179  pOFStruct->nErrCode = 0;
    180   strncpy((char *)pOFStruct->szPathName, lpFileName, OFS_MAXPATHNAME - 1);
     180  strncpy((char *)pOFStruct->szPathName, lpFileName, OFS_MAXPATHNAME);
     181  pOFStruct->szPathName[OFS_MAXPATHNAME-1] = 0;
    181182
    182183  hFile = OSLibDosOpenFile((LPSTR)lpFileName, fuMode);
  • trunk/src/kernel32/lang.cpp

    r3746 r3804  
    1 /* $Id: lang.cpp,v 1.23 2000-06-23 19:02:37 sandervl Exp $ */
     1/* $Id: lang.cpp,v 1.24 2000-07-06 21:18:43 sandervl Exp $ */
    22/*
    33 * Win32 language API functions for OS/2
     
    66 * Copyright 1998 Patrick Haller
    77 * Copyright 1999 Przemyslaw Dobrowolski
     8 *
    89 *
    910 * Project Odin Software License can be found in LICENSE.TXT
     
    2122#include "unicode.h"
    2223#include "oslibmisc.h"
     24#include <wprocess.h>
    2325
    2426#define DBG_LOCALLOG    DBG_lang
     
    880882BOOL WIN32API IsValidLocale(LCID Locale, DWORD dwFlags)
    881883{
    882   dprintf(("KERNEL32:  OS2IsValidLocale, always returns TRUE\n"));
     884  dprintf(("KERNEL32: IsValidLocale, always returns TRUE\n"));
    883885  return(TRUE);
    884886}
     
    887889LCID WIN32API GetThreadLocale()
    888890{
    889   dprintf(("KERNEL32:  OS2GetThreadLocale always return US English!\n"));
    890   return(0x409);        //US English
    891 }
    892 //******************************************************************************
    893 //******************************************************************************
    894 //******************************************************************************
    895 BOOL WIN32API SetThreadLocale( LCID locale )
    896 {
    897   dprintf(("KERNEL32:  OS2SetThreadLocale not implemented!\n"));
     891 THDB *thdb = GetThreadTHDB();
     892
     893  if(thdb == NULL) {
     894        dprintf(("KERNEL32: ERROR: GetThreadLocale thdb == NULL!"));
     895        return FALSE;
     896  }
     897  dprintf(("KERNEL32: GetThreadLocale returned %x", thdb->lcid));
     898  return(thdb->lcid);
     899}
     900//******************************************************************************
     901//******************************************************************************
     902BOOL WIN32API SetThreadLocale(LCID locale)
     903{
     904 THDB *thdb = GetThreadTHDB();
     905 
     906  if(thdb == NULL) {
     907        dprintf(("KERNEL32: ERROR SetThreadLocale thdb == NULL!"));
     908        return FALSE;
     909  }
     910  dprintf(("KERNEL32: SetThreadLocale %x", locale));
     911  thdb->lcid = locale;
    898912  return(TRUE);
    899913}
     
    901915//******************************************************************************
    902916BOOL WIN32API EnumSystemLocalesA(LOCALE_ENUMPROCA lpLocaleEnumProc,
    903                                     DWORD dwFlags)
    904 {
     917                                 DWORD dwFlags)
     918{
     919 char buffer[32];
     920
    905921  dprintf(("EnumSystemLocalesA %X %X\n", lpLocaleEnumProc, dwFlags));
    906922  if(lpLocaleEnumProc == NULL || ((dwFlags & LCID_INSTALLED) && (dwFlags & LCID_SUPPORTED))) {
     
    909925        return(FALSE);
    910926  }
    911   lpLocaleEnumProc("OS/2 US English");
     927
     928  sprintf(buffer, "%08lx", GetUserDefaultLCID());
     929  lpLocaleEnumProc(buffer);
    912930  return(TRUE);
    913931}
     
    915933//******************************************************************************
    916934BOOL WIN32API EnumSystemLocalesW(LOCALE_ENUMPROCW lpLocaleEnumProc,
    917                                     DWORD            dwFlags)
    918 {
    919  WCHAR locStr[32];
     935                                 DWORD            dwFlags)
     936{
     937 WCHAR bufferW[32];
     938 char  bufferA[32];
    920939
    921940  dprintf(("EnumSystemLocalesW %X %X\n", lpLocaleEnumProc, dwFlags));
     
    925944        return(FALSE);
    926945  }
    927   AsciiToUnicode("OS/2 US English", locStr);
    928   lpLocaleEnumProc(locStr);
     946  sprintf(bufferA, "%08lx", GetUserDefaultLCID());
     947  lstrcpyAtoW(bufferW, bufferA);
     948
     949  lpLocaleEnumProc(bufferW);
    929950  return(TRUE);
    930951}
  • trunk/src/kernel32/message.cpp

    r2802 r3804  
    1 /* $Id: message.cpp,v 1.10 2000-02-16 14:25:42 sandervl Exp $ */
     1/* $Id: message.cpp,v 1.11 2000-07-06 21:18:43 sandervl Exp $ */
    22
    33/*
     
    344344    memcpy(*(LPSTR*)lpBuffer,target,talloced);
    345345  }
    346   else
     346  else {
    347347    strncpy(lpBuffer,target,nSize);
     348    lpBuffer[nSize-1] = 0;
     349  }
    348350
    349351  HeapFree(GetProcessHeap(),0,target);
  • trunk/src/kernel32/network.cpp

    r2803 r3804  
    1 /* $Id: network.cpp,v 1.9 2000-02-16 14:27:08 sandervl Exp $ */
     1/* $Id: network.cpp,v 1.10 2000-07-06 21:18:43 sandervl Exp $ */
    22/*
    33 * Win32 Network apis
     
    4040    if (lpBuffer)
    4141    {
    42         strncpy(lpBuffer, szHostname, *nSize - 1);      // Copy back name.
     42        strncpy(lpBuffer, szHostname, *nSize);  // Copy back name.
    4343        lpBuffer[*nSize - 1] = 0;               // Ensure terminated.
    4444    }
  • trunk/src/kernel32/oslibdos.cpp

    r3768 r3804  
    1 /* $Id: oslibdos.cpp,v 1.33 2000-06-28 21:05:56 phaller Exp $ */
     1/* $Id: oslibdos.cpp,v 1.34 2000-07-06 21:18:44 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    659659        }
    660660        strncpy(full_name, name, length_fullname);
     661        full_name[length_fullname-1] = 0;
    661662        return strlen(full_name);
    662663  }
  • trunk/src/kernel32/profile.cpp

    r2802 r3804  
    1 /* $Id: profile.cpp,v 1.22 2000-02-16 14:23:12 sandervl Exp $ */
     1/* $Id: profile.cpp,v 1.23 2000-07-06 21:18:44 sandervl Exp $ */
    22
    33/*
     
    965965      PROFILE_OdinProfile = PROFILE_Load( f );
    966966      fclose( f );
    967       strncpy(PROFILE_OdinIniUsed,p,MAX_PATHNAME_LEN-1);
     967      strncpy(PROFILE_OdinIniUsed,p,MAX_PATHNAME_LEN);
     968      PROFILE_OdinIniUsed[MAX_PATHNAME_LEN-1] = 0;
    968969    }
    969970    else
  • trunk/src/kernel32/wprocess.cpp

    r3678 r3804  
    1 /* $Id: wprocess.cpp,v 1.82 2000-06-08 18:08:58 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.83 2000-07-06 21:18:45 sandervl Exp $ */
    22
    33/*
     
    193193    thdb->threadId        = GetCurrentThreadId();
    194194    if(fMainThread) {
    195         thdb->hThread    = hThreadMain;
     195        thdb->hThread     = hThreadMain;
    196196    }
    197197    else thdb->hThread    = GetCurrentThread();
     198    thdb->lcid            = GetUserDefaultLCID();
    198199
    199200    threadListMutex.enter();
     
    10851086        rc = min(strlen(fpath)+1, cchPath);
    10861087        strncpy(lpszPath, fpath, rc);
     1088        lpszPath[rc-1] = 0;
    10871089  }
    10881090  else  rc = O32_GetModuleFileName(hinstModule, lpszPath, cchPath);
Note: See TracChangeset for help on using the changeset viewer.