diff options
author | Günther Deschner <gd@samba.org> | 2010-07-07 12:39:46 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-07-07 15:29:25 +0200 |
commit | 7e1fa8d06774de4fa103118006309b2d1d63069b (patch) | |
tree | af8028dd292215392b9b322ebf007d42568faabe /source3/rpc_parse | |
parent | 8def236f187dbbb804a142124bc5042d0cc89854 (diff) | |
download | samba-7e1fa8d06774de4fa103118006309b2d1d63069b.tar.gz samba-7e1fa8d06774de4fa103118006309b2d1d63069b.tar.bz2 samba-7e1fa8d06774de4fa103118006309b2d1d63069b.zip |
s3-rpc_parse: remove finally unused prs_unistr().
Guenther
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 124 |
1 files changed, 0 insertions, 124 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index c460f1fbca..ec5bc9cf6a 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -886,130 +886,6 @@ bool prs_uint32s(bool charmode, const char *name, prs_struct *ps, int depth, uin } /******************************************************************* - Stream a unicode null-terminated string. As the string is already - in little-endian format then do it as a stream of bytes. - ********************************************************************/ - -bool prs_unistr(const char *name, prs_struct *ps, int depth, UNISTR *str) -{ - unsigned int len = 0; - unsigned char *p = (unsigned char *)str->buffer; - uint8 *start; - char *q; - uint32 max_len; - uint16* ptr; - - if (MARSHALLING(ps)) { - - for(len = 0; str->buffer[len] != 0; len++) - ; - - q = prs_mem_get(ps, (len+1)*2); - if (q == NULL) - return False; - - start = (uint8*)q; - - for(len = 0; str->buffer[len] != 0; len++) { - if(ps->bigendian_data) { - /* swap bytes - p is little endian, q is big endian. */ - q[0] = (char)p[1]; - q[1] = (char)p[0]; - p += 2; - q += 2; - } - else - { - q[0] = (char)p[0]; - q[1] = (char)p[1]; - p += 2; - q += 2; - } - } - - /* - * even if the string is 'empty' (only an \0 char) - * at this point the leading \0 hasn't been parsed. - * so parse it now - */ - - q[0] = 0; - q[1] = 0; - q += 2; - - len++; - - DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); - print_asc(5, (unsigned char*)start, 2*len); - DEBUGADD(5, ("\n")); - } - else { /* unmarshalling */ - - uint32 alloc_len = 0; - q = ps->data_p + prs_offset(ps); - - /* - * Work out how much space we need and talloc it. - */ - max_len = (ps->buffer_size - ps->data_offset)/sizeof(uint16); - - /* the test of the value of *ptr helps to catch the circumstance - where we have an emtpty (non-existent) string in the buffer */ - for ( ptr = (uint16 *)q; *ptr++ && (alloc_len <= max_len); alloc_len++) - /* do nothing */ - ; - - if (alloc_len < max_len) - alloc_len += 1; - - /* should we allocate anything at all? */ - str->buffer = PRS_ALLOC_MEM(ps,uint16,alloc_len); - if ((str->buffer == NULL) && (alloc_len > 0)) - return False; - - p = (unsigned char *)str->buffer; - - len = 0; - /* the (len < alloc_len) test is to prevent us from overwriting - memory that is not ours...if we get that far, we have a non-null - terminated string in the buffer and have messed up somewhere */ - while ((len < alloc_len) && (*(uint16 *)q != 0)) { - if(ps->bigendian_data) - { - /* swap bytes - q is big endian, p is little endian. */ - p[0] = (unsigned char)q[1]; - p[1] = (unsigned char)q[0]; - p += 2; - q += 2; - } else { - - p[0] = (unsigned char)q[0]; - p[1] = (unsigned char)q[1]; - p += 2; - q += 2; - } - - len++; - } - if (len < alloc_len) { - /* NULL terminate the UNISTR */ - str->buffer[len++] = '\0'; - } - - DEBUGADD(5,("%s%04x %s: ", tab_depth(5,depth), ps->data_offset, name)); - print_asc(5, (unsigned char*)str->buffer, 2*len); - DEBUGADD(5, ("\n")); - } - - /* set the offset in the prs_struct; 'len' points to the - terminiating NULL in the UNISTR so we need to go one more - uint16 */ - ps->data_offset += (len)*2; - - return True; -} - -/******************************************************************* creates a new prs_struct containing a DATA_BLOB ********************************************************************/ bool prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) |