summaryrefslogtreecommitdiff
authorerik <erik>2007-01-24 23:31:45 (UTC)
committer erik <erik>2007-01-24 23:31:45 (UTC)
commit644780047090442429342addb3fa97ec95bdc670 (patch) (unidiff)
tree64032e4e81653501977b95bebdc8ebd69288d6c6
parent0076a11b467dce1233194ce228287a2a127b1f5d (diff)
downloadopie-644780047090442429342addb3fa97ec95bdc670.zip
opie-644780047090442429342addb3fa97ec95bdc670.tar.gz
opie-644780047090442429342addb3fa97ec95bdc670.tar.bz2
There was quite a bit of deadwood in this file. I am removing it to make
the file more readable (and smaller overall).
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/Reb.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/noncore/apps/opie-reader/Reb.cpp b/noncore/apps/opie-reader/Reb.cpp
index 2e6c1fc..65de9f6 100644
--- a/noncore/apps/opie-reader/Reb.cpp
+++ b/noncore/apps/opie-reader/Reb.cpp
@@ -6,52 +6,6 @@
6#include "my_list.h" 6#include "my_list.h"
7#include "Bkmks.h" 7#include "Bkmks.h"
8#include "Model.h" 8#include "Model.h"
9/*
10#ifdef offsetof
11#define OffsetOf(type, field) ((int) offsetof(type, field))
12#else
13#define OffsetOf(type, field) ((int) ((char *) &((type *) 0)->field))
14#endif
15
16template<class T>
17UInt32 binarychop(T* data, UInt32 n, T val)
18{
19 UInt32 jl = 0,jh = n-1,jm = (jl+jh)/2;
20 while (jh > jl+1)
21 {
22 if (data[jm] > val)
23 {
24 jh = jm;
25 }
26 else
27 {
28 jl = jm;
29 }
30 jm = (jl+jh)/2;
31 }
32 return jl;
33}
34
35template<class T, class D>
36UInt32 binarychop(D* data, UInt32 n, T val, UInt32 offset)
37{
38 UInt32 jl = 0,jh = n-1,jm = (jl+jh)/2;
39 while (jh > jl+1)
40 {
41 T* d = reinterpret_cast<T*>(reinterpret_cast<char*>(data+jm)+offset);
42 if (*d > val)
43 {
44 jh = jm;
45 }
46 else
47 {
48 jl = jm;
49 }
50 jm = (jl+jh)/2;
51 }
52 return jl;
53}
54*/
55 9
56CReb::CReb() 10CReb::CReb()
57: 11:
@@ -77,20 +31,6 @@ unsigned int CReb::locate()
77 31
78void CReb::locate(unsigned int n) 32void CReb::locate(unsigned int n)
79{ 33{
80 /*
81 UInt32 cp = nopages-1;
82 for (int i = 0; i < nopages; ++i)
83 {
84 if (m_pagedetails[i].pagestart > n)
85 {
86 cp = i-1;
87 break;
88 }
89 }
90 qDebug("Requesting %u from page %u [%u]", n, cp, n - m_pagedetails[cp].pagestart);
91 */
92 //UInt32 jl = binarychop<UInt32, Page_detail>(m_pagedetails, nopages, n, OffsetOf(Page_detail, pagestart));
93
94 UInt32 jl = 0,jh = nopages-1,jm = (jl+jh)/2; 34 UInt32 jl = 0,jh = nopages-1,jm = (jl+jh)/2;
95 while (jh > jl+1) 35 while (jh > jl+1)
96 { 36 {
@@ -112,8 +52,6 @@ void CReb::locate(unsigned int n)
112 currentpage.setoffset(page2pos(jl), jl, ((rs.flags & 8) != 0), rs.len, val); 52 currentpage.setoffset(page2pos(jl), jl, ((rs.flags & 8) != 0), rs.len, val);
113 if (noparas > 0) 53 if (noparas > 0)
114 { 54 {
115 //jl = binarychop<int, ParaRef>(paras, noparas, val, OffsetOf(ParaRef, pos));
116
117 UInt32 jl = 0,jh = noparas-1,jm = (jl+jh)/2; 55 UInt32 jl = 0,jh = noparas-1,jm = (jl+jh)/2;
118 while (jh > jl+1) 56 while (jh > jl+1)
119 { 57 {
@@ -758,8 +696,6 @@ void CReb::start2endSection()
758 { 696 {
759 if (nojoins > 0) 697 if (nojoins > 0)
760 { 698 {
761 //UInt32 jl = binarychop<UInt32>(joins, nojoins, currentpage.offset());
762
763 UInt32 jl = 0,jh = nojoins-1,jm = (jl+jh)/2; 699 UInt32 jl = 0,jh = nojoins-1,jm = (jl+jh)/2;
764 while (jh > jl+1) 700 while (jh > jl+1)
765 { 701 {
@@ -776,7 +712,6 @@ void CReb::start2endSection()
776 712
777 currentpage.m_startoff = joins[jl]; 713 currentpage.m_startoff = joins[jl];
778 currentpage.m_endoff = joins[jl+1]-1; 714 currentpage.m_endoff = joins[jl+1]-1;
779 //currentpage.m_endoff = joins[jh]-1;
780 } 715 }
781 m_currentstart = m_pagedetails[currentpage.pageno()].pagestart+currentpage.m_startoff; 716 m_currentstart = m_pagedetails[currentpage.pageno()].pagestart+currentpage.m_startoff;
782 m_currentend = m_pagedetails[currentpage.pageno()].pagestart+currentpage.m_endoff; 717 m_currentend = m_pagedetails[currentpage.pageno()].pagestart+currentpage.m_endoff;