summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-01-15 15:33:20 +0100
committerGünther Deschner <gd@samba.org>2009-01-16 00:28:45 +0100
commit64d8eb0cee161417c3c97f1dc8d5b67171084152 (patch)
treee79c6648f911c7c61c55548ebcf2e59b719e682d
parent0d2c0da7d2ca836efb6fa5b99181103768b3f141 (diff)
downloadsamba-64d8eb0cee161417c3c97f1dc8d5b67171084152.tar.gz
samba-64d8eb0cee161417c3c97f1dc8d5b67171084152.tar.bz2
samba-64d8eb0cee161417c3c97f1dc8d5b67171084152.zip
s3-util: for convenience, provide format comments in tdb_unpack().
Guenther
-rw-r--r--source3/lib/util_tdb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index 8ceaa46670..03f72dfcee 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -275,28 +275,28 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
while (*fmt) {
switch ((c=*fmt++)) {
- case 'b':
+ case 'b': /* unsigned 8-bit integer */
len = 1;
bt = va_arg(ap, uint8 *);
if (bufsize < len)
goto no_space;
*bt = SVAL(buf, 0);
break;
- case 'w':
+ case 'w': /* unsigned 16-bit integer */
len = 2;
w = va_arg(ap, uint16 *);
if (bufsize < len)
goto no_space;
*w = SVAL(buf, 0);
break;
- case 'd':
+ case 'd': /* signed 32-bit integer (standard int in most systems) */
len = 4;
d = va_arg(ap, uint32 *);
if (bufsize < len)
goto no_space;
*d = IVAL(buf, 0);
break;
- case 'p':
+ case 'p': /* pointer */
len = 4;
p = va_arg(ap, void **);
if (bufsize < len)
@@ -308,20 +308,20 @@ int tdb_unpack(const uint8 *buf, int bufsize, const char *fmt, ...)
*p = (void *)(IVAL(buf, 0) ? (void *)1 : NULL);
break;
- case 'P':
+ case 'P': /* null-terminated string */
/* Return malloc'ed string. */
ps = va_arg(ap,char **);
len = strlen((const char *)buf) + 1;
*ps = SMB_STRDUP((const char *)buf);
break;
- case 'f':
+ case 'f': /* null-terminated string */
s = va_arg(ap,char *);
len = strlen((const char *)buf) + 1;
if (bufsize < len || len > sizeof(fstring))
goto no_space;
memcpy(s, buf, len);
break;
- case 'B':
+ case 'B': /* fixed-length string */
i = va_arg(ap, int *);
b = va_arg(ap, char **);
len = 4;