[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-339-gc21e9bd
Jeremy Allison
jra at samba.org
Tue Nov 20 01:51:59 GMT 2007
The branch, v3-2-test has been updated
via c21e9bdc1059268adbd14207e74097349676439e (commit)
from 9c3d10521e691169cfbb8b728f123911c3c970ae (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit c21e9bdc1059268adbd14207e74097349676439e
Author: Jeremy Allison <jra at samba.org>
Date: Mon Nov 19 17:51:21 2007 -0800
Start to remove some of the pstring functions we're
no longer using.
Jeremy.
-----------------------------------------------------------------------
Summary of changes:
source/lib/charcnv.c | 12 +-----------
source/lib/util_unistr.c | 45 ++++++++++++++++++++++-----------------------
2 files changed, 23 insertions(+), 34 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/charcnv.c b/source/lib/charcnv.c
index 7c3545d..da972f5 100644
--- a/source/lib/charcnv.c
+++ b/source/lib/charcnv.c
@@ -993,11 +993,6 @@ size_t push_ascii_fstring(void *dest, const char *src)
return push_ascii(dest, src, sizeof(fstring), STR_TERMINATE);
}
-size_t push_ascii_pstring(void *dest, const char *src)
-{
- return push_ascii(dest, src, sizeof(pstring), STR_TERMINATE);
-}
-
/********************************************************************
Push an nstring - ensure null terminated. Written by
moriyama at miraclelinux.com (MORIYAMA Masayuki).
@@ -1471,7 +1466,7 @@ size_t pull_ucs2(const void *base_ptr, char *dest, const void *src, size_t dest_
The resulting string in "dest" is always null terminated.
**/
-static size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
+size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
const void *base_ptr,
char **ppdest,
const void *src,
@@ -1561,11 +1556,6 @@ static size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
return src_len;
}
-size_t pull_ucs2_pstring(char *dest, const void *src)
-{
- return pull_ucs2(NULL, dest, src, sizeof(pstring), -1, STR_TERMINATE);
-}
-
size_t pull_ucs2_fstring(char *dest, const void *src)
{
return pull_ucs2(NULL, dest, src, sizeof(fstring), -1, STR_TERMINATE);
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index 8fad116..1fef6ab 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -422,16 +422,33 @@ void unistr3_to_ascii(char *dest, const UNISTR3 *str, size_t maxlen)
pull_ucs2(NULL, dest, str->str.buffer, maxlen, str->uni_str_len*2,
STR_NOALIGN);
}
-
+
/*******************************************************************
- Give a static string for displaying a UNISTR2.
+ Return a string for displaying a UNISTR2. Guarentees to return a
+ valid string - "" if nothing else.
+ Changed to use talloc_tos() under the covers.... JRA.
********************************************************************/
const char *unistr2_static(const UNISTR2 *str)
{
- static pstring ret;
- unistr2_to_ascii(ret, str, sizeof(ret));
- return ret;
+ size_t ret = (size_t)-1;
+ char *dest = NULL;
+
+ if ((str == NULL) || (str->uni_str_len == 0)) {
+ return "";
+ }
+
+ ret = pull_ucs2_base_talloc(talloc_tos(),
+ NULL,
+ &dest,
+ str->buffer,
+ str->uni_str_len*2,
+ STR_NOALIGN);
+ if (ret == (size_t)-1 || dest == NULL) {
+ return "";
+ }
+
+ return dest;
}
/*******************************************************************
@@ -992,24 +1009,6 @@ smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins)
return NULL;
}
-bool trim_string_wa(smb_ucs2_t *s, const char *front,
- const char *back)
-{
- wpstring f, b;
-
- if (front) {
- push_ucs2(NULL, f, front, sizeof(wpstring) - 1, STR_TERMINATE);
- } else {
- *f = 0;
- }
- if (back) {
- push_ucs2(NULL, b, back, sizeof(wpstring) - 1, STR_TERMINATE);
- } else {
- *b = 0;
- }
- return trim_string_w(s, f, b);
-}
-
/*******************************************************************
Returns the length in number of wide characters.
******************************************************************/
--
Samba Shared Repository
More information about the samba-cvs
mailing list