Changeset 2485 for trunk/src


Ignore:
Timestamp:
Jan 20, 2000, 10:40:26 PM (26 years ago)
Author:
sandervl
Message:

VT: Codepages changes/bugfixes

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

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

    r2213 r2485  
    2121ULONG GetDisplayCodepage()
    2222{
    23     return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 0);
     23 static ULONG codepage = -1;
     24
     25    if(codepage == -1) {
     26        codepage = ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 0);
     27    }
     28    return codepage;
    2429}
    2530
    2631ULONG GetWindowsCodepage()
    2732{
    28     return ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 0);
     33 static ULONG codepage = -1;
     34
     35    if(codepage == -1) {
     36        codepage = ODIN_PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 0);
     37    }
     38    return codepage;
    2939}
    3040
     
    3747    if ( ret == ULS_SUCCESS )
    3848    {
    39         ret = UniCreateUconvObject( (UniChar*)L"", &rc );
     49        ret = UniCreateUconvObject( codepage_str, &rc );
    4050        if ( ret != ULS_SUCCESS )
    4151                rc = 0;
  • trunk/src/kernel32/heapstring.cpp

    r2447 r2485  
    1 /* $Id: heapstring.cpp,v 1.24 2000-01-15 15:42:49 sandervl Exp $ */
     1/* $Id: heapstring.cpp,v 1.25 2000-01-20 21:40:26 sandervl Exp $ */
    22
    33/*
     
    2727#include <heapstring.h>
    2828#include "misc.h"
    29 
     29#include "codepage.h"
    3030
    3131/*****************************************************************************
     
    3434
    3535ODINDEBUGCHANNEL(KERNEL32-HEAPSTRING)
    36 
    37 
    38 /*****************************************************************************
    39  * Name      :
    40  * Purpose   :
    41  * Parameters:
    42  * Variables :
    43  * Result    :
    44  * Remark    :
    45  * Status    :
    46  *
    47  * Author    : Patrick Haller [Thu, 1999/08/05 20:46]
    48  *****************************************************************************/
    49 
    50 static UconvObject uconv_object = NULL;
    51 
    52 static BOOL getUconvObject( void )
    53 {
    54   int rc;
    55   BOOL ret;
    56 
    57   if ( uconv_object )
    58     ret = TRUE;
    59   else
    60   {
    61     rc = UniCreateUconvObject( (UniChar*)L"",
    62                               &uconv_object );
    63     if ( rc == ULS_SUCCESS )
    64       ret = TRUE;
    65     else
    66     {
    67       uconv_object = NULL;  // to make sure
    68       return FALSE;
    69     }
    70     dprintf2(("KERNEL32: HeapString: UniCreateUconvObject(%d)\n",
    71              rc));
    72   }
    73   return ret;
    74 }
    75 
    7636
    7737/*****************************************************************************
     
    515475// returns string length
    516476
    517 int WIN32API lstrcpynWtoA(LPSTR  astring,
     477int WIN32API lstrcpynCtoA(LPSTR  astring,
    518478                          LPCWSTR ustring,
    519                           int    unilen)
     479                          int    unilen,
     480                          UconvObject uconv_object)
    520481{
    521482  int      i;
     
    537498    return 0;
    538499
    539   if (getUconvObject())
     500  if (uconv_object)
    540501  {
    541502    if (unilen == 1)
     
    578539}
    579540
     541int WIN32API lstrcpynWtoA(LPSTR  astring,
     542                          LPCWSTR ustring,
     543                          int    unilen)
     544{
     545    return lstrcpynCtoA(astring, ustring, unilen, GetWindowsUconvObject());
     546}
     547
    580548
    581549/*****************************************************************************
     
    593561// asciilen: max length of unicode buffer (including end 0)
    594562// @@@PH 0 termination is NOT necessarily included !
    595 int WIN32API lstrcpynAtoW(LPWSTR unicode,
    596                           LPCSTR  ascii,
    597                           int    asciilen)
     563int lstrcpynAtoC(LPWSTR unicode,
     564                 LPCSTR  ascii,
     565                 int    asciilen,
     566                 UconvObject uconv_object)
    598567{
    599568  int      rc;
     
    620589    return 0; //nothing to do
    621590
    622   if (getUconvObject())
     591  if (uconv_object)
    623592  {
    624593    //@@@PH what's this?
     
    637606    in_bytes_left = strlen(in_buf)+1;
    638607    in_bytes_left = asciilen = min(in_bytes_left, asciilen); //buffer size in bytes
    639    
     608
    640609    out_buf = (UniChar*)unicode;
    641610
     
    670639}
    671640
     641int WIN32API lstrcpynAtoW(LPWSTR unicode,
     642                          LPCSTR  ascii,
     643                          int    asciilen)
     644{
     645    return lstrcpynAtoC(unicode, ascii, asciilen, GetWindowsUconvObject());
     646}
    672647
    673648/*****************************************************************************
  • trunk/src/kernel32/misc.cpp

    r2430 r2485  
    1 /* $Id: misc.cpp,v 1.17 2000-01-13 20:09:09 sandervl Exp $ */
     1/* $Id: misc.cpp,v 1.18 2000-01-20 21:40:26 sandervl Exp $ */
    22
    33/*
     
    361361void OpenPrivateLogFiles()
    362362{
    363   OpenPrivateLogFilePE();
     363#ifdef DEFAULT_LOGGING_OFF
     364    if(getenv("WIN32LOG_ENABLED")) {
     365#else
     366    if(!getenv("NOWIN32LOG")) {
     367#endif
     368        OpenPrivateLogFilePE();
     369    }
    364370}
    365371//******************************************************************************
     
    368374void ClosePrivateLogFiles()
    369375{
    370   ClosePrivateLogFilePE();
     376#ifdef DEFAULT_LOGGING_OFF
     377    if(getenv("WIN32LOG_ENABLED")) {
     378#else
     379    if(!getenv("NOWIN32LOG")) {
     380#endif
     381        ClosePrivateLogFilePE();
     382    }
    371383}
    372384//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.