server: Use byte length in dump_strW() for consistency.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-03-21 11:36:33 +01:00
parent 9eab89bec6
commit 78846662ec
6 changed files with 12 additions and 13 deletions

View File

@ -188,7 +188,7 @@ static void atom_table_dump( struct object *obj, int verbose )
if (!entry) continue;
fprintf( stderr, " %04x: ref=%d pinned=%c hash=%d \"",
entry->atom, entry->count, entry->pinned ? 'Y' : 'N', entry->hash );
dump_strW( entry->str, entry->len / sizeof(WCHAR), stderr, "\"\"");
dump_strW( entry->str, entry->len, stderr, "\"\"");
fprintf( stderr, "\"\n" );
}
}

View File

@ -373,7 +373,7 @@ static void dump_name( struct object *obj )
if (!name) return;
if (name->parent) dump_name( name->parent );
fputs( "\\\\", stderr );
dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" );
dump_strW( name->name, name->len, stderr, "[]" );
}
/* dump the name of an object to stderr */

View File

@ -198,7 +198,7 @@ static void dump_path( const struct key *key, const struct key *base, FILE *f )
dump_path( key->parent, base, f );
fprintf( f, "\\\\" );
}
dump_strW( key->name, key->namelen / sizeof(WCHAR), f, "[]" );
dump_strW( key->name, key->namelen, f, "[]" );
}
/* dump a value to a text file */
@ -210,7 +210,7 @@ static void dump_value( const struct key_value *value, FILE *f )
if (value->namelen)
{
fputc( '\"', f );
count = 1 + dump_strW( value->name, value->namelen / sizeof(WCHAR), f, "\"\"" );
count = 1 + dump_strW( value->name, value->namelen, f, "\"\"" );
count += fprintf( f, "\"=" );
}
else count = fprintf( f, "@=" );
@ -226,7 +226,7 @@ static void dump_value( const struct key_value *value, FILE *f )
if (((WCHAR *)value->data)[value->len / sizeof(WCHAR) - 1]) break;
if (value->type != REG_SZ) fprintf( f, "str(%x):", value->type );
fputc( '\"', f );
dump_strW( (WCHAR *)value->data, value->len / sizeof(WCHAR), f, "\"\"" );
dump_strW( (WCHAR *)value->data, value->len, f, "\"\"" );
fprintf( f, "\"\n" );
return;
@ -272,7 +272,7 @@ static void save_subkeys( const struct key *key, const struct key *base, FILE *f
if (key->class)
{
fprintf( f, "#class=\"" );
dump_strW( key->class, key->classlen / sizeof(WCHAR), f, "\"\"" );
dump_strW( key->class, key->classlen, f, "\"\"" );
fprintf( f, "\"\n" );
}
if (key->flags & KEY_SYMLINK) fputs( "#link\n", f );

View File

@ -81,7 +81,7 @@ static void symlink_dump( struct object *obj, int verbose )
assert( obj->ops == &symlink_ops );
fputs( "Symlink target=\"", stderr );
dump_strW( symlink->target, symlink->len / sizeof(WCHAR), stderr, "\"\"" );
dump_strW( symlink->target, symlink->len, stderr, "\"\"" );
fputs( "\"\n", stderr );
}

View File

@ -105,7 +105,7 @@ static void dump_rectangle( const char *prefix, const rectangle_t *rect )
static void dump_char_info( const char *prefix, const char_info_t *info )
{
fprintf( stderr, "%s{'", prefix );
dump_strW( &info->ch, 1, stderr, "\'\'" );
dump_strW( &info->ch, sizeof(info->ch), stderr, "\'\'" );
fprintf( stderr, "',%04x}", info->attr );
}
@ -544,7 +544,7 @@ static void dump_varargs_string( const char *prefix, data_size_t size )
static void dump_varargs_unicode_str( const char *prefix, data_size_t size )
{
fprintf( stderr, "%sL\"", prefix );
dump_strW( cur_data, size / sizeof(WCHAR), stderr, "\"\"" );
dump_strW( cur_data, size, stderr, "\"\"" );
fputc( '\"', stderr );
remove_data( size );
}
@ -824,9 +824,8 @@ static data_size_t dump_inline_unicode_string( const char *prefix, data_size_t p
fputs( prefix, stderr );
if (pos >= total_size) return pos;
if (len > total_size - pos) len = total_size - pos;
len /= sizeof(WCHAR);
dump_strW( (const WCHAR *)cur_data + pos/sizeof(WCHAR), len, stderr, "\"\"" );
return pos + len * sizeof(WCHAR);
return pos + (len / sizeof(WCHAR)) * sizeof(WCHAR);
}
static void dump_varargs_startup_info( const char *prefix, data_size_t size )
@ -1133,7 +1132,7 @@ static void dump_varargs_object_attributes( const char *prefix, data_size_t size
dump_inline_security_descriptor( ",sd=", (const struct security_descriptor *)(objattr + 1), objattr->sd_len );
str = (const WCHAR *)objattr + (sizeof(*objattr) + objattr->sd_len) / sizeof(WCHAR);
fprintf( stderr, ",name=L\"" );
dump_strW( str, objattr->name_len / sizeof(WCHAR), stderr, "\"\"" );
dump_strW( str, objattr->name_len, stderr, "\"\"" );
fputc( '\"', stderr );
remove_data( (sizeof(*objattr) + (objattr->sd_len & ~1) + (objattr->name_len & ~1) + 3) & ~3 );
}

View File

@ -156,7 +156,7 @@ int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2]
char *pos = buffer;
int count = 0;
for (; len; str++, len--)
for (len /= sizeof(WCHAR); len; str++, len--)
{
if (pos > buffer + sizeof(buffer) - 8)
{