Ignore:
Timestamp:
Oct 26, 1999, 7:54:16 PM (26 years ago)
Author:
sandervl
Message:

FS fixes in GetLocaleInfoA/W

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/lang.cpp

    r488 r1458  
    5959}
    6060
    61 /*****************************************************************************
    62  * Name      : DWORD GetLocaleInfoA
    63  * Purpose   : The GetLocaleInfoA function returns specific locale information
    64  * Parameters: LCID   lcid    locale identifier
    65  *             LCTYPE LCType  type of information
    66  *             LPSTR  buf     address of buffer for information
    67  *             int    len     size of buffer
    68  * Variables :
    69  * Result    : size of target buffer
    70  * Remark    : In this version LOCALE_SYSTEM_DEFAULT == LOCALE_USER_DEFAULT
    71  *             look into GetLocaleInfoW
    72  *
    73  * Status    : TESTED
    74  *
    75  * Author    : Przemyslaw Dobrowolski [Tue, 1999/07/21 12:18]
    76  *****************************************************************************/
    77 int WIN32API GetLocaleInfoA(LCID lcid, LCTYPE LCType, LPSTR buf, int len)
    78 {
    79   LPWSTR lpWStr;
    80   int    ret_len;
    81 
    82   if (len && (! buf) )
    83   {
    84     SetLastError(ERROR_INSUFFICIENT_BUFFER);
    85     return 0;
    86   }
    87 
    88   dprintf(("KERNEL32:  OS2GetLocaleInfoA lcID=%d,lcType=%x,buf=%X,len=%d\n",lcid,LCType,buf,len));
    89 
    90   if (buf)
    91     lpWStr=(LPWSTR)malloc(len*(sizeof(WCHAR)));
    92   else
    93     lpWStr=NULL; // Query for buffer size
    94 
    95   ret_len=GetLocaleInfoW(lcid, LCType, lpWStr, len);
    96 
    97   if (ret_len && buf)
    98   {
    99     UnicodeToAscii(lpWStr,buf);
    100     free(lpWStr);
    101   }
    102 
    103   dprintf(("KERNEL32:  OS2GetLocaleInfoA returned %d\n",ret_len));
    104 
    105   return (ret_len);
    106 }
    10761//******************************************************************************
    10862//******************************************************************************
     
    176130 * Author    : Przemyslaw Dobrowolski [Tue, 1999/07/22 17:07]
    177131 *****************************************************************************/
    178 int WIN32API GetLocaleInfoW(LCID lcid, LCTYPE LCType, LPWSTR wbuf, int len)
     132ODINFUNCTION4(int, GetLocaleInfoW, LCID, lcid, LCTYPE, LCType, LPWSTR, wbuf,
     133              int, len)
    179134{
    180135  LocaleObject    locale_object = NULL;
     
    760715  return (ulInfoLen);
    761716}
    762 
     717/*****************************************************************************
     718 * Name      : DWORD GetLocaleInfoA
     719 * Purpose   : The GetLocaleInfoA function returns specific locale information
     720 * Parameters: LCID   lcid    locale identifier
     721 *             LCTYPE LCType  type of information
     722 *             LPSTR  buf     address of buffer for information
     723 *             int    len     size of buffer
     724 * Variables :
     725 * Result    : size of target buffer
     726 * Remark    : In this version LOCALE_SYSTEM_DEFAULT == LOCALE_USER_DEFAULT
     727 *             look into GetLocaleInfoW
     728 *
     729 * Status    : TESTED
     730 *
     731 * Author    : Przemyslaw Dobrowolski [Tue, 1999/07/21 12:18]
     732 *****************************************************************************/
     733ODINFUNCTION4(int, GetLocaleInfoA, LCID, lcid, LCTYPE, LCType, LPSTR, buf,
     734              int, len)
     735{
     736  LPWSTR lpWStr;
     737  int    ret_len;
     738
     739  if (len && (! buf) )
     740  {
     741    SetLastError(ERROR_INSUFFICIENT_BUFFER);
     742    return 0;
     743  }
     744
     745  dprintf(("KERNEL32:  OS2GetLocaleInfoA lcID=%d,lcType=%x,buf=%X,len=%d\n",lcid,LCType,buf,len));
     746
     747  if (buf)
     748    lpWStr=(LPWSTR)malloc(len*(sizeof(WCHAR)));
     749  else
     750    lpWStr=NULL; // Query for buffer size
     751
     752  ret_len = ODIN_GetLocaleInfoW(lcid, LCType, lpWStr, len);
     753
     754  if (ret_len && buf)
     755  {
     756    UnicodeToAscii(lpWStr,buf);
     757    free(lpWStr);
     758  }
     759
     760  dprintf(("KERNEL32:  OS2GetLocaleInfoA returned %d\n",ret_len));
     761
     762  return (ret_len);
     763}
    763764//******************************************************************************
    764765//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.