[sword-cvs] sword/src/utilfuns utilstr.cpp,1.22,1.23

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


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

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

Index: utilstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/utilstr.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** utilstr.cpp	19 Jun 2003 16:58:30 -0000	1.22
--- utilstr.cpp	22 Jun 2003 23:50:23 -0000	1.23
***************
*** 26,35 ****
   */
  
! char *stdstr(char **ipstr, const char *istr) {
  	if (istr) {
  		if (*ipstr)
  			delete [] *ipstr;
  		int len = strlen(istr) + 1;
! 		*ipstr = new char [ len ];
  		memcpy(*ipstr, istr, len);
  	}
--- 26,35 ----
   */
  
! char *stdstr(char **ipstr, const char *istr, unsigned int memPadFactor) {
  	if (istr) {
  		if (*ipstr)
  			delete [] *ipstr;
  		int len = strlen(istr) + 1;
! 		*ipstr = new char [ len * memPadFactor ];
  		memcpy(*ipstr, istr, len);
  	}
***************
*** 174,178 ****
   */
  
! char *toupperstr_utf8(char *buf) {
  	char *ret = buf;
  
--- 174,178 ----
   */
  
! char *toupperstr_utf8(char *buf, unsigned int max) {
  	char *ret = buf;
  
***************
*** 189,197 ****
  	}
  #else
  		UErrorCode err = U_ZERO_ERROR;
  		UConverter *conv = ucnv_open("UTF-8", &err);
  		UnicodeString str(buf, -1, conv, err);
  		UnicodeString ustr = str.toUpper();
! 		ustr.extract(ret, strlen(ret)*2, conv, err);
  		ucnv_close(conv);
  #endif
--- 189,199 ----
  	}
  #else
+ 	if (!max)
+ 		max = strlen(ret);
  		UErrorCode err = U_ZERO_ERROR;
  		UConverter *conv = ucnv_open("UTF-8", &err);
  		UnicodeString str(buf, -1, conv, err);
  		UnicodeString ustr = str.toUpper();
! 		ustr.extract(ret, max, conv, err);
  		ucnv_close(conv);
  #endif