Re: Cannot add reference.

"Markus Hoenicka" <[email protected]> Sat, 9 May 2009 01:43:52 +0200
Newsgroups gmane.text.refdb.general
Message-ID <[email protected]>
Wei-Wei Guo writes:
 > Thanks. I'd better wait since PG or MySql is kind of heavy for me. Hope the
 > driver problem could be solved soon :>
 > 

It turned out that this was not a driver problem, but a bug in the
libdbi library itself. I've checked in a fix today. I assume you won't
be able to wait until the next libdbi release, which may take some
time to be picked up by package maintainers. If you feel comfortable
with installing libdbi from the sources, please use the appended patch
for src/dbi_main.c.

regards,
Markus

--- dbi_main.c	2008/11/28 22:28:51	1.95
+++ dbi_main.c	2009/05/08 23:22:33	1.96
@@ -1570,8 +1574,19 @@
 	/* hahaha! who woulda ever thunk strawberry's code would come in handy? */
 	// find first (highest) bit set; methods not using FP can be found at 
 	// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
-	unsigned startbit = log(rangemin)/log(2);
-	unsigned endbit = log(rangemax)/log(2);
+/* 	unsigned startbit = log(rangemin)/log(2); */
+/* 	unsigned endbit = log(rangemax)/log(2); */
+  unsigned int startbit = 0;
+  unsigned int endbit = 0;
+
+  while (rangemin >>= 1) {
+    startbit++;
+  }
+
+  while (rangemax >>= 1) {
+    endbit++;
+  }
+
 	// construct mask from startbit to endbit inclusive
 	unsigned attrib_mask = ((1<<(endbit+1))-1) ^ ((1<<startbit)-1);
 	return attribs & attrib_mask;

-- 
Markus Hoenicka
[email protected]
(Spam-protected email: replace the quadrupeds with "mhoenicka")
http://www.mhoenicka.de

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com