summaryrefslogtreecommitdiffstats
path: root/source/lib
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-02-17 15:17:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:40 -0500
commit0edcfc7fa20fd8e3273b29c8f1a97cb7c7179fb6 (patch)
tree6b927f8bdf3d359e9078cefe5571e9d61f11f32a /source/lib
parent543799fc0ddc3176469acc1fab7093c41556d403 (diff)
downloadsamba-0edcfc7fa20fd8e3273b29c8f1a97cb7c7179fb6.tar.gz
samba-0edcfc7fa20fd8e3273b29c8f1a97cb7c7179fb6.tar.xz
samba-0edcfc7fa20fd8e3273b29c8f1a97cb7c7179fb6.zip
r5431: couple of cimpile fixes from Jason Mader <jason@ncac.gwu.edu> -- BUGS 2341 & 2342
Diffstat (limited to 'source/lib')
-rw-r--r--source/lib/util_unistr.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index bb9d69b164d..55a21ebcbbc 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -454,16 +454,20 @@ smb_ucs2_t *strnrchr_w(const smb_ucs2_t *s, smb_ucs2_t c, unsigned int n)
smb_ucs2_t *strstr_w(const smb_ucs2_t *s, const smb_ucs2_t *ins)
{
smb_ucs2_t *r;
- size_t slen, inslen;
+ size_t inslen;
+
+ if (!s || !*s || !ins || !*ins)
+ return NULL;
- if (!s || !*s || !ins || !*ins) return NULL;
- slen = strlen_w(s);
inslen = strlen_w(ins);
r = (smb_ucs2_t *)s;
+
while ((r = strchr_w(r, *ins))) {
- if (strncmp_w(r, ins, inslen) == 0) return r;
+ if (strncmp_w(r, ins, inslen) == 0)
+ return r;
r++;
}
+
return NULL;
}
@@ -736,16 +740,20 @@ smb_ucs2_t *strpbrk_wa(const smb_ucs2_t *s, const char *p)
smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins)
{
smb_ucs2_t *r;
- size_t slen, inslen;
+ size_t inslen;
+
+ if (!s || !*s || !ins || !*ins)
+ return NULL;
- if (!s || !*s || !ins || !*ins) return NULL;
- slen = strlen_w(s);
inslen = strlen(ins);
r = (smb_ucs2_t *)s;
+
while ((r = strchr_w(r, UCS2_CHAR(*ins)))) {
- if (strncmp_wa(r, ins, inslen) == 0) return r;
+ if (strncmp_wa(r, ins, inslen) == 0)
+ return r;
r++;
}
+
return NULL;
}