Ignore:
Timestamp:
Oct 27, 1999, 8:36:36 PM (26 years ago)
Author:
phaller
Message:

Fix: console (unicode) updates

File:
1 edited

Legend:

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

    r1292 r1484  
    1 /* $Id: heapstring.cpp,v 1.15 1999-10-14 17:15:26 phaller Exp $ */
     1/* $Id: heapstring.cpp,v 1.16 1999-10-27 18:36:36 phaller Exp $ */
    22
    33/*
     
    570570
    571571// asciilen: max length of unicode buffer (including end 0)
    572 
     572// @@@PH 0 termination is NOT necessarily included !
    573573int WIN32API lstrcpynAtoW(LPWSTR unicode,
    574574                          LPSTR  ascii,
     
    583583  char*    in_buf;
    584584
    585   dprintf(("KERNEL32: HeapString: lstrcpynAtoW(%s,%08xh)\n",
     585  dprintf(("KERNEL32: HeapString: lstrcpynAtoW(%s,%08xh,%d)\n",
    586586           ascii,
    587            unicode));
     587           unicode,
     588           asciilen));
    588589
    589590  //CB: no input, set at least terminator
     
    599600  if (getUconvObject())
    600601  {
    601     if (asciilen == 1)
     602    //@@@PH what's this?
     603    if ((asciilen == 1) && (*ascii == '\0') )
    602604    {
    603605       unicode[0] = 0;
     
    606608
    607609    in_buf        = ascii;
    608     in_bytes_left = asciilen-1; //buffer size in bytes
     610
     611    //@@@PH what's this?
     612    //in_bytes_left = asciilen-1; //buffer size in bytes
     613
     614    in_bytes_left = asciilen; //buffer size in bytes
    609615    out_buf = (UniChar*)unicode;
    610616
     
    616622                        &num_subs );
    617623
    618     unicode[asciilen-1-in_bytes_left] = 0;
     624    //@@@PH what's this?
     625    //unicode[asciilen-1-in_bytes_left] = 0;
    619626
    620627    //if (rc != ULS_SUCCESS && in_bytes_left > 0) //CB: never the case during my tests
    621628    //   dprintf(("KERNEL32: AsciiToUnicode failed, %d bytes left!\n",in_bytes_left));
    622     return asciilen - 1;
     629
     630    //@@@PH what's this?
     631    //return asciilen - 1;
     632    return asciilen;
    623633  }
    624634  else
    625635  { //poor man's conversion
    626636
    627     for(i = 0;i < asciilen-1;i++)
     637//    for(i = 0;i < asciilen-1;i++)
     638    for(i = 0;i < asciilen;i++)
    628639    {
    629640      unicode[i] = ascii[i];
    630641      if (ascii[i] == 0)
    631         return i-1; //work done
     642        //return i-1; //work done
     643        return i; //work done
    632644    }
    633645
    634     unicode[asciilen-1] = 0;
    635     return asciilen-1;
     646//    unicode[asciilen-1] = 0;
     647//    return asciilen-1;
     648    return asciilen;
    636649  }
    637650}
     
    652665LPSTR WIN32API lstrcpyWtoA(LPSTR ascii, LPWSTR unicode)
    653666{
     667  //@@@PH huh? wuz dat?
    654668  if (unicode == NULL)
    655669  {
Note: See TracChangeset for help on using the changeset viewer.