author | pohly <pohly> | 2005-05-08 16:12:13 (UTC) |
---|---|---|
committer | pohly <pohly> | 2005-05-08 16:12:13 (UTC) |
commit | 2ccb0ad8b77eb3c62914f5df5b1bba3becb83617 (patch) (side-by-side diff) | |
tree | a75b6a2da7ab019dac3c078830d24bc491692d3d | |
parent | 21a9e96cebeb6e729d129cd75544ac54ae4d09f4 (diff) | |
download | opie-2ccb0ad8b77eb3c62914f5df5b1bba3becb83617.zip opie-2ccb0ad8b77eb3c62914f5df5b1bba3becb83617.tar.gz opie-2ccb0ad8b77eb3c62914f5df5b1bba3becb83617.tar.bz2 |
bugfix by tim: off-by-one error when returning to a document (previous page)
-rw-r--r-- | noncore/apps/opie-reader/plucker_base.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp index 51c7fa7..81614f5 100644 --- a/noncore/apps/opie-reader/plucker_base.cpp +++ b/noncore/apps/opie-reader/plucker_base.cpp @@ -267,66 +267,67 @@ void CPlucker_base::locate(unsigned int n) } } else { UInt16 thishdr_uid, thishdr_nParagraphs; UInt32 thishdr_size = buffercontent; UInt8 thishdr_type, thishdr_reserved; while (n > textlength + thishdr_size && recptr < ntohs(head.recordList.numRecords)-1) { textlength += thishdr_size; recptr++; gotorecordnumber(recptr); GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); if (!(thishdr_type < 2)) { thishdr_size = 0; } } } */ UInt16 thisrec = 0; unsigned long locpos = 0; unsigned long bs = 0; + unsigned int np1 = n+1; UInt16 thishdr_uid, thishdr_nParagraphs; UInt32 thishdr_size; UInt8 thishdr_type, thishdr_reserved; do { thisrec++; locpos += bs; gotorecordnumber(thisrec); GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); if (thishdr_type < 2) { bs = thishdr_size; } else { bs = 0; } - } while (locpos + bs < n); + } while (locpos + bs < np1); // qDebug("Time(2): %u", clock()-start); /* if (recptr != thisrec) { qDebug("Disaster:recptr:%u thisrec:%u", recptr, thisrec); UInt16 thishdr_uid, thishdr_nParagraphs; UInt32 thishdr_size = buffercontent; UInt8 thishdr_type, thishdr_reserved; for (recptr = 1; recptr < ntohs(head.recordList.numRecords); recptr++) { gotorecordnumber(recptr); GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); // qDebug("UID:%u Paras:%u Size:%u Type:%u Reserved:%u", thishdr_uid, thishdr_nParagraphs, thishdr_size, (unsigned int)thishdr_type, (unsigned int)thishdr_reserved); } // QApplication::exit ( 100 ); } */ currentpos = locpos; expand(thisrec); while (currentpos < n && bufferpos < buffercontent) getch_base(true); /* // This is faster but the alignment attribute doesn't get set 8^( bufferpos = n-locpos; |