The branch, master has been updated
       via  0c22d55134b39a6bc983b4f852f623a51af4d362 (commit)
       via  3277b19800c6c56a32b7641d293e496475d8c62a (commit)
       via  80163b5ac5bfff3698aeb9c5c43a2cc94947055c (commit)
       via  5fff53882002bf5378690ddeb8251e2c99490266 (commit)
      from  c4ad3e57ff23b3a64e8a351c4b5466eabe52f3f1 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0c22d55134b39a6bc983b4f852f623a51af4d362
Author: Andrew Bartlett <[email protected]>
Date:   Thu Mar 19 19:20:08 2009 +1100

    s3:charcnv Remove unused unistrcpy() and unistrlen()
    
    Signed-off-by: Günther Deschner <[email protected]>

commit 3277b19800c6c56a32b7641d293e496475d8c62a
Author: Andrew Bartlett <[email protected]>
Date:   Thu Mar 19 19:18:14 2009 +1100

    s3:rpc_parse remove unused prs_unistr2()
    
    Signed-off-by: Günther Deschner <[email protected]>

commit 80163b5ac5bfff3698aeb9c5c43a2cc94947055c
Author: Andrew Bartlett <[email protected]>
Date:   Thu Mar 19 19:14:36 2009 +1100

    s3:charcnv Remove unused unistr2 functions
    
    Natrually, the hard work to make these unsued was done by GD, not me :-)
    
    Andrew Bartlett
    
    Signed-off-by: Günther Deschner <[email protected]>

commit 5fff53882002bf5378690ddeb8251e2c99490266
Author: Andrew Bartlett <[email protected]>
Date:   Thu Mar 19 19:11:15 2009 +1100

    s3:charcnv Remove unused ucs2_to_unistr2()
    
    Signed-off-by: Günther Deschner <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h       |    9 --
 source3/lib/util_unistr.c     |  199 -----------------------------------------
 source3/rpc_parse/parse_prs.c |   38 --------
 3 files changed, 0 insertions(+), 246 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index b677c3d..f8a28ef 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1560,13 +1560,8 @@ int rpcstr_pull_talloc(TALLOC_CTX *ctx,
                        void *src,
                        int src_len,
                        int flags);
-int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src);
-char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src);
 int rpcstr_push(void *dest, const char *src, size_t dest_len, int flags);
 int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, const char *src);
-void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen);
-char *unistr2_to_ascii_talloc(TALLOC_CTX *ctx, const UNISTR2 *str);
-const char *unistr2_static(const UNISTR2 *str);
 smb_ucs2_t toupper_w(smb_ucs2_t val);
 smb_ucs2_t tolower_w( smb_ucs2_t val );
 bool islower_w(smb_ucs2_t c);
@@ -1600,9 +1595,6 @@ int strcmp_wa(const smb_ucs2_t *a, const char *b);
 int strncmp_wa(const smb_ucs2_t *a, const char *b, size_t len);
 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);
-int unistrlen(uint16 *s);
-int unistrcpy(uint16 *dst, uint16 *src);
-UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src);
 int toupper_ascii(int c);
 int tolower_ascii(int c);
 int isupper_ascii(int c);
@@ -5788,7 +5780,6 @@ bool prs_uint8s(bool charmode, const char *name, 
prs_struct *ps, int depth, uint
 bool prs_uint16s(bool charmode, const char *name, prs_struct *ps, int depth, 
uint16 *data16s, int len);
 bool prs_uint16uni(bool charmode, const char *name, prs_struct *ps, int depth, 
uint16 *data16s, int len);
 bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, 
uint32 *data32s, int len);
-bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, 
UNISTR2 *str);
 bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str);
 bool prs_string(const char *name, prs_struct *ps, int depth, char *str, int 
max_buf_size);
 bool prs_string_alloc(const char *name, prs_struct *ps, int depth, const char 
**str);
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 840e8e0..7d80b3c 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -291,64 +291,6 @@ int rpcstr_pull_talloc(TALLOC_CTX *ctx,
 
 }
 
