4 /*******************************************************************
5 Count the number of characters (not bytes) in a unicode string.
6 ********************************************************************/
7 size_t strlen_w(void *src
)
11 for (len
= 0; SVAL(src
, len
*2); len
++) ;
16 /****************************************************************************
17 expand a pointer to be a particular size
18 ****************************************************************************/
19 void *Realloc(void *p
,size_t size
)
25 DEBUG(5,("Realloc asked for 0 bytes\n"));
30 ret
= (void *)malloc(size
);
32 ret
= (void *)realloc(p
,size
);
35 DEBUG(0,("Memory allocation error: failed to expand to %d bytes\n",(int)size
));
41 char *tab_depth(int depth
)
43 static pstring spaces
;
44 memset(spaces
, ' ', depth
* 4);
45 spaces
[depth
* 4] = 0;
49 void print_asc(int level
, uchar
const *buf
, int len
)
52 for (i
= 0; i
< len
; i
++)
54 DEBUGADD(level
, ("%c", isprint(buf
[i
]) ? buf
[i
] : '.'));
58 void dump_data(int level
, char *buf1
, int len
)
60 uchar
const *buf
= (uchar
const *)buf1
;
64 DEBUG(level
, ("dump_data: NULL, len=%d\n", len
));
75 DEBUG(level
, ("[%03X] ", i
));
78 DEBUGADD(level
, ("%02X ", (int)buf
[i
]));
81 DEBUGADD(level
, (" "));
84 print_asc(level
, &buf
[i
- 16], 8);
85 DEBUGADD(level
, (" "));
86 print_asc(level
, &buf
[i
- 8], 8);
87 DEBUGADD(level
, ("\n"));
89 DEBUGADD(level
, ("[%03X] ", i
));
93 if (i
% 16 != 0) /* finish off a non-16-char-length row */
98 DEBUGADD(level
, (" "));
100 DEBUGADD(level
, (" "));
102 DEBUGADD(level
, (" "));
105 print_asc(level
, &buf
[i
- (i
% 16)], n
);
106 DEBUGADD(level
, (" "));
109 print_asc(level
, &buf
[i
- n
], n
);
110 DEBUGADD(level
, ("\n"));