Ignore:
Timestamp:
May 10, 2008, 6:11:29 PM (16 years ago)
Author:
dai_9181
Message:

DataTable::AddWStringメソッドを追加。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp

    r589 r591  
    2929    return retSize;
    3030}
    31 int DataTable::AddString( const char *str, int length ){
    32     int retSize = size;
    33 
    34     if( compiler.IsUnicode() ){
    35         //Shift-JIS → Unicode
    36         int size = MultiByteToWideChar(
    37             CP_ACP,
    38             0,
    39             str, length + 1,
    40             NULL, 0 ) * 2;
    41 
    42         LPWSTR pwstr = (LPWSTR)malloc( size );
    43 
    44         MultiByteToWideChar(
    45             CP_ACP,
    46             0,
    47             str, length + 1,
    48             pwstr, length + 1 );
    49 
    50         AddBinary( pwstr, size );
    51 
    52         free( pwstr );
    53     }
    54     else{
    55         AddBinary( str, length + 1 );
    56     }
    57 
    58     return retSize;
    59 }
    6031int DataTable::AddString( const char *str )
    6132{
    62     return AddString( str, lstrlen( str ) );
     33    return AddBinary( str, lstrlen( str ) + sizeof(char) );
    6334}
    6435int DataTable::AddString( const std::string &str )
    6536{
    66     return AddString( str.c_str(), static_cast<int>(str.length()) );
     37    return AddBinary( str.c_str(), static_cast<int>(str.size()) + sizeof(char) );
     38}
     39int DataTable::AddWString( const std::wstring &wstr )
     40{
     41    return AddBinary( wstr.c_str(), static_cast<int>(wstr.size()) + sizeof(wchar_t) );
    6742}
    6843int DataTable::AddSpace( int size )
Note: See TracChangeset for help on using the changeset viewer.