summaryrefslogtreecommitdiff
path: root/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
Side-by-side diff
Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
index bc51996..24b69fe 100644
--- a/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/odatebookaccessbackend_xml.cpp
@@ -14,24 +14,51 @@
#include <qfile.h>
#include <qtopia/global.h>
#include <qtopia/stringutil.h>
#include <qtopia/timeconversion.h>
#include "opimnotifymanager.h"
#include "orecur.h"
#include "otimezone.h"
#include "odatebookaccessbackend_xml.h"
namespace {
+ // FROM TT again
+char *strstrlen(const char *haystack, int hLen, const char* needle, int nLen)
+{
+ char needleChar;
+ char haystackChar;
+ if (!needle || !haystack || !hLen || !nLen)
+ return 0;
+
+ const char* hsearch = haystack;
+
+ if ((needleChar = *needle++) != 0) {
+ nLen--; //(to make up for needle++)
+ do {
+ do {
+ if ((haystackChar = *hsearch++) == 0)
+ return (0);
+ if (hsearch >= haystack + hLen)
+ return (0);
+ } while (haystackChar != needleChar);
+ } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0);
+ hsearch--;
+ }
+ return ((char *)hsearch);
+}
+}
+
+namespace {
time_t start, end, created, rp_end;
ORecur* rec;
ORecur* recur() {
if (!rec)
rec = new ORecur;
return rec;
}
int alarmTime;
int snd;
enum Attribute{
FDescription = 0,
@@ -333,25 +360,25 @@ bool ODateBookAccessBackend_XML::loadFile() {
dict.insert( "recparent", new int(FRecParent) );
dict.insert( "recchildren", new int(FRecChildren) );
dict.insert( "exceptions", new int(FExceptions) );
dict.insert( "timezone", new int(FTimeZone) );
char* dt = (char*)map_addr;
int len = attribute.st_size;
int i = 0;
char* point;
const char* collectionString = "<event ";
int strLen = ::strlen(collectionString);
int *find;
- while ( dt + 1 != 0 && (( point = ::strstr( dt+i, collectionString ) ) != 0 ) ) {
+ while ( ( point = ::strstrlen( dt+i, len -i, collectionString, strLen ) ) != 0 ) {
i = point -dt;
i+= strLen;
alarmTime = -1;
snd = 0; // silent
OEvent ev;
rec = 0;
while ( TRUE ) {
while ( i < len && (dt[i] == ' ' || dt[i] == '\n' || dt[i] == '\r') )
++i;