Make @outs_len to be 0 when @**outs NULL in ntfs_ucstombs calls. Previous code

it correct since @outs_len is ingored when @**outs == NULL, but may confuse
because it was equal to @ins_len what is incorrect (eg. international utf8
characters).
edge.strict_endians
cha0smaster 2005-07-19 23:13:26 +00:00
parent 53a1ae67f9
commit c8cb65fcd9
3 changed files with 7 additions and 7 deletions

View File

@ -1270,7 +1270,7 @@ static int ntfs_dt_count_root (struct ntfs_dt *dt)
}
if (!(entry->flags & INDEX_ENTRY_END)) {
ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length);
ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0);
//printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name);
free (name);
name = NULL;
@ -1337,7 +1337,7 @@ static int ntfs_dt_count_alloc (struct ntfs_dt *dt)
if (entry->flags & INDEX_ENTRY_END) {
break;
} else {
ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, entry->key.file_name.file_name_length);
ntfs_ucstombs (entry->key.file_name.file_name, entry->key.file_name.file_name_length, &name, 0);
//printf ("\tinode %8lld %s\n", MREF (entry->indexed_file), name);
free (name);
name = NULL;

View File

@ -882,7 +882,7 @@ static int get_filenames (struct ufile *file, ntfs_volume* vol)
name->date_r = ntfs2utc (sle64_to_cpu (attr->last_access_time));
if (ntfs_ucstombs (name->uname, name->uname_len, &name->name,
name->uname_len) < 0) {
0) < 0) {
Dprintf ("ERROR: Couldn't translate filename to current locale.\n");
}
@ -957,7 +957,7 @@ static int get_data (struct ufile *file, ntfs_volume *vol)
data->uname_len = rec->name_length;
if (ntfs_ucstombs (data->uname, data->uname_len, &data->name,
data->uname_len) < 0) {
0) < 0) {
Eprintf ("ERROR: Cannot translate name into current locale.\n");
}
}

View File

@ -461,7 +461,7 @@ int utils_inode_get_name (ntfs_inode *inode, char *buffer, int bufsize)
}
if (ntfs_ucstombs (attr->file_name, attr->file_name_length,
&names[i], attr->file_name_length) < 0) {
&names[i], 0) < 0) {
char *temp;
Eprintf ("Couldn't translate filename to current locale.\n");
temp = malloc (30);
@ -542,7 +542,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int
if (attrdef) {
name = NULL;
namelen = ntfs_ucsnlen (attrdef->name, sizeof (attrdef->name));
if (ntfs_ucstombs (attrdef->name, namelen, &name, namelen) < 0) {
if (ntfs_ucstombs (attrdef->name, namelen, &name, 0) < 0) {
Eprintf ("Couldn't translate attribute type to current locale.\n");
// <UNKNOWN>?
return 0;
@ -568,7 +568,7 @@ int utils_attr_get_name (ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int
name = NULL;
namelen = attr->name_length;
if (ntfs_ucstombs ((ntfschar *)((char *)attr + attr->name_offset),
namelen, &name, namelen) < 0) {
namelen, &name, 0) < 0) {
Eprintf ("Couldn't translate attribute name to current locale.\n");
// <UNKNOWN>?
len = snprintf (buffer, bufsize, "<UNKNOWN>");