Changeset 591 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp
- Timestamp:
- May 10, 2008, 6:11:29 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp
r589 r591 29 29 return retSize; 30 30 } 31 int DataTable::AddString( const char *str, int length ){32 int retSize = size;33 34 if( compiler.IsUnicode() ){35 //Shift-JIS → Unicode36 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 }60 31 int DataTable::AddString( const char *str ) 61 32 { 62 return Add String( str, lstrlen( str) );33 return AddBinary( str, lstrlen( str ) + sizeof(char) ); 63 34 } 64 35 int DataTable::AddString( const std::string &str ) 65 36 { 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 } 39 int DataTable::AddWString( const std::wstring &wstr ) 40 { 41 return AddBinary( wstr.c_str(), static_cast<int>(wstr.size()) + sizeof(wchar_t) ); 67 42 } 68 43 int DataTable::AddSpace( int size )
Note:
See TracChangeset
for help on using the changeset viewer.