mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +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:
parent
d8d17be290
commit
7ae329e663
@ -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.
|
||||
**/
|
||||
|
@ -10,8 +10,8 @@
|
||||
] interface winreg
|
||||
{
|
||||
typedef struct {
|
||||
[value(2*(strlen_m(r->name)+1))] uint16 name_len;
|
||||
[value(r->name_len)] uint16 name_size;
|
||||
[value(strlen_m_term(r->name)*2)] uint16 name_len;
|
||||
[value(r->name_len)] uint16 name_size;
|
||||
unistr *name;
|
||||
} winreg_String;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user