git » nmdb » commit a791397

Fix D bindings' sizeof vs length bug.

author Alberto Bertogli
2007-09-01 23:40:29 UTC
committer Alberto Bertogli
2007-09-01 23:40:29 UTC
parent ffc6369cfe465852a61daecc848de80301ee452c

Fix D bindings' sizeof vs length bug.

For arrays, sizeof returns the size of the reference (which is
2 * word size, usually). We want the proper length.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

bindings/d/nmdb.d +2 -2

diff --git a/bindings/d/nmdb.d b/bindings/d/nmdb.d
index e38b130..e6d51eb 100644
--- a/bindings/d/nmdb.d
+++ b/bindings/d/nmdb.d
@@ -83,10 +83,10 @@ class DB
 
 		if (mode == MODE_NORMAL || mode == MODE_SYNC) {
 			size = nmdb_get(db, k, key.length,
-					cast(ubyte *) v, v.sizeof);
+					cast(ubyte *) v, v.length);
 		} else if (mode == MODE_CACHE) {
 			size = nmdb_cache_get(db, k, key.length,
-					cast(ubyte *) v, v.sizeof);
+					cast(ubyte *) v, v.length);
 		} else {
 			throw new Exception("Invalid mode");
 		}