1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Add a strlen_m_term() function for returning the length of a string

including the termination.  Using value(strlen_m((r->name)+1)*2) gives
the wrong answer for the NULL string.
This commit is contained in:
Tim Potter 0001-01-01 00:00:00 +00:00
parent d8d17be290
commit 7ae329e663
2 changed files with 17 additions and 2 deletions

View File

@ -1091,6 +1091,21 @@ size_t strlen_m(const char *s)
return count + strlen_w(tmpbuf);
}
/**
Work out the number of multibyte chars in a string, including the NULL
terminator.
**/
size_t strlen_m_term(const char *s)
{
size_t count = 0;
if (!s) {
return 0;
}
return strlen_m(s) + 1;
}
/**
Convert a string to upper case.
**/

View File

@ -10,7 +10,7 @@
] interface winreg
{
typedef struct {
[value(2*(strlen_m(r->name)+1))] uint16 name_len;
[value(strlen_m_term(r->name)*2)] uint16 name_len;
[value(r->name_len)] uint16 name_size;
unistr *name;
} winreg_String;