-/* Copy a string from a unistr2 source to internal samba format
-   destination.  Use this instead of direct calls to rpcstr_pull() to avoid
-   having to determine whether the source string is null terminated. */
-
-int rpcstr_pull_unistr2_fstring(char *dest, UNISTR2 *src)
-{
-        return pull_ucs2(NULL, dest, src->buffer, sizeof(fstring),
-                         src->uni_str_len * 2, 0);
-}
-
-/* Helper function to return a talloc'ed string. I have implemented it with a
- * copy because I don't really know how pull_ucs2 and friends calculate the
- * target size. If this turns out to be a major bottleneck someone with deeper
- * multi-byte knowledge needs to revisit this.
- * I just did (JRA :-). No longer uses copy.
- * My (VL) use is dsr_getdcname, which returns 6 strings, the alternative would
- * have been to manually talloc_strdup them in rpc_client/cli_netlogon.c.
- */
-
-char *rpcstr_pull_unistr2_talloc(TALLOC_CTX *ctx, const UNISTR2 *src)
-{
-       char *dest = NULL;
-       size_t dest_len;
-
-       if (!convert_string_talloc(ctx, CH_UTF16LE, CH_UNIX, src->buffer,
-                                  src->uni_str_len * 2, (void *)&dest,
-                                  &dest_len, true))
-       {
-               return NULL;
-       }
-
-       /* Ensure we're returning a null terminated string. */
-       if (dest_len) {
-               /* Did we already process the terminating zero ? */
-               if (dest[dest_len-1] != 0) {
-                       size_t size = talloc_get_size(dest);
-                       /* Have we got space to append the '\0' ? */
-                       if (size <= dest_len) {
-                               /* No, realloc. */
-                               dest = TALLOC_REALLOC_ARRAY(ctx, dest, char,
-                                               dest_len+1);
-                               if (!dest) {
-                                       /* talloc fail. */
-                                       dest_len = (size_t)-1;
-                                       return NULL;
-                               }
-                       }
-                       /* Yay - space ! */
-                       dest[dest_len] = '\0';
-                       dest_len++;
-               }
-       } else if (dest) {
-               dest[0] = 0;
-       }
-
-       return dest;
-}
-
 /* Converts a string from internal samba format to unicode
  */
 
@@ -371,64 +313,6 @@ int rpcstr_push_talloc(TALLOC_CTX *ctx, smb_ucs2_t **dest, 
const char *src)
 }
 
 /*******************************************************************
- Convert a (little-endian) UNISTR2 structure to an ASCII string.
-********************************************************************/
-
-void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen)
-{
-       if ((str == NULL) || (str->uni_str_len == 0)) {
-               *dest='\0';
-               return;
-       }
-       pull_ucs2(NULL, dest, str->buffer, maxlen, str->uni_str_len*2, 
STR_NOALIGN);
-}
-
-/*******************************************************************
- Duplicate a UNISTR2 string into a null terminated char*
- using a talloc context.
-********************************************************************/
-
-char *unistr2_to_ascii_talloc(TALLOC_CTX *ctx, const UNISTR2 *str)
-{
-       char *s = NULL;
-
-       if (!str || !str->buffer) {
-               return NULL;
-       }
-       if (pull_ucs2_base_talloc(ctx,
-                               NULL,
-                               &s,
-                               str->buffer,
-                               str->uni_str_len*2,
-                               STR_NOALIGN) == (size_t)-1) {
-               return NULL;
-       }
-       return s;
-}
-
-/*******************************************************************
- 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)
-{
-       char *dest = NULL;
-
-       if ((str == NULL) || (str->uni_str_len == 0)) {
-               return "";
-       }
-
-       dest = unistr2_to_ascii_talloc(talloc_tos(), str);
-       if (!dest) {
-               return "";
-       }
-
-       return dest;
-}
-
-/*******************************************************************
  Convert a wchar to upper case.
 ********************************************************************/
 
