summaryrefslogtreecommitdiff
path: root/src/modules/common/rawstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/common/rawstr.cpp')
-rw-r--r--src/modules/common/rawstr.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/modules/common/rawstr.cpp b/src/modules/common/rawstr.cpp
index 6f17628..788ab6e 100644
--- a/src/modules/common/rawstr.cpp
+++ b/src/modules/common/rawstr.cpp
@@ -1,11 +1,13 @@
/******************************************************************************
- * rawstr.cpp - code for class 'RawStr'- a module that reads raw text
- * files: ot and nt using indexs ??.bks ??.cps ??.vss
- * and provides lookup and parsing functions based on
- * class StrKey
*
+ * rawstr.cpp - code for class 'RawStr'- a module that reads raw text
+ * files: ot and nt using indexs ??.bks ??.cps ??.vss
+ * and provides lookup and parsing functions based on
+ * class StrKey
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * $Id: rawstr.cpp 2833 2013-06-29 06:40:28Z chrislit $
+ *
+ * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -54,7 +56,7 @@ const int RawStr::IDXENTRYSIZE = 6;
* (e.g. 'modules/texts/rawtext/webster/')
*/
-RawStr::RawStr(const char *ipath, int fileMode)
+RawStr::RawStr(const char *ipath, int fileMode, bool caseSensitive) : caseSensitive(caseSensitive)
{
SWBuf buf;
@@ -121,7 +123,7 @@ void RawStr::getIDXBufDat(long ioffset, char **buf) const
datfd->read(*buf, size);
}
(*buf)[size] = 0;
- toupperstr_utf8(*buf, size*2);
+ if (!caseSensitive) toupperstr_utf8(*buf, size*2);
}
else {
*buf = (*buf) ? (char *)realloc(*buf, 1) : (char *)malloc(1);
@@ -181,7 +183,7 @@ signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long
headoff = 0;
stdstr(&key, ikey, 3);
- toupperstr_utf8(key, strlen(key)*3);
+ if (!caseSensitive) toupperstr_utf8(key, strlen(key)*3);
int keylen = strlen(key);
bool substr = false;
@@ -302,7 +304,7 @@ signed char RawStr::findOffset(const char *ikey, __u32 *start, __u16 *size, long
*
*/
-void RawStr::readText(__u32 istart, __u16 *isize, char **idxbuf, SWBuf &buf)
+void RawStr::readText(__u32 istart, __u16 *isize, char **idxbuf, SWBuf &buf) const
{
unsigned int ch;
char *idxbuflocal = 0;
@@ -380,7 +382,7 @@ void RawStr::doSetText(const char *ikey, const char *buf, long len)
char errorStatus = findOffset(ikey, &start, &size, 0, &idxoff);
stdstr(&key, ikey, 2);
- toupperstr_utf8(key, strlen(key)*2);
+ if (!caseSensitive) toupperstr_utf8(key, strlen(key)*2);
len = (len < 0) ? strlen(buf) : len;