summaryrefslogtreecommitdiff
path: root/source3/lib/fstring.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-03-30 10:27:04 -0700
committerJeremy Allison <jra@samba.org>2011-03-30 20:58:10 +0200
commitd546adeab54af123eff66cee61a487c88b6ba61b (patch)
tree663798349655444d882f491f61f2975a78503c2a /source3/lib/fstring.c
parent048471d14b3ed65fe83e8f225e03af925aaf0c47 (diff)
downloadsamba-d546adeab54af123eff66cee61a487c88b6ba61b.tar.gz
samba-d546adeab54af123eff66cee61a487c88b6ba61b.tar.bz2
samba-d546adeab54af123eff66cee61a487c88b6ba61b.zip
Change convert_string_internal() and convert_string_error() to bool return.
Move closer to makeing all convert_string_XXX functions return bool. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 20:58:10 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/lib/fstring.c')
-rw-r--r--source3/lib/fstring.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/lib/fstring.c b/source3/lib/fstring.c
index 74c2138975..50b0765f92 100644
--- a/source3/lib/fstring.c
+++ b/source3/lib/fstring.c
@@ -35,17 +35,19 @@ size_t push_ascii_fstring(void *dest, const char *src)
this function uses convert_string_error() to avoid common debug
warnings where is unable to convert strings to CH_DOS. The target
string is truncated at the first character that cannot be converted
- The target is always null terminated. The resulting string size,
- without the null termination, it returned
+ The target is always null terminated.
********************************************************************/
size_t push_ascii_nstring(void *dest, const char *src)
{
size_t converted_size = 0;
- size_t ret;
- ret = convert_string_error(CH_UNIX, CH_DOS, src, -1, dest, sizeof(nstring), &converted_size);
- SCVAL(dest, sizeof(nstring)-1, 0);
- return ret;
+ bool ret = convert_string_error(CH_UNIX, CH_DOS, src, -1, dest, sizeof(nstring), &converted_size);
+ if (ret) {
+ SCVAL(dest, sizeof(nstring)-1, 0);
+ } else {
+ SCVAL(dest, 0, 0);
+ }
+ return ret ? converted_size : (size_t)-1;
}
size_t pull_ascii_fstring(char *dest, const void *src)