static size_t WdeStringToMem( const char *string, uint_8 use_unicode, uint_8 *data ) { size_t size; if( string == NULL ) { string = ""; } if( use_unicode ) { size = 0; if( WRmbcs2unicode( string, NULL, &size ) ) { if( !WRmbcs2unicodeBuf( string, (char *)data, size ) ) { size = 0; } } if( size == 0 ) { U16ToMem( data, 0 ); size = sizeof( uint_16 ); } } else { size = strlen( string ) + 1; memcpy( data, string, size ); } return( size ); }
static int WdeStringToMem( char *string, uint_8 use_unicode, uint_8 *mem ) { int len; uint_16 *data16; if( !string ) { string = ""; } if( use_unicode ) { len = 0; if( WRmbcs2unicode( string, NULL, &len ) ) { if( !WRmbcs2unicodeBuf( string, (char *)mem, len ) ) { len = 0; } } if( len == 0 ) { data16 = (uint_16 *)mem; data16[0] = 0; len = 2; } } else { len = strlen( string ) + 1; memcpy( mem, string, len ); } return( len ); }