Ignore:
Timestamp:
Sep 15, 2008, 5:25:08 PM (16 years ago)
Author:
dai
Message:

WCHAR配列をUnicode文字列としてデバッグ窓に表示可能にした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/jenga/src/common/String.cpp

    r747 r748  
    3535std::string Jenga::Common::ToString( const std::wstring &wstr )
    3636{
    37     char *pstr = (char *)malloc( wstr.length() + 1 );
    38 
    39     WideCharToMultiByte(
    40         CP_ACP,
     37    int needSize =  WideCharToMultiByte(
     38        CP_THREAD_ACP,
    4139        0,
    4240        wstr.c_str(), -1,
    43         pstr, static_cast<int>(wstr.length()) + 1,
     41        NULL, NULL,
     42        NULL, NULL );
     43
     44    char *pstr = (char *)calloc( needSize + 1, 1 );
     45    WideCharToMultiByte(
     46        CP_THREAD_ACP,
     47        0,
     48        wstr.c_str(), -1,
     49        pstr, needSize,
    4450        NULL, NULL );
    4551
Note: See TracChangeset for help on using the changeset viewer.