diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/crc32.c | 2 | ||||
-rw-r--r-- | source3/lib/genrand.c | 4 | ||||
-rw-r--r-- | source3/lib/hmacmd5.c | 2 | ||||
-rw-r--r-- | source3/lib/membuffer.c | 8 | ||||
-rw-r--r-- | source3/lib/util_sid.c | 20 | ||||
-rw-r--r-- | source3/lib/util_str.c | 2 | ||||
-rw-r--r-- | source3/lib/util_unistr.c | 16 |
7 files changed, 37 insertions, 17 deletions
diff --git a/source3/lib/crc32.c b/source3/lib/crc32.c index 9da5b4bfe1..39c01fa30f 100644 --- a/source3/lib/crc32.c +++ b/source3/lib/crc32.c @@ -59,7 +59,7 @@ static unsigned long CRCTable[256] = uint32 crc32_calc_buffer( uint32 count, char *buffer) { uint32 crc=0xffffffff; - int i; + uint32 i; for(i=0;i<count;i++) { crc = (crc>>8) ^ CRCTable[(buffer[i] ^ crc) & 0xff]; diff --git a/source3/lib/genrand.c b/source3/lib/genrand.c index a2fd1e0860..ab0dadebcf 100644 --- a/source3/lib/genrand.c +++ b/source3/lib/genrand.c @@ -58,8 +58,8 @@ static void do_dirrand(char *name, unsigned char *buf, int buf_len) { DIR *dp = opendir(name); pstring fullname; - int len_left; - int fullname_len; + size_t len_left; + size_t fullname_len; char *pos; pstrcpy(fullname, name); diff --git a/source3/lib/hmacmd5.c b/source3/lib/hmacmd5.c index d3c0d42d97..d017bba77d 100644 --- a/source3/lib/hmacmd5.c +++ b/source3/lib/hmacmd5.c @@ -106,7 +106,7 @@ void hmac_md5_update(const uchar* text, int text_len, HMACMD5Context *ctx) /*********************************************************************** finish off hmac_md5 "inner" buffer and generate outer one. ***********************************************************************/ -void hmac_md5_final(caddr_t digest, HMACMD5Context *ctx) +void hmac_md5_final(uchar *digest, HMACMD5Context *ctx) { struct MD5Context ctx_o; diff --git a/source3/lib/membuffer.c b/source3/lib/membuffer.c index 92bc2be439..170433074f 100644 --- a/source3/lib/membuffer.c +++ b/source3/lib/membuffer.c @@ -107,7 +107,7 @@ BOOL mem_alloc_data(struct mem_buf *buf, int size) buf->data_size = size + buf->margin; buf->data_used = size; - buf->data = malloc(buf->data_size); + buf->data = (char*)malloc(buf->data_size); if (buf->data == NULL && size != 0) { @@ -176,7 +176,7 @@ BOOL mem_buf_init(struct mem_buf **buf, uint32 margin) if ((*buf) == NULL) { - (*buf) = malloc(sizeof(**buf)); + (*buf) = (struct mem_buf*)malloc(sizeof(**buf)); if ((*buf) != NULL) { mem_init((*buf), margin); @@ -236,7 +236,7 @@ void mem_free_data(struct mem_buf *buf) /******************************************************************* reallocate a memory buffer, including a safety margin ********************************************************************/ -BOOL mem_realloc_data(struct mem_buf *buf, int new_size) +BOOL mem_realloc_data(struct mem_buf *buf, size_t new_size) { char *new_data; @@ -252,7 +252,7 @@ BOOL mem_realloc_data(struct mem_buf *buf, int new_size) return True; } - new_data = Realloc(buf->data, new_size + buf->margin); + new_data = (char*)Realloc(buf->data, new_size + buf->margin); if (new_data != NULL) { diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index dce398f36f..3be81ce811 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -225,3 +225,23 @@ int sid_size(const DOM_SID *sid) } return sid->num_auths * sizeof(uint32) + 8; } + + +/***************************************************************** + Duplicates a sid - mallocs the target. +*****************************************************************/ + +DOM_SID *sid_dup(DOM_SID *src) +{ + DOM_SID *dst; + + if(!src) + return NULL; + + if((dst = (DOM_SID*)malloc(sizeof(DOM_SID))) != NULL) { + memset(dst, '\0', sizeof(DOM_SID)); + sid_copy( dst, src); + } + + return dst; +} diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 636be164ac..43e3224df4 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -842,7 +842,7 @@ char *StrnCpy(char *dest,const char *src,size_t n) like strncpy but copies up to the character marker. always null terminates. returns a pointer to the character marker in the source string (src). ****************************************************************************/ -char *strncpyn(char *dest, const char *src,size_t n, char c) +char *strncpyn(char *dest, char *src,size_t n, char c) { char *p; size_t str_len; diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index e047697a0f..1dff5964fd 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -51,7 +51,8 @@ char *ascii_to_unibuf(char *dest, const char *src, int maxlen) /******************************************************************* Pull an ASCII string out of a UNICODE buffer (little endian). ********************************************************************/ -const char *unibuf_to_ascii(char *dest, const char *src, int maxlen) + +const char* unibuf_to_ascii(char *dest, const char *src, int maxlen) { char *destend = dest + maxlen; register char c; @@ -126,11 +127,11 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len) Convert a UNISTR2 structure to an ASCII string ********************************************************************/ -void unistr2_to_ascii(char *dest, const UNISTR2 *str, int maxlen) +void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen) { char *destend; const uint16 *src; - int len; + size_t len; register uint16 c; src = str->buffer; @@ -204,7 +205,7 @@ uint32 buffer2_to_uint32(const BUFFER2 *str) { if (str->buf_len == 4) { - const char *src = str->buffer; + const uchar *src = str->buffer; return IVAL(src, 0); } else @@ -217,12 +218,11 @@ uint32 buffer2_to_uint32(const BUFFER2 *str) /******************************************************************* Convert a 'multi-string' buffer to space-separated ASCII. ********************************************************************/ - -void buffer2_to_multistr(char *dest, const BUFFER2 *str, int maxlen) +void buffer2_to_multistr(char *dest, const BUFFER2 *str, size_t maxlen) { char *destend; - const char *src; - int len; + const uchar *src; + size_t len; register uint16 c; src = str->buffer; |