author | zecke <zecke> | 2003-02-22 16:33:34 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-02-22 16:33:34 (UTC) |
commit | 2424bcd292444b3a03c9b92dbc7f5b392c355755 (patch) (unidiff) | |
tree | 7f909f39bce8ba8501d07dc6ff238ae7918fc8de /libopie/pim/otodoaccessxml.cpp | |
parent | 66b00525256255290dfcd9d48ebe1539f15b8dce (diff) | |
download | opie-2424bcd292444b3a03c9b92dbc7f5b392c355755.zip opie-2424bcd292444b3a03c9b92dbc7f5b392c355755.tar.gz opie-2424bcd292444b3a03c9b92dbc7f5b392c355755.tar.bz2 |
fixx off by one in reading
Diffstat (limited to 'libopie/pim/otodoaccessxml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie/pim/otodoaccessxml.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/libopie/pim/otodoaccessxml.cpp b/libopie/pim/otodoaccessxml.cpp index 22b2469..cda300b 100644 --- a/libopie/pim/otodoaccessxml.cpp +++ b/libopie/pim/otodoaccessxml.cpp | |||
@@ -19,2 +19,30 @@ | |||
19 | 19 | ||
20 | namespace { | ||
21 | // FROM TT again | ||
22 | char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen) | ||
23 | { | ||
24 | char needleChar; | ||
25 | char haystackChar; | ||
26 | if (!needle || !haystack || !hLen || !nLen) | ||
27 | return 0; | ||
28 | |||
29 | const char* hsearch = haystack; | ||
30 | |||
31 | if ((needleChar = *needle++) != 0) { | ||
32 | nLen--; //(to make up for needle++) | ||
33 | do { | ||
34 | do { | ||
35 | if ((haystackChar = *hsearch++) == 0) | ||
36 | return (0); | ||
37 | if (hsearch >= haystack + hLen) | ||
38 | return (0); | ||
39 | } while (haystackChar != needleChar); | ||
40 | } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); | ||
41 | hsearch--; | ||
42 | } | ||
43 | return ((char *)hsearch); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | |||
20 | OTodoAccessXML::OTodoAccessXML( const QString& appName, | 48 | OTodoAccessXML::OTodoAccessXML( const QString& appName, |
@@ -87,3 +115,3 @@ bool OTodoAccessXML::load() { | |||
87 | int strLen = strlen(collectionString); | 115 | int strLen = strlen(collectionString); |
88 | while ( dt+i != 0 && ( point = strstr( dt+i, collectionString ) ) != 0l ) { | 116 | while ( ( point = strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0l ) { |
89 | i = point -dt; | 117 | i = point -dt; |