summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-reader/CFilter.cpp2
-rw-r--r--noncore/apps/opie-reader/CRegExp.cpp4
-rw-r--r--noncore/apps/opie-reader/Palm2QImage.cpp4
-rw-r--r--noncore/apps/opie-reader/QTReader.cpp2
-rw-r--r--noncore/apps/opie-reader/plucker_base.cpp2
-rw-r--r--noncore/apps/opie-reader/striphtml.cpp2
6 files changed, 8 insertions, 8 deletions
diff --git a/noncore/apps/opie-reader/CFilter.cpp b/noncore/apps/opie-reader/CFilter.cpp
index 25cdfae..a4ea60a 100644
--- a/noncore/apps/opie-reader/CFilter.cpp
+++ b/noncore/apps/opie-reader/CFilter.cpp
@@ -456,97 +456,97 @@ void repalm::getch(tchar& ch, CStyle& sty, unsigned long& pos)
456 case 0x9f: 456 case 0x9f:
457 ch = 0x0178; 457 ch = 0x0178;
458 break; 458 break;
459 case 0x18: 459 case 0x18:
460 ch = 0x2026; 460 ch = 0x2026;
461 break; 461 break;
462 case 0x19: 462 case 0x19:
463 ch = 0x2007; 463 ch = 0x2007;
464 break; 464 break;
465 case 0x8d: 465 case 0x8d:
466 ch = 0x2662; 466 ch = 0x2662;
467 break; 467 break;
468 case 0x8e: 468 case 0x8e:
469 ch = 0x2663; 469 ch = 0x2663;
470 break; 470 break;
471 case 0x8f: 471 case 0x8f:
472 ch = 0x2661; 472 ch = 0x2661;
473 break; 473 break;
474 case 0x90: 474 case 0x90:
475 ch = 0x2660; 475 ch = 0x2660;
476 break; 476 break;
477 default: 477 default:
478 break; 478 break;
479 } 479 }
480} 480}
481 481
482//static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 }; 482//static tchar nextpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','n','e','x','t',' ','p','a','r','t',0 };
483//static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 }; 483//static tchar prevpart[] = { 'C','l','i','c','k',' ','h','e','r','e',' ','f','o','r',' ','t','h','e',' ','p','r','e','v','i','o','u','s',' ','p','a','r','t',0 };
484 484
485void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos) 485void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos)
486{ 486{
487 if (m_buffed > 0) 487 if (m_buffed > 0)
488 { 488 {
489 sty = m_laststyle; 489 sty = m_laststyle;
490 ch = nextpart[m_current++]; 490 ch = nextpart[m_current++];
491 if (m_current == m_buffed) 491 if (m_current == m_buffed)
492 { 492 {
493 m_current = m_buffed = 0; 493 m_current = m_buffed = 0;
494 } 494 }
495 } 495 }
496 else 496 else
497 { 497 {
498 if (m_buffer != 0) 498 if (m_buffer != 0)
499 { 499 {
500 ch = m_buffer; 500 ch = m_buffer;
501 m_buffer = 0; 501 m_buffer = 0;
502 return; 502 return;
503 } 503 }
504 unsigned long lnk, lnkoff; 504 unsigned long lnk = 0, lnkoff = 0;
505 do 505 do
506 { 506 {
507 if (nextpart[m_buffed] == 0) break; 507 if (nextpart[m_buffed] == 0) break;
508 parent->getch(ch, sty, pos); 508 parent->getch(ch, sty, pos);
509 m_laststyle = sty; 509 m_laststyle = sty;
510 if (sty.getLink()) 510 if (sty.getLink())
511 { 511 {
512 lnk = sty.getData(); 512 lnk = sty.getData();
513 lnkoff = sty.getOffset(); 513 lnkoff = sty.getOffset();
514 } 514 }
515 } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed); 515 } while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed);
516 m_current = 0; 516 m_current = 0;
517 if (nextpart[m_buffed] == 0) 517 if (nextpart[m_buffed] == 0)
518 { 518 {
519 m_buffed = 0; 519 m_buffed = 0;
520 QString dmy, dmy2; 520 QString dmy, dmy2;
521 parent->hyperlink(lnk, lnkoff, dmy, dmy2); 521 parent->hyperlink(lnk, lnkoff, dmy, dmy2);
522 do 522 do
523 { 523 {
524 parent->getch(ch, sty, pos); 524 parent->getch(ch, sty, pos);
525 } 525 }
526 while (ch != 10); 526 while (ch != 10);
527 parent->getch(ch, sty, pos); 527 parent->getch(ch, sty, pos);
528 } 528 }
529 else if (m_buffed > 0) 529 else if (m_buffed > 0)
530 { 530 {
531 m_buffer = ch; 531 m_buffer = ch;
532 ch = nextpart[0]; 532 ch = nextpart[0];
533 if (m_buffed == 1) 533 if (m_buffed == 1)
534 { 534 {
535 m_buffed = 0; 535 m_buffed = 0;
536 } 536 }
537 else m_current = 1; 537 else m_current = 1;
538 } 538 }
539 } 539 }
540 540
541 return; 541 return;
542} 542}
543 543
544HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255) 544HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255)
545{ 545{
546} 546}
547 547
548#include "Bkmks.h" 548#include "Bkmks.h"
549#include "QTReader.h" 549#include "QTReader.h"
550 550
551void HighlightFilter::refresh(unsigned long pos) 551void HighlightFilter::refresh(unsigned long pos)
552{ 552{
diff --git a/noncore/apps/opie-reader/CRegExp.cpp b/noncore/apps/opie-reader/CRegExp.cpp
index 6318d28..e3194df 100644
--- a/noncore/apps/opie-reader/CRegExp.cpp
+++ b/noncore/apps/opie-reader/CRegExp.cpp
@@ -64,97 +64,97 @@ void CRegExpFilt::prepreprocessing(const QString& pat, bool insens)
64#ifdef _WINDOWS 64#ifdef _WINDOWS
65 switch (pat.at(p).unicode()) 65 switch (pat.at(p).unicode())
66#else 66#else
67 switch (pat[p].unicode()) 67 switch (pat[p].unicode())
68#endif 68#endif
69 { 69 {
70 case '{': 70 case '{':
71 { 71 {
72 break; 72 break;
73 } 73 }
74 case '}': 74 case '}':
75 { 75 {
76 break; 76 break;
77 } 77 }
78 case '^': 78 case '^':
79 { 79 {
80 break; 80 break;
81 } 81 }
82 case '.' : 82 case '.' :
83 { 83 {
84 break; 84 break;
85 } 85 }
86 case '#': 86 case '#':
87 { 87 {
88 p++; 88 p++;
89#ifdef _WINDOWS 89#ifdef _WINDOWS
90 while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9') 90 while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9')
91#else 91#else
92 while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9') 92 while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9')
93#endif 93#endif
94 { 94 {
95 } 95 }
96 p--; 96 p--;
97 break; 97 break;
98 } 98 }
99 case '\\' : 99 case '\\' :
100 { 100 {
101#ifdef _WINDOWS 101#ifdef _WINDOWS
102 tchar c = escapedchar(pat.at(++p).unicode()); 102 tchar c = escapedchar(pat.at(++p).unicode());
103#else 103#else
104 tchar c = escapedchar(pat[++p].unicode()); 104 tchar c = escapedchar(pat[++p].unicode());
105#endif 105#endif
106 regchar(c, insens); 106 regchar(c, insens);
107 break; 107 break;
108 } 108 }
109 109
110 case '[' : 110 case '[' :
111 { 111 {
112 tchar clast; 112 tchar clast = 0;
113 bool invert = false; 113 bool invert = false;
114 tchar c; 114 tchar c;
115#ifdef _WINDOWS 115#ifdef _WINDOWS
116 if (pat.at(p+1).unicode() == '^') 116 if (pat.at(p+1).unicode() == '^')
117#else 117#else
118 if (pat[p+1].unicode() == '^') 118 if (pat[p+1].unicode() == '^')
119#endif 119#endif
120 { 120 {
121 p++; 121 p++;
122 invert = true; 122 invert = true;
123 } 123 }
124#ifdef _WINDOWS 124#ifdef _WINDOWS
125 while ((c = pat.at(++p).unicode()) != ']') 125 while ((c = pat.at(++p).unicode()) != ']')
126#else 126#else
127 while ((c = pat[++p].unicode()) != ']') 127 while ((c = pat[++p].unicode()) != ']')
128#endif 128#endif
129 { 129 {
130 if (c == '\\') 130 if (c == '\\')
131 { 131 {
132#ifdef _WINDOWS 132#ifdef _WINDOWS
133 c = escapedchar(pat.at(++p).unicode()); 133 c = escapedchar(pat.at(++p).unicode());
134#else 134#else
135 c = escapedchar(pat[++p].unicode()); 135 c = escapedchar(pat[++p].unicode());
136#endif 136#endif
137 if (c == ']') break; 137 if (c == ']') break;
138 } 138 }
139 if (c == '-') 139 if (c == '-')
140 { 140 {
141#ifdef _WINDOWS 141#ifdef _WINDOWS
142 c = pat.at(++p).unicode(); 142 c = pat.at(++p).unicode();
143#else 143#else
144 c = pat[++p].unicode(); 144 c = pat[++p].unicode();
145#endif 145#endif
146 for (tchar j = clast; j <= c; j++) 146 for (tchar j = clast; j <= c; j++)
147 { 147 {
148 regchar(j, insens); 148 regchar(j, insens);
149 } 149 }
150 } 150 }
151 else 151 else
152 { 152 {
153 regchar(c, insens); 153 regchar(c, insens);
154 } 154 }
155 clast = c; 155 clast = c;
156 } 156 }
157 break; 157 break;
158 } 158 }
159 default : 159 default :
160 { 160 {
@@ -242,97 +242,97 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens)
242#endif 242#endif
243 } 243 }
244 p--; 244 p--;
245 count = count-1; 245 count = count-1;
246 unsigned int mask = 0; 246 unsigned int mask = 0;
247 for (unsigned int i = m; i < m+count; i++) 247 for (unsigned int i = m; i < m+count; i++)
248 { 248 {
249 mask |= bit[i]; 249 mask |= bit[i];
250 } 250 }
251 251
252 for (iter it = CV.begin(); it != CV.end(); ++it) 252 for (iter it = CV.begin(); it != CV.end(); ++it)
253 { 253 {
254 if (CV[it.first()] & bit[m-1]) 254 if (CV[it.first()] & bit[m-1])
255 { 255 {
256 CV[it.first()] |= mask; 256 CV[it.first()] |= mask;
257 } 257 }
258 } 258 }
259 if (keep & bit[m-1]) keep |= mask; 259 if (keep & bit[m-1]) keep |= mask;
260 m += count; 260 m += count;
261 } 261 }
262 else 262 else
263 { 263 {
264 p++; 264 p++;
265 } 265 }
266 break; 266 break;
267 } 267 }
268 case '\\' : 268 case '\\' :
269 { 269 {
270#ifdef _WINDOWS 270#ifdef _WINDOWS
271 tchar c = escapedchar(pat.at(++p).unicode()); 271 tchar c = escapedchar(pat.at(++p).unicode());
272#else 272#else
273 tchar c = escapedchar(pat[++p].unicode()); 273 tchar c = escapedchar(pat[++p].unicode());
274#endif 274#endif
275 if (insens) 275 if (insens)
276 { 276 {
277 CV[upper(c)] |= bit[m]; 277 CV[upper(c)] |= bit[m];
278 CV[lower(c)] |= bit[m]; 278 CV[lower(c)] |= bit[m];
279 } 279 }
280 else 280 else
281 { 281 {
282 CV[c] |= bit[m]; 282 CV[c] |= bit[m];
283 } 283 }
284 m++; 284 m++;
285 break; 285 break;
286 } 286 }
287 287
288 case '[' : 288 case '[' :
289 { 289 {
290 tchar c, clast; 290 tchar c, clast = 0;
291 bool invert = false; 291 bool invert = false;
292#ifdef _WINDOWS 292#ifdef _WINDOWS
293 if (pat.at(p+1).unicode() == '^') 293 if (pat.at(p+1).unicode() == '^')
294#else 294#else
295 if (pat[p+1].unicode() == '^') 295 if (pat[p+1].unicode() == '^')
296#endif 296#endif
297 { 297 {
298 p++; 298 p++;
299 invert = true; 299 invert = true;
300 } 300 }
301#ifdef _WINDOWS 301#ifdef _WINDOWS
302 while ((c = pat.at(++p).unicode()) != ']') 302 while ((c = pat.at(++p).unicode()) != ']')
303#else 303#else
304 while ((c = pat[++p].unicode()) != ']') 304 while ((c = pat[++p].unicode()) != ']')
305#endif 305#endif
306 { 306 {
307 if (c == '\\') 307 if (c == '\\')
308 { 308 {
309#ifdef _WINDOWS 309#ifdef _WINDOWS
310 c = escapedchar(pat.at(++p).unicode()); 310 c = escapedchar(pat.at(++p).unicode());
311#else 311#else
312 c = escapedchar(pat[++p].unicode()); 312 c = escapedchar(pat[++p].unicode());
313#endif 313#endif
314 if (c == ']') break; 314 if (c == ']') break;
315 } 315 }
316 if (c == '-') 316 if (c == '-')
317 { 317 {
318#ifdef _WINDOWS 318#ifdef _WINDOWS
319 c = pat.at(++p).unicode(); 319 c = pat.at(++p).unicode();
320#else 320#else
321 c = pat[++p].unicode(); 321 c = pat[++p].unicode();
322#endif 322#endif
323 for (tchar j = clast; j <= c; j++) 323 for (tchar j = clast; j <= c; j++)
324 { 324 {
325 if (insens) 325 if (insens)
326 { 326 {
327 iter it; 327 iter it;
328 if ((it = CV.find(upper(j))) != CV.end()) 328 if ((it = CV.find(upper(j))) != CV.end())
329 CV[it] |= bit[m]; 329 CV[it] |= bit[m];
330 else 330 else
331 CV[0] |= bit[m]; 331 CV[0] |= bit[m];
332 if ((it = CV.find(lower(j))) != CV.end()) 332 if ((it = CV.find(lower(j))) != CV.end())
333 CV[it] |= bit[m]; 333 CV[it] |= bit[m];
334 else 334 else
335 CV[0] |= bit[m]; 335 CV[0] |= bit[m];
336 } 336 }
337 else 337 else
338 { 338 {
diff --git a/noncore/apps/opie-reader/Palm2QImage.cpp b/noncore/apps/opie-reader/Palm2QImage.cpp
index 361755f..09cad1c 100644
--- a/noncore/apps/opie-reader/Palm2QImage.cpp
+++ b/noncore/apps/opie-reader/Palm2QImage.cpp
@@ -80,185 +80,185 @@ static ColorMapEntry Palm8BitColormap[] = {
80 { 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 }, 80 { 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 },
81 { 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 }, 81 { 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 },
82 { 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 }, 82 { 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 },
83 { 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 }, 83 { 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 },
84 { 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 }, 84 { 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 },
85 { 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 }, 85 { 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 },
86 { 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 }, 86 { 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 },
87 { 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 }, 87 { 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 },
88 { 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 }, 88 { 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 },
89 { 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 }, 89 { 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 },
90 { 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 }, 90 { 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 },
91 { 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 }, 91 { 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 },
92 { 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 }, 92 { 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 },
93 { 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 }, 93 { 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 },
94 { 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 }, 94 { 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 },
95 { 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 }, 95 { 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 },
96 { 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 }, 96 { 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 },
97 { 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 }, 97 { 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 },
98 { 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 }, 98 { 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 },
99 { 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 }, 99 { 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 },
100 { 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 }, 100 { 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 },
101 { 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 }, 101 { 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 },
102 { 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 }, 102 { 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 },
103 { 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 }, 103 { 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 },
104 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 104 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
105 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 105 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
106 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 106 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
107 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 107 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
108 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, 108 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
109 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }}; 109 { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }};
110 110
111static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }}; 111static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }};
112 112
113static ColorMapEntry Palm2BitColormap[] = { 113static ColorMapEntry Palm2BitColormap[] = {
114 { 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }}; 114 { 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }};
115 115
116static ColorMapEntry Palm4BitColormap[] = { 116static ColorMapEntry Palm4BitColormap[] = {
117 { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 }, 117 { 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 },
118 { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 }, 118 { 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 },
119 { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 }, 119 { 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 },
120 { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }}; 120 { 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }};
121 121
122QImage* Palm2QImage 122QImage* Palm2QImage
123 (unsigned char *image_bytes_in, int byte_count_in) 123 (unsigned char *image_bytes_in, int byte_count_in)
124{ 124{
125 unsigned int width, height, bytes_per_row, flags, next_depth_offset; 125 unsigned int width, height, bytes_per_row, flags, next_depth_offset;
126 unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount; 126 unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount;
127 unsigned int palm_red_bits, palm_green_bits, palm_blue_bits; 127 unsigned int palm_red_bits, palm_green_bits, palm_blue_bits;
128 unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow, 128 unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow,
129 *imagedatastart, *palmimage; 129 *imagedatastart, *palmimage;
130 ColorMapEntry *colormap; 130 ColorMapEntry *colormap;
131 131
132 palmimage = image_bytes_in; 132 palmimage = image_bytes_in;
133 width = READ_BIGENDIAN_SHORT(palmimage + 0); 133 width = READ_BIGENDIAN_SHORT(palmimage + 0);
134 height = READ_BIGENDIAN_SHORT(palmimage + 2); 134 height = READ_BIGENDIAN_SHORT(palmimage + 2);
135 bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4); 135 bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4);
136 flags = READ_BIGENDIAN_SHORT(palmimage + 6); 136 flags = READ_BIGENDIAN_SHORT(palmimage + 6);
137 bits_per_pixel = palmimage[8]; 137 bits_per_pixel = palmimage[8];
138 version = palmimage[9]; 138 version = palmimage[9];
139 next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10); 139 next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10);
140 transparent_index = palmimage[12]; 140 transparent_index = palmimage[12];
141 compression_type = palmimage[13]; 141 compression_type = palmimage[13];
142 /* bytes 14 and 15 are reserved by Palm and always 0 */ 142 /* bytes 14 and 15 are reserved by Palm and always 0 */
143 143
144#if 0 144#if 0
145// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type); 145// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type);
146#endif 146#endif
147 147
148 if (compression_type == PALM_COMPRESSION_PACKBITS) { 148 if (compression_type == PALM_COMPRESSION_PACKBITS) {
149// qDebug ("Image uses packbits compression; not yet supported"); 149// qDebug ("Image uses packbits compression; not yet supported");
150 return NULL; 150 return NULL;
151 } else if ((compression_type != PALM_COMPRESSION_NONE) && 151 } else if ((compression_type != PALM_COMPRESSION_NONE) &&
152 (compression_type != PALM_COMPRESSION_RLE) && 152 (compression_type != PALM_COMPRESSION_RLE) &&
153 (compression_type != PALM_COMPRESSION_SCANLINE)) { 153 (compression_type != PALM_COMPRESSION_SCANLINE)) {
154// qDebug ("Image uses unknown compression, code 0x%x", compression_type); 154// qDebug ("Image uses unknown compression, code 0x%x", compression_type);
155 return NULL; 155 return NULL;
156 } 156 }
157 157
158 /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps: 158 /* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps:
159 159
160 1, 2, or 4 bit grayscale 160 1, 2, or 4 bit grayscale
161 8-bit StaticColor using the Palm standard colormap 161 8-bit StaticColor using the Palm standard colormap
162 8-bit PseudoColor using a user-specified colormap 162 8-bit PseudoColor using a user-specified colormap
163 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue 163 16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue
164 164
165 Each of these can be compressed with one of four compression schemes, 165 Each of these can be compressed with one of four compression schemes,
166 "RLE", "Scanline", "PackBits", or none. 166 "RLE", "Scanline", "PackBits", or none.
167 167
168 We begin by constructing the colormap. 168 We begin by constructing the colormap.
169 */ 169 */
170 170
171 if (flags & PALM_HAS_COLORMAP_FLAG) { 171 if (flags & PALM_HAS_COLORMAP_FLAG) {
172// qDebug("Palm images with custom colormaps are not currently supported.\n"); 172// qDebug("Palm images with custom colormaps are not currently supported.\n");
173 return NULL; 173 return NULL;
174 } else if (bits_per_pixel == 1) { 174 } else if (bits_per_pixel == 1) {
175 colormap = Palm1BitColormap; 175 colormap = Palm1BitColormap;
176 imagedatastart = palmimage + 16; 176 imagedatastart = palmimage + 16;
177 } else if (bits_per_pixel == 2) { 177 } else if (bits_per_pixel == 2) {
178 colormap = Palm2BitColormap; 178 colormap = Palm2BitColormap;
179 imagedatastart = palmimage + 16; 179 imagedatastart = palmimage + 16;
180 } else if (bits_per_pixel == 4) { 180 } else if (bits_per_pixel == 4) {
181 colormap = Palm4BitColormap; 181 colormap = Palm4BitColormap;
182 imagedatastart = palmimage + 16; 182 imagedatastart = palmimage + 16;
183 } else if (bits_per_pixel == 8) { 183 } else if (bits_per_pixel == 8) {
184 colormap = Palm8BitColormap; 184 colormap = Palm8BitColormap;
185 imagedatastart = palmimage + 16; 185 imagedatastart = palmimage + 16;
186 } else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) { 186 } else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) {
187 colormap = NULL; 187 colormap = NULL;
188 palm_red_bits = palmimage[16]; 188 palm_red_bits = palmimage[16];
189 palm_green_bits = palmimage[17]; 189 palm_green_bits = palmimage[17];
190 palm_blue_bits = palmimage[18]; 190 palm_blue_bits = palmimage[18];
191// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits); 191// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits);
192 if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) { 192 if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) {
193// qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits); 193// qDebug("Can't handle this format DirectColor image -- too wide in some color (%d:%d:%d)\n", palm_red_bits, palm_green_bits, palm_blue_bits);
194 return NULL; 194 return NULL;
195 } 195 }
196 if (bits_per_pixel > (8 * sizeof(unsigned long))) { 196 if (bits_per_pixel > (8 * sizeof(unsigned long))) {
197// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel); 197// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel);
198 return NULL; 198 return NULL;
199 } 199 }
200 imagedatastart = palmimage + 24; 200 imagedatastart = palmimage + 24;
201 } else { 201 } else {
202// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel); 202// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel);
203 return NULL; 203 return NULL;
204 } 204 }
205 205
206#ifndef USEQPE 206#ifndef USEQPE
207 QImage* qimage = new QImage(width, height, 32); 207 QImage* qimage = new QImage(width, height, 32);
208#else 208#else
209 QImage* qimage = new QImage(width, height, 16); 209 QImage* qimage = new QImage(width, height, 16);
210#endif 210#endif
211 211
212 /* row by row, uncompress the Palm image and copy it to the JPEG buffer */ 212 /* row by row, uncompress the Palm image and copy it to the JPEG buffer */
213 rowbuf = new unsigned char[bytes_per_row * width]; 213 rowbuf = new unsigned char[bytes_per_row * width];
214 lastrow = new unsigned char[bytes_per_row * width]; 214 lastrow = new unsigned char[bytes_per_row * width];
215 215
216 for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) { 216 for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) {
217// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row); 217// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row);
218 218
219 /* first, uncompress the Palm image */ 219 /* first, uncompress the Palm image */
220 if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) { 220 if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) {
221 for (j = 0; j < bytes_per_row; ) { 221 for (j = 0; j < bytes_per_row; ) {
222 incount = *palm_ptr++; 222 incount = *palm_ptr++;
223 inval = *palm_ptr++; 223 inval = *palm_ptr++;
224 memset(rowbuf + j, inval, incount); 224 memset(rowbuf + j, inval, incount);
225 j += incount; 225 j += incount;
226 } 226 }
227 } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) { 227 } else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) {
228 for (j = 0; j < bytes_per_row; j += 8) { 228 for (j = 0; j < bytes_per_row; j += 8) {
229 incount = *palm_ptr++; 229 incount = *palm_ptr++;
230 inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8; 230 inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8;
231 for (inbit = 0; inbit < inval; inbit += 1) { 231 for (inbit = 0; inbit < inval; inbit += 1) {
232 if (incount & (1 << (7 - inbit))) 232 if (incount & (1 << (7 - inbit)))
233 rowbuf[j + inbit] = *palm_ptr++; 233 rowbuf[j + inbit] = *palm_ptr++;
234 else 234 else
235 rowbuf[j + inbit] = lastrow[j + inbit]; 235 rowbuf[j + inbit] = lastrow[j + inbit];
236 } 236 }
237 } 237 }
238 memcpy (lastrow, rowbuf, bytes_per_row); 238 memcpy (lastrow, rowbuf, bytes_per_row);
239 } else if (((flags & PALM_IS_COMPRESSED_FLAG) && 239 } else if (((flags & PALM_IS_COMPRESSED_FLAG) &&
240 (compression_type == PALM_COMPRESSION_NONE)) || 240 (compression_type == PALM_COMPRESSION_NONE)) ||
241 ((flags & PALM_IS_COMPRESSED_FLAG) == 0)) 241 ((flags & PALM_IS_COMPRESSED_FLAG) == 0))
242 { 242 {
243 memcpy (rowbuf, palm_ptr, bytes_per_row); 243 memcpy (rowbuf, palm_ptr, bytes_per_row);
244 palm_ptr += bytes_per_row; 244 palm_ptr += bytes_per_row;
245 } 245 }
246 else { 246 else {
247 qDebug("Case 4"); 247 qDebug("Case 4");
248 qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true"); 248 qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true");
249 qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true"); 249 qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true");
250 qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true"); 250 qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true");
251 qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true"); 251 qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true");
252 qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true"); 252 qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true");
253 memcpy (rowbuf, palm_ptr, bytes_per_row); 253 memcpy (rowbuf, palm_ptr, bytes_per_row);
254 palm_ptr += bytes_per_row; 254 palm_ptr += bytes_per_row;
255 } 255 }
256 /* next, write it to the GDK bitmap */ 256 /* next, write it to the GDK bitmap */
257 if (colormap) { 257 if (colormap) {
258 mask = (1 << bits_per_pixel) - 1; 258 mask = (1 << bits_per_pixel) - 1;
259 for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) { 259 for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) {
260 inval = ((*inbyte) & (mask << inbit)) >> inbit; 260 inval = ((*inbyte) & (mask << inbit)) >> inbit;
261 /* correct for oddity of the 8-bit color Palm pixmap... */ 261 /* correct for oddity of the 8-bit color Palm pixmap... */
262 if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231; 262 if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231;
263 /* now lookup the correct color and set the pixel in the GTK bitmap */ 263 /* now lookup the correct color and set the pixel in the GTK bitmap */
264 QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue); 264 QRgb colour = qRgb(colormap[inval].red, colormap[inval].green, colormap[inval].blue);
diff --git a/noncore/apps/opie-reader/QTReader.cpp b/noncore/apps/opie-reader/QTReader.cpp
index 0c56dd4..75da8ac 100644
--- a/noncore/apps/opie-reader/QTReader.cpp
+++ b/noncore/apps/opie-reader/QTReader.cpp
@@ -499,97 +499,97 @@ void QTReader::suspend()
499 */ 499 */
500} 500}
501 501
502void QTReader::setDoubleBuffer(bool _b) 502void QTReader::setDoubleBuffer(bool _b)
503{ 503{
504 m_doubleBuffered = _b; 504 m_doubleBuffered = _b;
505 if (_b || m_rotated) 505 if (_b || m_rotated)
506 { 506 {
507 if (dbuff == NULL) 507 if (dbuff == NULL)
508 { 508 {
509 dbuff = new QPixmap(); 509 dbuff = new QPixmap();
510 dbp = new QPainter(); 510 dbp = new QPainter();
511 } 511 }
512 if (m_rotated) 512 if (m_rotated)
513 { 513 {
514 dbuff->resize(height(), width()); 514 dbuff->resize(height(), width());
515 } 515 }
516 else 516 else
517 { 517 {
518 dbuff->resize(width(), height()); 518 dbuff->resize(width(), height());
519 } 519 }
520 m_outofdate = true; 520 m_outofdate = true;
521 } 521 }
522 else 522 else
523 { 523 {
524 if (dbuff != NULL) 524 if (dbuff != NULL)
525 { 525 {
526 delete dbuff; 526 delete dbuff;
527 delete dbp; 527 delete dbp;
528 } 528 }
529 dbuff = NULL; 529 dbuff = NULL;
530 dbp = NULL; 530 dbp = NULL;
531 } 531 }
532} 532}
533 533
534void QTReader::setTwoTouch(bool _b) 534void QTReader::setTwoTouch(bool _b)
535{ 535{
536 setBackgroundColor( m_bg ); 536 setBackgroundColor( m_bg );
537 m_twotouch = m_touchone = _b; 537 m_twotouch = m_touchone = _b;
538} 538}
539 539
540void QTReader::setContinuous(bool _b) 540void QTReader::setContinuous(bool _b)
541{ 541{
542 buffdoc.setContinuous(m_continuousDocument = _b); 542 buffdoc.setContinuous(m_continuousDocument = _b);
543} 543}
544 544
545void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno) 545void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno)
546{ 546{
547 unsigned long wrdstart, wrdend; 547 unsigned long wrdstart = 0, wrdend = 0;
548 QString wrd; 548 QString wrd;
549 int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin; 549 int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
550 if (m_twotouch) 550 if (m_twotouch)
551 { 551 {
552 if (m_touchone) 552 if (m_touchone)
553 { 553 {
554 m_touchone = false; 554 m_touchone = false;
555 m_startpos = startpos; 555 m_startpos = startpos;
556 m_startoffset = startoffset; 556 m_startoffset = startoffset;
557 setBackgroundColor( lightGray ); 557 setBackgroundColor( lightGray );
558 } 558 }
559 else 559 else
560 { 560 {
561 m_touchone = true; 561 m_touchone = true;
562 setBackgroundColor( m_bg ); 562 setBackgroundColor( m_bg );
563 size_t endpos, endoffset; 563 size_t endpos, endoffset;
564 endpos = startpos; 564 endpos = startpos;
565 endoffset = startoffset; 565 endoffset = startoffset;
566 size_t currentpos = locate(); 566 size_t currentpos = locate();
567 if (endpos >= m_startpos) 567 if (endpos >= m_startpos)
568 { 568 {
569 jumpto(m_startpos); 569 jumpto(m_startpos);
570 for (int i = 0; i < m_startoffset; i++) 570 for (int i = 0; i < m_startoffset; i++)
571 { 571 {
572 getch(); 572 getch();
573 } 573 }
574 wrdstart = buffdoc.explocate(); 574 wrdstart = buffdoc.explocate();
575 if (m_startpos == endpos) 575 if (m_startpos == endpos)
576 { 576 {
577 for (int i = m_startoffset; i <= endoffset; i++) 577 for (int i = m_startoffset; i <= endoffset; i++)
578 { 578 {
579 wrd += QChar(getch()); 579 wrd += QChar(getch());
580 } 580 }
581 } 581 }
582 else 582 else
583 { 583 {
584 while (buffdoc.explocate() <= endpos) 584 while (buffdoc.explocate() <= endpos)
585 { 585 {
586 wrd += QChar(getch()); 586 wrd += QChar(getch());
587 } 587 }
588 for (int i = 0; i < endoffset; i++) 588 for (int i = 0; i < endoffset; i++)
589 { 589 {
590 wrd += QChar(getch()); 590 wrd += QChar(getch());
591 } 591 }
592 } 592 }
593 wrdend = buffdoc.explocate(); 593 wrdend = buffdoc.explocate();
594 jumpto(currentpos); 594 jumpto(currentpos);
595 } 595 }
diff --git a/noncore/apps/opie-reader/plucker_base.cpp b/noncore/apps/opie-reader/plucker_base.cpp
index 849edfc..302ac73 100644
--- a/noncore/apps/opie-reader/plucker_base.cpp
+++ b/noncore/apps/opie-reader/plucker_base.cpp
@@ -660,97 +660,97 @@ unsigned short CPlucker_base::finduid(unsigned short urlid)
660 { 660 {
661 return jmin; 661 return jmin;
662 } 662 }
663 gotorecordnumber(jmax); 663 gotorecordnumber(jmax);
664 GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved); 664 GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
665 luid = thishdr_uid; 665 luid = thishdr_uid;
666 //qDebug("jmax at end:%u,%u", jmax, luid); 666 //qDebug("jmax at end:%u,%u", jmax, luid);
667 if (luid == urlid) 667 if (luid == urlid)
668 { 668 {
669 return jmax; 669 return jmax;
670 } 670 }
671 //qDebug("Couldn't find %u", urlid); 671 //qDebug("Couldn't find %u", urlid);
672 return 0; // Not found! 672 return 0; // Not found!
673} 673}
674 674
675#include <qnamespace.h> 675#include <qnamespace.h>
676 676
677void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen) 677void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
678{ 678{
679 unsigned short sz = 0; 679 unsigned short sz = 0;
680 for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) 680 for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
681 { 681 {
682 sz++; 682 sz++;
683 } 683 }
684 size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long); 684 size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long);
685 unsigned char* newdata = new unsigned char[newlen]; 685 unsigned char* newdata = new unsigned char[newlen];
686 unsigned char* pdata = newdata; 686 unsigned char* pdata = newdata;
687 memcpy(newdata, src, srclen); 687 memcpy(newdata, src, srclen);
688 newdata += srclen; 688 newdata += srclen;
689 memcpy(newdata, &sz, sizeof(sz)); 689 memcpy(newdata, &sz, sizeof(sz));
690 newdata += sizeof(sz); 690 newdata += sizeof(sz);
691#ifdef _WINDOWS 691#ifdef _WINDOWS
692 for (it = visited.begin(); it != visited.end(); it++) 692 for (it = visited.begin(); it != visited.end(); it++)
693#else 693#else
694 for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++) 694 for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
695#endif 695#endif
696 { 696 {
697 unsigned long t = *it; 697 unsigned long t = *it;
698 //qDebug("[%u]", t); 698 //qDebug("[%u]", t);
699 memcpy(newdata, &t, sizeof(t)); 699 memcpy(newdata, &t, sizeof(t));
700 newdata += sizeof(t); 700 newdata += sizeof(t);
701 } 701 }
702 m_nav.setSaveData(data, len, pdata, newlen); 702 m_nav.setSaveData(data, len, pdata, newlen);
703 delete [] pdata; 703 delete [] pdata;
704} 704}
705 705
706void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen) 706void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen)
707{ 707{
708 unsigned short sz; 708 unsigned short sz = 0;
709 if (srclen >= sizeof(sz)) 709 if (srclen >= sizeof(sz))
710 { 710 {
711 memcpy(&sz, src, sizeof(sz)); 711 memcpy(&sz, src, sizeof(sz));
712 src += sizeof(sz); 712 src += sizeof(sz);
713 srclen -= sizeof(sz); 713 srclen -= sizeof(sz);
714 } 714 }
715 for (int i = 0; i < sz; i++) 715 for (int i = 0; i < sz; i++)
716 { 716 {
717 unsigned long t; 717 unsigned long t;
718 if (srclen >= sizeof(t)) 718 if (srclen >= sizeof(t))
719 { 719 {
720 memcpy(&t, src, sizeof(t)); 720 memcpy(&t, src, sizeof(t));
721 // qDebug("[%u]", t); 721 // qDebug("[%u]", t);
722 visited.push_front(t); 722 visited.push_front(t);
723 src += sizeof(t); 723 src += sizeof(t);
724 srclen -= sizeof(t); 724 srclen -= sizeof(t);
725 } 725 }
726 else 726 else
727 { 727 {
728 QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself"); 728 QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself");
729 break; 729 break;
730 } 730 }
731 } 731 }
732 m_nav.putSaveData(src, srclen); 732 m_nav.putSaveData(src, srclen);
733} 733}
734 734
735int CPlucker_base::OpenFile(const char *src) 735int CPlucker_base::OpenFile(const char *src)
736{ 736{
737 qDebug("plucker openfile:%s", src); 737 qDebug("plucker openfile:%s", src);
738 m_lastBreak = 0; 738 m_lastBreak = 0;
739 if (!Cpdb::openpdbfile(src)) 739 if (!Cpdb::openpdbfile(src))
740 { 740 {
741 return -1; 741 return -1;
742 } 742 }
743 743
744 if (!CorrectDecoder()) return -1; 744 if (!CorrectDecoder()) return -1;
745 745
746 gotorecordnumber(0); 746 gotorecordnumber(0);
747 fread(&hdr0, 1, 6, fin); 747 fread(&hdr0, 1, 6, fin);
748 qDebug("Compression type:%u", ntohs(hdr0.version)); 748 qDebug("Compression type:%u", ntohs(hdr0.version));
749 749
750 750
751 switch (ntohs(hdr0.version)) 751 switch (ntohs(hdr0.version))
752 { 752 {
753 case 2: 753 case 2:
754 m_decompress = UnZip; 754 m_decompress = UnZip;
755 break; 755 break;
756 case 1: 756 case 1:
diff --git a/noncore/apps/opie-reader/striphtml.cpp b/noncore/apps/opie-reader/striphtml.cpp
index c434dbb..a2ad56b 100644
--- a/noncore/apps/opie-reader/striphtml.cpp
+++ b/noncore/apps/opie-reader/striphtml.cpp
@@ -428,97 +428,97 @@ QString striphtml::getattr(tchar& ch)
428 unsigned long pos; 428 unsigned long pos;
429 if (ch == ' ') ch = skip_ws(); 429 if (ch == ' ') ch = skip_ws();
430 if (ch == '=') 430 if (ch == '=')
431 { 431 {
432 ch = skip_ws(); 432 ch = skip_ws();
433 if (ch == '"') 433 if (ch == '"')
434 { 434 {
435 mygetch(ch, sty, pos); 435 mygetch(ch, sty, pos);
436 ref = getname(ch, "\""); 436 ref = getname(ch, "\"");
437 ch = skip_ws(); 437 ch = skip_ws();
438 } 438 }
439 else if (ch == '\'') 439 else if (ch == '\'')
440 { 440 {
441 mygetch(ch, sty, pos); 441 mygetch(ch, sty, pos);
442 ref = getname(ch, "\'"); 442 ref = getname(ch, "\'");
443 ch = skip_ws(); 443 ch = skip_ws();
444 } 444 }
445 else 445 else
446 { 446 {
447 ref = getname(ch, " >"); 447 ref = getname(ch, " >");
448 if (ch == ' ') ch = skip_ws(); 448 if (ch == ' ') ch = skip_ws();
449 } 449 }
450 } 450 }
451 return ref; 451 return ref;
452} 452}
453 453
454linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm) 454linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm)
455{ 455{
456#if defined(USEQPE) || defined(_WINDOWS) 456#if defined(USEQPE) || defined(_WINDOWS)
457 QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n); 457 QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n);
458#else 458#else
459 QMap<unsigned long, QString>::iterator hrefit = id2href->find(n); 459 QMap<unsigned long, QString>::iterator hrefit = id2href->find(n);
460#endif 460#endif
461 if (hrefit == id2href->end()) 461 if (hrefit == id2href->end())
462 { 462 {
463 return eNone; 463 return eNone;
464 } 464 }
465 QString href = *hrefit; 465 QString href = *hrefit;
466#if defined(USEQPE) || defined(_WINDOWS) 466#if defined(USEQPE) || defined(_WINDOWS)
467 QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href); 467 QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href);
468#else 468#else
469 QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href); 469 QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href);
470#endif 470#endif
471 if (fpit == href2filepos->end()) 471 if (fpit == href2filepos->end())
472 { 472 {
473 if (href == "history.back()") 473 if (href == "history.back()")
474 { 474 {
475 QString fc = currentfile; 475 QString fc = currentfile;
476 unsigned long loc; 476 unsigned long loc = 0;
477 htmlmark m(fc, loc); 477 htmlmark m(fc, loc);
478 linkType ret = (m_nav.back(m)) ? eFile : eNone; 478 linkType ret = (m_nav.back(m)) ? eFile : eNone;
479 if (fc == m.filename()) 479 if (fc == m.filename())
480 { 480 {
481 if ((ret & eFile) != 0) 481 if ((ret & eFile) != 0)
482 { 482 {
483 locate(m.posn()); 483 locate(m.posn());
484 return eLink; 484 return eLink;
485 } 485 }
486 } 486 }
487 return eNone; 487 return eNone;
488 } 488 }
489 qDebug("Searching for %s", (const char*)href); 489 qDebug("Searching for %s", (const char*)href);
490 490
491 491
492 QString file, name; 492 QString file, name;
493 493
494 int colon = href.find('#'); 494 int colon = href.find('#');
495 if (colon >= 0) 495 if (colon >= 0)
496 { 496 {
497 file = dehtml(href.left(colon)); 497 file = dehtml(href.left(colon));
498 name = dehtml(href.right(href.length()-colon-1)); 498 name = dehtml(href.right(href.length()-colon-1));
499 } 499 }
500 else 500 else
501 { 501 {
502 file = dehtml(href); 502 file = dehtml(href);
503 } 503 }
504 504
505 qDebug("File:%s", (const char*)file); 505 qDebug("File:%s", (const char*)file);
506 qDebug("Name:%s", (const char*)name); 506 qDebug("Name:%s", (const char*)name);
507 507
508 508
509 if (file.isEmpty()) 509 if (file.isEmpty())
510 { 510 {
511 if (parent->findanchor(name)) 511 if (parent->findanchor(name))
512 { 512 {
513 reset(); 513 reset();
514 return eLink; 514 return eLink;
515 } 515 }
516 fpit = href2filepos->find(name); 516 fpit = href2filepos->find(name);
517 if (fpit != href2filepos->end()) 517 if (fpit != href2filepos->end())
518 { 518 {
519 locate(*fpit); 519 locate(*fpit);
520 return eLink; 520 return eLink;
521 } 521 }
522 else 522 else
523 { 523 {
524 // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\""; 524 // nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\"";