diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-09-30 13:30:52 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-09-30 13:30:52 +0000 |
commit | b7ca6ec034c8b707e462e4a4457a65ce9bea0f79 (patch) | |
tree | db1912872e08fc3feaeaa4ee37147599495c5e8f /source3/lib/util_unistr.c | |
parent | 9a22ac94a4d1be0377562644e3704a2134b9d645 (diff) | |
download | samba-b7ca6ec034c8b707e462e4a4457a65ce9bea0f79.tar.gz samba-b7ca6ec034c8b707e462e4a4457a65ce9bea0f79.tar.bz2 samba-b7ca6ec034c8b707e462e4a4457a65ce9bea0f79.zip |
make strupper() and strlower() not modify the string if it doesn't
need modifying
that makes constant strings OK
(This used to be commit 57196635d9b7edfcbfe1708dd22308ab30c02240)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r-- | source3/lib/util_unistr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 8248ac073c..887c15f0d9 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -248,26 +248,36 @@ smb_ucs2_t *strchr_w(const smb_ucs2_t *s, smb_ucs2_t c) /******************************************************************* Convert a string to lower case. + return True if any char is converted ********************************************************************/ -void strlower_w(smb_ucs2_t *s) +BOOL strlower_w(smb_ucs2_t *s) { + BOOL ret = False; while (*s) { - if (isupper_w(*s)) + if (isupper_w(*s)) { *s = tolower_w(*s); + ret = True; + } s++; } + return ret; } /******************************************************************* Convert a string to upper case. + return True if any char is converted ********************************************************************/ -void strupper_w(smb_ucs2_t *s) +BOOL strupper_w(smb_ucs2_t *s) { + BOOL ret = False; while (*s) { - if (islower_w(*s)) + if (islower_w(*s)) { *s = toupper_w(*s); + ret = True; + } s++; } + return ret; } /******************************************************************* |