[sword-cvs] sword/src/modules/common rawstr.cpp,1.37,1.38 rawstr4.cpp,1.19,1.20 zstr.cpp,1.18,1.19

sword@www.crosswire.org sword@www.crosswire.org
Sun, 22 Jun 2003 16:50:25 -0700


Update of /usr/local/cvsroot/sword/src/modules/common
In directory www:/tmp/cvs-serv6574/src/modules/common

Modified Files:
	rawstr.cpp rawstr4.cpp zstr.cpp 
Log Message:
RTF SelText bug fixes with added SetTextWide function
Memory leak in zstr flushCache fixed
empty popups supressed

Index: rawstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawstr.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** rawstr.cpp	26 Feb 2003 03:23:44 -0000	1.37
--- rawstr.cpp	22 Jun 2003 23:50:23 -0000	1.38
***************
*** 113,117 ****
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf);
  	}
  	else {
--- 113,117 ----
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf, size*2);
  	}
  	else {
***************
*** 143,147 ****
  
  		getIDXBufDat(offset, buf);
- 		toupperstr_utf8(*buf);
  	}
  }
--- 143,146 ----
***************
*** 162,166 ****
  signed char RawStr::findOffset(const char *ikey, long *start, unsigned short *size, long away, long *idxoff)
  {
! 	char *trybuf, *targetbuf, *key, quitflag = 0;
  	signed char retval = -1;
  	long headoff, tailoff, tryoff = 0, maxoff = 0;
--- 161,165 ----
  signed char RawStr::findOffset(const char *ikey, long *start, unsigned short *size, long away, long *idxoff)
  {
! 	char *trybuf, *targetbuf, *key = 0, quitflag = 0;
  	signed char retval = -1;
  	long headoff, tailoff, tryoff = 0, maxoff = 0;
***************
*** 172,178 ****
  			headoff = 0;
  
! 			key = new char [ (strlen(ikey)*2) + 10 ]; // just in case toupper needs a few extra
! 			strcpy(key, ikey);
! 			toupperstr_utf8(key);
  
  			trybuf = 0;
--- 171,176 ----
  			headoff = 0;
  
! 			stdstr(&key, ikey, 3);
! 			toupperstr_utf8(key, strlen(key)*3);
  
  			trybuf = 0;
***************
*** 409,414 ****
  
  	char errorStatus = findOffset(ikey, &start, &size, 0, &idxoff);
! 	stdstr(&key, ikey);
! 	toupperstr_utf8(key);
  
  	len = (len < 0) ? strlen(buf) : len;
--- 407,412 ----
  
  	char errorStatus = findOffset(ikey, &start, &size, 0, &idxoff);
! 	stdstr(&key, ikey, 2);
! 	toupperstr_utf8(key, strlen(key)*2);
  
  	len = (len < 0) ? strlen(buf) : len;

Index: rawstr4.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/rawstr4.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rawstr4.cpp	27 Feb 2003 07:39:37 -0000	1.19
--- rawstr4.cpp	22 Jun 2003 23:50:23 -0000	1.20
***************
*** 111,115 ****
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf);
  	}
  	else {
--- 111,115 ----
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf, size*2);
  	}
  	else {
***************
*** 141,144 ****
--- 141,146 ----
  
  		getIDXBufDat(offset, buf);
+ 		
+ /* What the heck is this supposed to do??????
  		for (trybuf = targetbuf = *buf; *trybuf; trybuf++, targetbuf++) {
  			*targetbuf = *trybuf;
***************
*** 147,150 ****
--- 149,153 ----
  		trybuf = 0;
  		toupperstr_utf8(targetbuf);
+ */
  	}
  }
***************
*** 165,169 ****
  signed char RawStr4::findOffset(const char *ikey, long *start, unsigned long *size, long away, long *idxoff)
  {
! 	char *trybuf, *targetbuf, *key, quitflag = 0;
  	signed char retval = -1;
  	long headoff, tailoff, tryoff = 0, maxoff = 0;
--- 168,172 ----
  signed char RawStr4::findOffset(const char *ikey, long *start, unsigned long *size, long away, long *idxoff)
  {
! 	char *trybuf, *targetbuf, *key = 0, quitflag = 0;
  	signed char retval = -1;
  	long headoff, tailoff, tryoff = 0, maxoff = 0;
***************
*** 175,181 ****
  			headoff = 0;
  
! 			key = new char [ strlen(ikey) + 1 ];
! 			strcpy(key, ikey);
! 			toupperstr_utf8(key);
  
  			trybuf = 0;
--- 178,183 ----
  			headoff = 0;
  
! 			stdstr(&key, ikey, 3);
! 			toupperstr_utf8(key, strlen(key)*3);
  
  			trybuf = 0;
***************
*** 412,417 ****
  
  	char errorStatus = findOffset(ikey, &start, &size, 0, &idxoff);
! 	stdstr(&key, ikey);
! 	toupperstr_utf8(key);
  
  	len = (len < 0) ? strlen(buf) : len;
--- 414,419 ----
  
  	char errorStatus = findOffset(ikey, &start, &size, 0, &idxoff);
! 	stdstr(&key, ikey, 3);
! 	toupperstr_utf8(key, strlen(key)*3);
  
  	len = (len < 0) ? strlen(buf) : len;

Index: zstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/common/zstr.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** zstr.cpp	27 Feb 2003 07:39:37 -0000	1.18
--- zstr.cpp	22 Jun 2003 23:50:23 -0000	1.19
***************
*** 133,137 ****
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf);
  	}
  	else {
--- 133,137 ----
  		}
  		(*buf)[size] = 0;
! 		toupperstr_utf8(*buf, size*2);
  	}
  	else {
***************
*** 185,190 ****
  		if (*ikey) {
  			headoff = 0;
! 			stdstr(&key, ikey);
! 			toupperstr_utf8(key);
  
  			while (headoff < tailoff) {
--- 185,190 ----
  		if (*ikey) {
  			headoff = 0;
! 			stdstr(&key, ikey, 3);
! 			toupperstr_utf8(key, strlen(key)*3);
  
  			while (headoff < tailoff) {
***************
*** 469,474 ****
  
  	len = (len < 0) ? strlen(buf) : len;
! 	stdstr(&key, ikey);
! 	toupperstr_utf8(key);
  
  	char notFound = findKeyIndex(ikey, &idxoff, 0);
--- 469,474 ----
  
  	len = (len < 0) ? strlen(buf) : len;
! 	stdstr(&key, ikey, 3);
! 	toupperstr_utf8(key, strlen(key)*3);
  
  	char notFound = findKeyIndex(ikey, &idxoff, 0);
***************
*** 659,668 ****
  			write(zdxfd->getFd(), &outstart, sizeof(__u32));
  			write(zdxfd->getFd(), &outsize, sizeof(__u32));
- 
- 			delete cacheBlock;
  		}
  	}
  	cacheBlockIndex = -1;
- 	cacheBlock = 0;
  	cacheDirty = false;
  }
--- 659,667 ----
  			write(zdxfd->getFd(), &outstart, sizeof(__u32));
  			write(zdxfd->getFd(), &outsize, sizeof(__u32));
  		}
+ 		delete cacheBlock;
+ 		cacheBlock = 0;
  	}
  	cacheBlockIndex = -1;
  	cacheDirty = false;
  }