@@ -966,89 +850,6 @@ smb_ucs2_t *strstr_wa(const smb_ucs2_t *s, const char *ins)
        return NULL;
 }
 
-/*******************************************************************
- Returns the length in number of wide characters.
-******************************************************************/
-
-int unistrlen(uint16 *s)
-{
-       int len;
-
-       if (!s) {
-               return -1;
-       }
-
-       for (len=0; SVAL(s,0); s++,len++) {
-               ;
-       }
-
-       return len;
-}
-
-/*******************************************************************
- Strcpy for unicode strings. Returns length (in num of wide chars).
- Not odd align safe.
-********************************************************************/
-
-int unistrcpy(uint16 *dst, uint16 *src)
-{
-       int num_wchars = 0;
-
-       while (SVAL(src,0)) {
-               *dst++ = *src++;
-               num_wchars++;
-       }
-       *dst = 0;
-
-       return num_wchars;
-}
-
-/**
- * Samba ucs2 type to UNISTR2 conversion
- *
- * @param ctx Talloc context to create the dst strcture (if null) and the 
- *            contents of the unicode string.
- * @param dst UNISTR2 destination. If equals null, then it's allocated.
- * @param src smb_ucs2_t source.
- * @param max_len maximum number of unicode characters to copy. If equals
- *        null, then null-termination of src is taken
- *
- * @return copied UNISTR2 destination
- **/
-
-UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src)
-{
-       size_t len;
-
-       if (!src) {
-               return NULL;
-       }
-
-       len = strlen_w(src);
-       
-       /* allocate UNISTR2 destination if not given */
-       if (!dst) {
-               dst = TALLOC_P(ctx, UNISTR2);
-               if (!dst)
-                       return NULL;
-       }
-       if (!dst->buffer) {
-               dst->buffer = TALLOC_ARRAY(ctx, uint16, len + 1);
-               if (!dst->buffer)
-                       return NULL;
-       }
-       
-       /* set UNISTR2 parameters */
-       dst->uni_max_len = len + 1;
-       dst->offset = 0;
-       dst->uni_str_len = len;
-       
-       /* copy the actual unicode string */
-       strncpy_w(dst->buffer, src, dst->uni_max_len);
-       
-       return dst;
-}
-
 /*************************************************************
  ascii only toupper - saves the need for smbd to be in C locale.
 *************************************************************/
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index 94732b0..dfbd6da 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -1048,44 +1048,6 @@ bool prs_uint32s(bool charmode, const char *name, 
prs_struct *ps, int depth, uin
        return True;
 }
 
-/******************************************************************
- Stream a unicode string, length/buffer specified separately,
- in uint16 chars. The unicode string is already in little-endian format.
- ********************************************************************/
-
-bool prs_unistr2(bool charmode, const char *name, prs_struct *ps, int depth, 
UNISTR2 *str)
-{
-       char *p;
-       char *q = prs_mem_get(ps, str->uni_str_len * sizeof(uint16));
-       if (q == NULL)
-               return False;
-
-       /* If the string is empty, we don't have anything to stream */
-       if (str->uni_str_len==0)
-               return True;
-
-       if (UNMARSHALLING(ps)) {
-               if (str->uni_str_len > str->uni_max_len) {
-                       return False;
-               }
-               if (str->uni_max_len) {
-                       str->buffer = PRS_ALLOC_MEM(ps,uint16,str->uni_max_len);
-                       if (str->buffer == NULL)
-                               return False;
-               } else {
-                       str->buffer = NULL;
-               }
-       }
-
-       p = (char *)str->buffer;
-
-       dbg_rw_punival(charmode, name, depth, ps, q, p, str->uni_str_len);
-       
-       ps->data_offset += (str->uni_str_len * sizeof(uint16));
-
-       return True;
-}
-
 /*******************************************************************
  Stream a unicode  null-terminated string. As the string is already
  in little-endian format then do it as a stream of bytes.


-- 
Samba Shared Repository

Reply via email to