summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/iSilo.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/iSilo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/iSilo.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/iSilo.cpp b/noncore/apps/opie-reader/iSilo.cpp
index 5f14b96..1f727fe 100644
--- a/noncore/apps/opie-reader/iSilo.cpp
+++ b/noncore/apps/opie-reader/iSilo.cpp
@@ -285,24 +285,25 @@ bool iSilo::reset_trees()
285} 285}
286u_int32_t iSilo::get_bits(int num) { 286u_int32_t iSilo::get_bits(int num) {
287 int i, r; 287 int i, r;
288 u_int32_t result = 0; 288 u_int32_t result = 0;
289 289
290 if (num == 0) { 290 if (num == 0) {
291 pos = 0; 291 pos = 0;
292 return(0); 292 return(0);
293 } 293 }
294 294
295 for (i = 0; i < num; i++) { 295 for (i = 0; i < num; i++) {
296 if (pos == 0) { 296 if (pos == 0) {
297 unsuspend();
297 r = fread(buf, sizeof(u_int32_t), 256, fin); 298 r = fread(buf, sizeof(u_int32_t), 256, fin);
298 if (r <= 0) { 299 if (r <= 0) {
299 qDebug("ERROR: Unexpected end of file"); 300 qDebug("ERROR: Unexpected end of file");
300 exit(-1); /* FIXME */ 301 exit(-1); /* FIXME */
301 } 302 }
302 pos = 32*256; 303 pos = 32*256;
303 } 304 }
304 305
305 pos--; 306 pos--;
306 result <<= 1; 307 result <<= 1;
307 result |= (ntohl(buf[255 - (pos/32)]) >> (31-(pos % 32))) & 1; 308 result |= (ntohl(buf[255 - (pos/32)]) >> (31-(pos % 32))) & 1;
308 } 309 }