/* * Copyright 2004 Perforce Software. All rights reserved. * * Developed by Data Shades Ltd. */ #include "Translate.h" #include "debug.h" #ifdef _UNICODE void Translate::ToWinChar( const char *s, UniStrBuf *b ) { b->Clear(); int nchars = MultiByteToWideChar( CP_UTF8, 0, s, -1, NULL, 0); TCHAR *buff = (TCHAR *)b->Alloc( ( nchars + 1 ) * sizeof( TCHAR ) ); int ret = MultiByteToWideChar( CP_UTF8, 0, s, -1, buff, nchars ); buff[nchars] = '\0'; } void Translate::FromWinChar( TCHAR *s, StrBuf *b ) { b->Clear(); int buflen = WideCharToMultiByte( CP_UTF8, 0, s, -1, NULL, 0, NULL, NULL ); char *buff = b->Alloc( buflen ); WideCharToMultiByte( CP_UTF8, 0, s, -1, buff, buflen, NULL, NULL ); b->SetLength( buflen-1 ); } #else void Translate::ToWinChar( const char *s, UniStrBuf *b ) { b->Set( s ); } void Translate::FromWinChar( TCHAR *s, StrBuf *b ) { b->Set( s ); } #endif
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 11314 | Robert Cowham | Initial population of perforce_software version of P4OFC | ||
//guest/robert_cowham/perforce/P4OFC/main/libp4gt/Translate.cpp | |||||
#1 | 10843 | Robert Cowham |
Initial version of P4OFC source code. See README.txt (and LICENSE.txt and doc\P4OFC-Design.docx) |