From 2424bcd292444b3a03c9b92dbc7f5b392c355755 Mon Sep 17 00:00:00 2001 From: zecke Date: Sat, 22 Feb 2003 16:33:34 +0000 Subject: fixx off by one in reading --- (limited to 'libopie') diff --git a/libopie/pim/odatebookaccessbackend_xml.cpp b/libopie/pim/odatebookaccessbackend_xml.cpp index bc51996..24b69fe 100644 --- a/libopie/pim/odatebookaccessbackend_xml.cpp +++ b/libopie/pim/odatebookaccessbackend_xml.cpp @@ -23,6 +23,33 @@ #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() { @@ -342,7 +369,7 @@ bool ODateBookAccessBackend_XML::loadFile() { const char* collectionString = "= haystack + hLen) + return (0); + } while (haystackChar != needleChar); + } while (strncmp(hsearch, needle, QMIN(hLen - (hsearch - haystack), nLen)) != 0); + hsearch--; + } + return ((char *)hsearch); +} +} + + OTodoAccessXML::OTodoAccessXML( const QString& appName, const QString& fileName ) : OTodoAccessBackend(), m_app( appName ), m_opened( false ), m_changed( false ) @@ -85,7 +113,7 @@ bool OTodoAccessXML::load() { char *point; const char* collectionString = "