[sword-cvs] sword/src/utilfuns Greek2Greek.cpp,1.2,1.3 roman.cpp,1.2,1.3 swbuf.cpp,1.9,1.10 swversion.cpp,1.4,1.5 utilconf.cpp,1.2,1.3 utilstr.cpp,1.23,1.24 utilweb.cpp,1.5,1.6

sword@www.crosswire.org sword@www.crosswire.org
Thu, 26 Jun 2003 18:41:11 -0700


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

Modified Files:
	Greek2Greek.cpp roman.cpp swbuf.cpp swversion.cpp utilconf.cpp 
	utilstr.cpp utilweb.cpp 
Log Message:
no message

Index: Greek2Greek.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/Greek2Greek.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Greek2Greek.cpp	1 Oct 2002 19:52:41 -0000	1.2
--- Greek2Greek.cpp	27 Jun 2003 01:41:08 -0000	1.3
***************
*** 23,28 ****
  
  #include <stdio.h>
- #include <string.h>
  #include <ctype.h>
  
  #include "Greek2Greek.h"
--- 23,28 ----
  
  #include <stdio.h>
  #include <ctype.h>
+ #include <string.h>
  
  #include "Greek2Greek.h"

Index: roman.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/roman.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** roman.cpp	1 Oct 2002 19:52:41 -0000	1.2
--- roman.cpp	27 Jun 2003 01:41:08 -0000	1.3
***************
*** 28,33 ****
  char isroman (const char* str) {
  	char * ch = (char*)str;
! 		for (; *ch; ch++)
! 		if (!strchr ("IVXLCDMivxlcdm ", *ch))
  			return 0;
  	return 1;
--- 28,33 ----
  char isroman (const char* str) {
  	char * ch = (char*)str;
! 	for (; *ch; ch++)
! 		if (!strchr("IVXLCDMivxlcdm ", *ch))
  			return 0;
  	return 1;

Index: swbuf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swbuf.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** swbuf.cpp	26 Jun 2003 04:33:31 -0000	1.9
--- swbuf.cpp	27 Jun 2003 01:41:08 -0000	1.10
***************
*** 22,26 ****
  #include <swbuf.h>
  
- #include <string.h>
  #include <stdlib.h>
  #include <stdarg.h>
--- 22,25 ----
***************
*** 109,131 ****
  }
  
  /******************************************************************************
  * SWBuf::append - appends a value to the current value of this SWBuf
  */
! void SWBuf::append(const char *str) {
  	unsigned int len = strlen(str) + 1;
  	assureSize((end-buf)+len);
! 	memcpy(end, str, len);
  	end += (len-1);
  }
  
- /******************************************************************************
- * SWBuf::append - appends a value to the current value of this SWBuf
- */
- void SWBuf::append(const SWBuf &str) {
- 	unsigned int len = str.length() + 1;
- 	assureSize((end-buf)+len);
- 	memcpy(end, str.c_str(), len);
- 	end += (len-1);
- }
  
  /******************************************************************************
--- 108,125 ----
  }
  
+ 
  /******************************************************************************
  * SWBuf::append - appends a value to the current value of this SWBuf
  */
! void SWBuf::append(const char *str, int max) {
  	unsigned int len = strlen(str) + 1;
+ 	if ((max > -1) && (len > max + 1))
+ 		len = max + 1;
  	assureSize((end-buf)+len);
! 	memcpy(end, str, len-1);
  	end += (len-1);
+ 	*end = 0;
  }
  
  
  /******************************************************************************

Index: swversion.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/swversion.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** swversion.cpp	1 Oct 2002 19:52:41 -0000	1.4
--- swversion.cpp	27 Jun 2003 01:41:08 -0000	1.5
***************
*** 1,6 ****
  #include <swversion.h>
- #include <string.h>
  #include <stdio.h>
  #include <stdlib.h>
  
  SWORD_NAMESPACE_START
--- 1,6 ----
  #include <swversion.h>
  #include <stdio.h>
  #include <stdlib.h>
+ #include <string.h>
  
  SWORD_NAMESPACE_START

Index: utilconf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/utilconf.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** utilconf.cpp	1 Oct 2002 19:52:41 -0000	1.2
--- utilconf.cpp	27 Jun 2003 01:41:08 -0000	1.3
***************
*** 1,3 ****
- #include <string.h>
  #include <utilstr.h>
  
--- 1,2 ----

Index: utilstr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/utilstr.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** utilstr.cpp	22 Jun 2003 23:50:23 -0000	1.23
--- utilstr.cpp	27 Jun 2003 01:41:08 -0000	1.24
***************
*** 1,3 ****
- #include <string.h>
  #include <utilstr.h>
  #include <ctype.h>
--- 1,2 ----
***************
*** 11,14 ****
--- 10,14 ----
  #include <unicode/unistr.h>
  #include <unicode/translit.h>
+ #include <string.h>
  
  #endif

Index: utilweb.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/utilfuns/utilweb.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** utilweb.cpp	9 Jun 2003 07:13:46 -0000	1.5
--- utilweb.cpp	27 Jun 2003 01:41:08 -0000	1.6
***************
*** 1,15 ****
  #include <utilxml.h>
  #include <stdio.h>
- #include <string>
  #include <map>
  
  SWORD_NAMESPACE_START
  
- using std::string;
  using std::map;
  
! typedef map<unsigned char,string> DataMap;
  
! const std::string encodeURL( const std::string& url ) {
      	DataMap m;
  	for (unsigned short int c = 32; c <= 255; ++c) { //first set all encoding chars
--- 1,13 ----
  #include <utilxml.h>
  #include <stdio.h>
  #include <map>
  
  SWORD_NAMESPACE_START
  
  using std::map;
  
! typedef map<unsigned char,SWBuf> DataMap;
  
! const SWBuf encodeURL( const SWBuf& url ) {
      	DataMap m;
  	for (unsigned short int c = 32; c <= 255; ++c) { //first set all encoding chars
***************
*** 20,33 ****
  			char s[5];
  			sprintf(s, "%-.2X", c); //left-aligned, 2 digits, uppercase hex
! 			m[c] = string("%") + s; //encoded char is "% + 2 digit hex code of char"
  	}
  	//the special encodings for certain chars
  	m[' '] = '+';
  
! 	string buf;
  	const int length = url.length();
  	for (int i = 0; i <= length; i++) { //fill "buf"
  		const char& c = url[i];
! 		buf += m[c].empty() ? string(1,c) : m[c];
  	}
  
--- 18,31 ----
  			char s[5];
  			sprintf(s, "%-.2X", c); //left-aligned, 2 digits, uppercase hex
! 			m[c] = SWBuf("%") + s; //encoded char is "% + 2 digit hex code of char"
  	}
  	//the special encodings for certain chars
  	m[' '] = '+';
  
! 	SWBuf buf;
  	const int length = url.length();
  	for (int i = 0; i <= length; i++) { //fill "buf"
  		const char& c = url[i];
! 		buf += (!m[c].length()) ? (SWBuf)c : (SWBuf)m[c];
  	}