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

VT: Codepages changes/bugfixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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/*****************************************************************************
Note: See TracChangeset for help on using the changeset viewer.