summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader
authorerik <erik>2007-01-29 21:53:48 (UTC)
committer erik <erik>2007-01-29 21:53:48 (UTC)
commit02ef45be75a3024df11365956e1cce6392d9103c (patch) (side-by-side diff)
tree42fd5c909d67a473f57a607e01d32e01b3dd2511 /noncore/apps/opie-reader
parentb2c306a99b8dc82c981390f02db859149fac8cf0 (diff)
downloadopie-02ef45be75a3024df11365956e1cce6392d9103c.zip
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.gz
opie-02ef45be75a3024df11365956e1cce6392d9103c.tar.bz2
Each file in this commit has an issue where the initial value of a variable
is assumed to be something but no initial value is given. This commit changes that by either assigning an initial value or removing the assumption on an initial value (usually the former).
Diffstat (limited to 'noncore/apps/opie-reader') (more/less context) (ignore 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)
case 0x9f:
ch = 0x0178;
break;
case 0x18:
ch = 0x2026;
break;
case 0x19:
ch = 0x2007;
break;
case 0x8d:
ch = 0x2662;
break;
case 0x8e:
ch = 0x2663;
break;
case 0x8f:
ch = 0x2661;
break;
case 0x90:
ch = 0x2660;
break;
default:
break;
}
}
//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 };
//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 };
void DePluck::getch(tchar& ch, CStyle& sty, unsigned long& pos)
{
if (m_buffed > 0)
{
sty = m_laststyle;
ch = nextpart[m_current++];
if (m_current == m_buffed)
{
m_current = m_buffed = 0;
}
}
else
{
if (m_buffer != 0)
{
ch = m_buffer;
m_buffer = 0;
return;
}
- unsigned long lnk, lnkoff;
+ unsigned long lnk = 0, lnkoff = 0;
do
{
if (nextpart[m_buffed] == 0) break;
parent->getch(ch, sty, pos);
m_laststyle = sty;
if (sty.getLink())
{
lnk = sty.getData();
lnkoff = sty.getOffset();
}
} while (ch == nextpart[m_buffed] && sty.getLink() && ++m_buffed);
m_current = 0;
if (nextpart[m_buffed] == 0)
{
m_buffed = 0;
QString dmy, dmy2;
parent->hyperlink(lnk, lnkoff, dmy, dmy2);
do
{
parent->getch(ch, sty, pos);
}
while (ch != 10);
parent->getch(ch, sty, pos);
}
else if (m_buffed > 0)
{
m_buffer = ch;
ch = nextpart[0];
if (m_buffed == 1)
{
m_buffed = 0;
}
else m_current = 1;
}
}
return;
}
HighlightFilter::HighlightFilter(QTReader* _p) : pReader(_p), lastpos(0), nextpos(0), red(255), green(255), blue(255)
{
}
#include "Bkmks.h"
#include "QTReader.h"
void HighlightFilter::refresh(unsigned long pos)
{
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)
#ifdef _WINDOWS
switch (pat.at(p).unicode())
#else
switch (pat[p].unicode())
#endif
{
case '{':
{
break;
}
case '}':
{
break;
}
case '^':
{
break;
}
case '.' :
{
break;
}
case '#':
{
p++;
#ifdef _WINDOWS
while ('0' <= pat.at(p).unicode() && pat.at(p).unicode() <= '9')
#else
while ('0' <= pat[p].unicode() && pat[p].unicode() <= '9')
#endif
{
}
p--;
break;
}
case '\\' :
{
#ifdef _WINDOWS
tchar c = escapedchar(pat.at(++p).unicode());
#else
tchar c = escapedchar(pat[++p].unicode());
#endif
regchar(c, insens);
break;
}
case '[' :
{
- tchar clast;
+ tchar clast = 0;
bool invert = false;
tchar c;
#ifdef _WINDOWS
if (pat.at(p+1).unicode() == '^')
#else
if (pat[p+1].unicode() == '^')
#endif
{
p++;
invert = true;
}
#ifdef _WINDOWS
while ((c = pat.at(++p).unicode()) != ']')
#else
while ((c = pat[++p].unicode()) != ']')
#endif
{
if (c == '\\')
{
#ifdef _WINDOWS
c = escapedchar(pat.at(++p).unicode());
#else
c = escapedchar(pat[++p].unicode());
#endif
if (c == ']') break;
}
if (c == '-')
{
#ifdef _WINDOWS
c = pat.at(++p).unicode();
#else
c = pat[++p].unicode();
#endif
for (tchar j = clast; j <= c; j++)
{
regchar(j, insens);
}
}
else
{
regchar(c, insens);
}
clast = c;
}
break;
}
default :
{
@@ -242,97 +242,97 @@ unsigned int CRegExpFilt::preprocessing(const QString& pat, bool insens)
#endif
}
p--;
count = count-1;
unsigned int mask = 0;
for (unsigned int i = m; i < m+count; i++)
{
mask |= bit[i];
}
for (iter it = CV.begin(); it != CV.end(); ++it)
{
if (CV[it.first()] & bit[m-1])
{
CV[it.first()] |= mask;
}
}
if (keep & bit[m-1]) keep |= mask;
m += count;
}
else
{
p++;
}
break;
}
case '\\' :
{
#ifdef _WINDOWS
tchar c = escapedchar(pat.at(++p).unicode());
#else
tchar c = escapedchar(pat[++p].unicode());
#endif
if (insens)
{
CV[upper(c)] |= bit[m];
CV[lower(c)] |= bit[m];
}
else
{
CV[c] |= bit[m];
}
m++;
break;
}
case '[' :
{
- tchar c, clast;
+ tchar c, clast = 0;
bool invert = false;
#ifdef _WINDOWS
if (pat.at(p+1).unicode() == '^')
#else
if (pat[p+1].unicode() == '^')
#endif
{
p++;
invert = true;
}
#ifdef _WINDOWS
while ((c = pat.at(++p).unicode()) != ']')
#else
while ((c = pat[++p].unicode()) != ']')
#endif
{
if (c == '\\')
{
#ifdef _WINDOWS
c = escapedchar(pat.at(++p).unicode());
#else
c = escapedchar(pat[++p].unicode());
#endif
if (c == ']') break;
}
if (c == '-')
{
#ifdef _WINDOWS
c = pat.at(++p).unicode();
#else
c = pat[++p].unicode();
#endif
for (tchar j = clast; j <= c; j++)
{
if (insens)
{
iter it;
if ((it = CV.find(upper(j))) != CV.end())
CV[it] |= bit[m];
else
CV[0] |= bit[m];
if ((it = CV.find(lower(j))) != CV.end())
CV[it] |= bit[m];
else
CV[0] |= bit[m];
}
else
{
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[] = {
{ 204, 51, 51 }, { 204, 0, 51 }, { 204, 255, 0 }, { 204, 204, 0 },
{ 204, 153, 0 }, { 204, 102, 0 }, { 204, 51, 0 }, { 204, 0, 0 },
{ 153, 255, 102 }, { 153, 204, 102 }, { 153, 153, 102 }, { 153, 102, 102 },
{ 153, 51, 102 }, { 153, 0, 102 }, { 153, 255, 51 }, { 153, 204, 51 },
{ 153, 153, 51 }, { 153, 102, 51 }, { 153, 51, 51 }, { 153, 0, 51 },
{ 153, 255, 0 }, { 153, 204, 0 }, { 153, 153, 0 }, { 153, 102, 0 },
{ 153, 51, 0 }, { 153, 0, 0 }, { 102, 255, 102 }, { 102, 204, 102 },
{ 102, 153, 102 }, { 102, 102, 102 }, { 102, 51, 102 }, { 102, 0, 102 },
{ 102, 255, 51 }, { 102, 204, 51 }, { 102, 153, 51 }, { 102, 102, 51 },
{ 102, 51, 51 }, { 102, 0, 51 }, { 102, 255, 0 }, { 102, 204, 0 },
{ 102, 153, 0 }, { 102, 102, 0 }, { 102, 51, 0 }, { 102, 0, 0 },
{ 51, 255, 102 }, { 51, 204, 102 }, { 51, 153, 102 }, { 51, 102, 102 },
{ 51, 51, 102 }, { 51, 0, 102 }, { 51, 255, 51 }, { 51, 204, 51 },
{ 51, 153, 51 }, { 51, 102, 51 }, { 51, 51, 51 }, { 51, 0, 51 },
{ 51, 255, 0 }, { 51, 204, 0 }, { 51, 153, 0 }, { 51, 102, 0 },
{ 51, 51, 0 }, { 51, 0, 0 }, { 0, 255, 102 }, { 0, 204, 102 },
{ 0, 153, 102 }, { 0, 102, 102 }, { 0, 51, 102 }, { 0, 0, 102 },
{ 0, 255, 51 }, { 0, 204, 51 }, { 0, 153, 51 }, { 0, 102, 51 },
{ 0, 51, 51 }, { 0, 0, 51 }, { 0, 255, 0 }, { 0, 204, 0 },
{ 0, 153, 0 }, { 0, 102, 0 }, { 0, 51, 0 }, { 17, 17, 17 },
{ 34, 34, 34 }, { 68, 68, 68 }, { 85, 85, 85 }, { 119, 119, 119 },
{ 136, 136, 136 }, { 170, 170, 170 }, { 187, 187, 187 }, { 221, 221, 221 },
{ 238, 238, 238 }, { 192, 192, 192 }, { 128, 0, 0 }, { 128, 0, 128 },
{ 0, 128, 0 }, { 0, 128, 128 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }};
static ColorMapEntry Palm1BitColormap[] = {{ 255, 255, 255 }, { 0, 0, 0 }};
static ColorMapEntry Palm2BitColormap[] = {
{ 255, 255, 255 }, { 192, 192, 192 }, { 128, 128, 128 }, { 0, 0, 0 }};
static ColorMapEntry Palm4BitColormap[] = {
{ 255, 255, 255 }, { 238, 238, 238 }, { 221, 221, 221 }, { 204, 204, 204 },
{ 187, 187, 187 }, { 170, 170, 170 }, { 153, 153, 153 }, { 136, 136, 136 },
{ 119, 119, 119 }, { 102, 102, 102 }, { 85, 85, 85 }, { 68, 68, 68 },
{ 51, 51, 51 }, { 34, 34, 34 }, { 17, 17, 17 }, { 0, 0, 0 }};
QImage* Palm2QImage
(unsigned char *image_bytes_in, int byte_count_in)
{
unsigned int width, height, bytes_per_row, flags, next_depth_offset;
unsigned int bits_per_pixel, version, transparent_index, compression_type, i, j, inval, inbit, mask, incount;
unsigned int palm_red_bits, palm_green_bits, palm_blue_bits;
- unsigned char *palm_ptr, *x_ptr, *imagedata, *inbyte, *rowbuf, *lastrow,
+ unsigned char *palm_ptr, *x_ptr, *inbyte, *rowbuf, *lastrow,
*imagedatastart, *palmimage;
ColorMapEntry *colormap;
palmimage = image_bytes_in;
width = READ_BIGENDIAN_SHORT(palmimage + 0);
height = READ_BIGENDIAN_SHORT(palmimage + 2);
bytes_per_row = READ_BIGENDIAN_SHORT(palmimage + 4);
flags = READ_BIGENDIAN_SHORT(palmimage + 6);
bits_per_pixel = palmimage[8];
version = palmimage[9];
next_depth_offset = READ_BIGENDIAN_SHORT(palmimage + 10);
transparent_index = palmimage[12];
compression_type = palmimage[13];
/* bytes 14 and 15 are reserved by Palm and always 0 */
#if 0
// qDebug ("Palm image is %dx%d, %d bpp, version %d, flags 0x%x, compression %d", width, height, bits_per_pixel, version, flags, compression_type);
#endif
if (compression_type == PALM_COMPRESSION_PACKBITS) {
// qDebug ("Image uses packbits compression; not yet supported");
return NULL;
} else if ((compression_type != PALM_COMPRESSION_NONE) &&
(compression_type != PALM_COMPRESSION_RLE) &&
(compression_type != PALM_COMPRESSION_SCANLINE)) {
// qDebug ("Image uses unknown compression, code 0x%x", compression_type);
return NULL;
}
/* as of PalmOS 4.0, there are 6 different kinds of Palm pixmaps:
1, 2, or 4 bit grayscale
8-bit StaticColor using the Palm standard colormap
8-bit PseudoColor using a user-specified colormap
16-bit DirectColor using 5 bits for red, 6 for green, and 5 for blue
Each of these can be compressed with one of four compression schemes,
"RLE", "Scanline", "PackBits", or none.
We begin by constructing the colormap.
*/
if (flags & PALM_HAS_COLORMAP_FLAG) {
// qDebug("Palm images with custom colormaps are not currently supported.\n");
return NULL;
} else if (bits_per_pixel == 1) {
colormap = Palm1BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 2) {
colormap = Palm2BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 4) {
colormap = Palm4BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 8) {
colormap = Palm8BitColormap;
imagedatastart = palmimage + 16;
} else if (bits_per_pixel == 16 && (flags & PALM_DIRECT_COLOR_FLAG)) {
colormap = NULL;
palm_red_bits = palmimage[16];
palm_green_bits = palmimage[17];
palm_blue_bits = palmimage[18];
// qDebug("Bits:%d, %d, %d", palm_red_bits, palm_green_bits, palm_blue_bits);
if (palm_blue_bits > 8 || palm_green_bits > 8 || palm_red_bits > 8) {
// 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);
return NULL;
}
if (bits_per_pixel > (8 * sizeof(unsigned long))) {
// qDebug ("Can't handle this format DirectColor image -- too many bits per pixel (%d)\n", bits_per_pixel);
return NULL;
}
imagedatastart = palmimage + 24;
} else {
// qDebug("Unknown bits-per-pixel of %d encountered.\n", bits_per_pixel);
return NULL;
}
#ifndef USEQPE
QImage* qimage = new QImage(width, height, 32);
#else
QImage* qimage = new QImage(width, height, 16);
#endif
/* row by row, uncompress the Palm image and copy it to the JPEG buffer */
rowbuf = new unsigned char[bytes_per_row * width];
lastrow = new unsigned char[bytes_per_row * width];
- for (i=0, palm_ptr = imagedatastart , x_ptr = imagedata; i < height; ++i) {
+ for (i=0, palm_ptr = imagedatastart , x_ptr = 0; i < height; ++i) {
// qDebug("inval:%x palm_ptr:%x x_ptr:%x bpr:%x", inval, palm_ptr, x_ptr, bytes_per_row);
/* first, uncompress the Palm image */
if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_RLE)) {
for (j = 0; j < bytes_per_row; ) {
incount = *palm_ptr++;
inval = *palm_ptr++;
memset(rowbuf + j, inval, incount);
j += incount;
}
} else if ((flags & PALM_IS_COMPRESSED_FLAG) && (compression_type == PALM_COMPRESSION_SCANLINE)) {
for (j = 0; j < bytes_per_row; j += 8) {
incount = *palm_ptr++;
inval = ((bytes_per_row - j) < 8) ? (bytes_per_row - j) : 8;
for (inbit = 0; inbit < inval; inbit += 1) {
if (incount & (1 << (7 - inbit)))
rowbuf[j + inbit] = *palm_ptr++;
else
rowbuf[j + inbit] = lastrow[j + inbit];
}
}
memcpy (lastrow, rowbuf, bytes_per_row);
} else if (((flags & PALM_IS_COMPRESSED_FLAG) &&
(compression_type == PALM_COMPRESSION_NONE)) ||
((flags & PALM_IS_COMPRESSED_FLAG) == 0))
{
memcpy (rowbuf, palm_ptr, bytes_per_row);
palm_ptr += bytes_per_row;
}
else {
qDebug("Case 4");
qDebug("Is compressed:%s", ((flags & PALM_IS_COMPRESSED_FLAG) == 0) ? "false" : "true");
qDebug("Has colourmap:%s", ((flags & PALM_HAS_COLORMAP_FLAG) == 0) ? "false" : "true");
qDebug("Has transparency:%s", ((flags & PALM_HAS_TRANSPARENCY_FLAG) == 0) ? "false" : "true");
qDebug("Direct colour:%s", ((flags & PALM_DIRECT_COLOR_FLAG) == 0) ? "false" : "true");
qDebug("four byte field:%s", ((flags & PALM_4_BYTE_FIELD_FLAG) == 0) ? "false" : "true");
memcpy (rowbuf, palm_ptr, bytes_per_row);
palm_ptr += bytes_per_row;
}
/* next, write it to the GDK bitmap */
if (colormap) {
mask = (1 << bits_per_pixel) - 1;
for (inbit = 8 - bits_per_pixel, inbyte = rowbuf, j = 0; j < width; ++j) {
inval = ((*inbyte) & (mask << inbit)) >> inbit;
/* correct for oddity of the 8-bit color Palm pixmap... */
if ((bits_per_pixel == 8) && (inval == 0xFF)) inval = 231;
/* now lookup the correct color and set the pixel in the GTK bitmap */
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()
*/
}
void QTReader::setDoubleBuffer(bool _b)
{
m_doubleBuffered = _b;
if (_b || m_rotated)
{
if (dbuff == NULL)
{
dbuff = new QPixmap();
dbp = new QPainter();
}
if (m_rotated)
{
dbuff->resize(height(), width());
}
else
{
dbuff->resize(width(), height());
}
m_outofdate = true;
}
else
{
if (dbuff != NULL)
{
delete dbuff;
delete dbp;
}
dbuff = NULL;
dbp = NULL;
}
}
void QTReader::setTwoTouch(bool _b)
{
setBackgroundColor( m_bg );
m_twotouch = m_touchone = _b;
}
void QTReader::setContinuous(bool _b)
{
buffdoc.setContinuous(m_continuousDocument = _b);
}
void QTReader::processmousewordevent(size_t startpos, size_t startoffset, QMouseEvent* _e, int lineno)
{
- unsigned long wrdstart, wrdend;
+ unsigned long wrdstart = 0, wrdend = 0;
QString wrd;
int availht = ((m_rotated) ? width() : height()) - m_topmargin - m_bottommargin;
if (m_twotouch)
{
if (m_touchone)
{
m_touchone = false;
m_startpos = startpos;
m_startoffset = startoffset;
setBackgroundColor( lightGray );
}
else
{
m_touchone = true;
setBackgroundColor( m_bg );
size_t endpos, endoffset;
endpos = startpos;
endoffset = startoffset;
size_t currentpos = locate();
if (endpos >= m_startpos)
{
jumpto(m_startpos);
for (int i = 0; i < m_startoffset; i++)
{
getch();
}
wrdstart = buffdoc.explocate();
if (m_startpos == endpos)
{
for (int i = m_startoffset; i <= endoffset; i++)
{
wrd += QChar(getch());
}
}
else
{
while (buffdoc.explocate() <= endpos)
{
wrd += QChar(getch());
}
for (int i = 0; i < endoffset; i++)
{
wrd += QChar(getch());
}
}
wrdend = buffdoc.explocate();
jumpto(currentpos);
}
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)
{
return jmin;
}
gotorecordnumber(jmax);
GetHeader(thishdr_uid, thishdr_nParagraphs, thishdr_size, thishdr_type, thishdr_reserved);
luid = thishdr_uid;
//qDebug("jmax at end:%u,%u", jmax, luid);
if (luid == urlid)
{
return jmax;
}
//qDebug("Couldn't find %u", urlid);
return 0; // Not found!
}
#include <qnamespace.h>
void CPlucker_base::setSaveData(unsigned char*& data, unsigned short& len, unsigned char* src, unsigned short srclen)
{
unsigned short sz = 0;
for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
{
sz++;
}
size_t newlen = srclen+sizeof(sz)+sz*sizeof(unsigned long);
unsigned char* newdata = new unsigned char[newlen];
unsigned char* pdata = newdata;
memcpy(newdata, src, srclen);
newdata += srclen;
memcpy(newdata, &sz, sizeof(sz));
newdata += sizeof(sz);
#ifdef _WINDOWS
for (it = visited.begin(); it != visited.end(); it++)
#else
for (CList<unsigned long>::iterator it = visited.begin(); it != visited.end(); it++)
#endif
{
unsigned long t = *it;
// qDebug("[%u]", t);
memcpy(newdata, &t, sizeof(t));
newdata += sizeof(t);
}
m_nav.setSaveData(data, len, pdata, newlen);
delete [] pdata;
}
void CPlucker_base::putSaveData(unsigned char*& src, unsigned short& srclen)
{
- unsigned short sz;
+ unsigned short sz = 0;
if (srclen >= sizeof(sz))
{
memcpy(&sz, src, sizeof(sz));
src += sizeof(sz);
srclen -= sizeof(sz);
}
for (int i = 0; i < sz; i++)
{
unsigned long t;
if (srclen >= sizeof(t))
{
memcpy(&t, src, sizeof(t));
// qDebug("[%u]", t);
visited.push_front(t);
src += sizeof(t);
srclen -= sizeof(t);
}
else
{
QMessageBox::warning(NULL, PROGNAME, "File data mismatch\nMight fix itself");
break;
}
}
m_nav.putSaveData(src, srclen);
}
int CPlucker_base::OpenFile(const char *src)
{
qDebug("plucker openfile:%s", src);
m_lastBreak = 0;
if (!Cpdb::openpdbfile(src))
{
return -1;
}
if (!CorrectDecoder()) return -1;
gotorecordnumber(0);
fread(&hdr0, 1, 6, fin);
qDebug("Compression type:%u", ntohs(hdr0.version));
switch (ntohs(hdr0.version))
{
case 2:
m_decompress = UnZip;
break;
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)
unsigned long pos;
if (ch == ' ') ch = skip_ws();
if (ch == '=')
{
ch = skip_ws();
if (ch == '"')
{
mygetch(ch, sty, pos);
ref = getname(ch, "\"");
ch = skip_ws();
}
else if (ch == '\'')
{
mygetch(ch, sty, pos);
ref = getname(ch, "\'");
ch = skip_ws();
}
else
{
ref = getname(ch, " >");
if (ch == ' ') ch = skip_ws();
}
}
return ref;
}
linkType striphtml::hyperlink(unsigned int n, unsigned int, QString& w, QString& nm)
{
#if defined(USEQPE) || defined(_WINDOWS)
QMap<unsigned long, QString>::Iterator hrefit = id2href->find(n);
#else
QMap<unsigned long, QString>::iterator hrefit = id2href->find(n);
#endif
if (hrefit == id2href->end())
{
return eNone;
}
QString href = *hrefit;
#if defined(USEQPE) || defined(_WINDOWS)
QMap<QString, unsigned long>::Iterator fpit = href2filepos->find(href);
#else
QMap<QString, unsigned long>::iterator fpit = href2filepos->find(href);
#endif
if (fpit == href2filepos->end())
{
if (href == "history.back()")
{
QString fc = currentfile;
- unsigned long loc;
+ unsigned long loc = 0;
htmlmark m(fc, loc);
linkType ret = (m_nav.back(m)) ? eFile : eNone;
if (fc == m.filename())
{
if ((ret & eFile) != 0)
{
locate(m.posn());
return eLink;
}
}
return eNone;
}
qDebug("Searching for %s", (const char*)href);
QString file, name;
int colon = href.find('#');
if (colon >= 0)
{
file = dehtml(href.left(colon));
name = dehtml(href.right(href.length()-colon-1));
}
else
{
file = dehtml(href);
}
qDebug("File:%s", (const char*)file);
qDebug("Name:%s", (const char*)name);
if (file.isEmpty())
{
if (parent->findanchor(name))
{
reset();
return eLink;
}
fpit = href2filepos->find(name);
if (fpit != href2filepos->end())
{
locate(*fpit);
return eLink;
}
else
{
// nm = QString("<a[^>]*name[ \t]*=[ \t]*\"") + name + "\"";