tdb_unpack: Eliminate "cast to pointer from integer of different size" warning on...
authorMichael Adam <obnox@samba.org>
Fri, 27 Jun 2008 06:23:26 +0000 (08:23 +0200)
committerMichael Adam <obnox@samba.org>
Fri, 27 Jun 2008 10:46:11 +0000 (12:46 +0200)
The 'p' type is just a flag to mark the presence of a pointer,
not a real pointer itself.

The code is now the same as in Samba3's tdb_unpack.

Michael

source/lib/util/util_tdb.c

index 77ad4eb6178cf7f9cf4cce032732c104444e1ef8..e4219dfd69f75c1868a907d40f31a102f0d12bc8 100644 (file)
@@ -482,7 +482,13 @@ int tdb_unpack(TDB_CONTEXT *tdb, char *buf, int bufsize, const char *fmt, ...)
                        p = va_arg(ap, void **);
                        if (bufsize < len)
                                goto no_space;
-                       *p = (void *)IVAL(buf, 0);
+
+                       /*
+                        * This isn't a real pointer - only a token (1 or 0)
+                        * to mark the fact a pointer is present.
+                        */
+
+                       *p = (void *)(IVAL(buf, 0) ? (void *)1 : NULL);
                        break;
                case 'P':
                        /* Return a malloc'ed string. */