[sword-cvs] sword/src/utilfuns url.cpp,1.10,1.11

sword at www.crosswire.org sword at www.crosswire.org
Tue Jul 20 23:52:50 MST 2004


Committed by: joachim

Update of /cvs/core/sword/src/utilfuns
In directory www:/tmp/cvs-serv9718/src/utilfuns

Modified Files:
	url.cpp 
Log Message:
minor bug fixes

Index: url.cpp
===================================================================
RCS file: /cvs/core/sword/src/utilfuns/url.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- url.cpp	20 Jul 2004 22:48:33 -0000	1.10
+++ url.cpp	21 Jul 2004 06:52:47 -0000	1.11
@@ -199,7 +199,7 @@
 }
 
 const SWBuf URL::encode(const char *urlText) {
-	static SWBuf url;
+	/*static*/ SWBuf url;
 	url = urlText;
 	
 	typedef std::map< unsigned char, SWBuf > DataMap;
@@ -209,18 +209,18 @@
 				continue; //we don't need an encoding for this char
 			}
 
-			char s[5];
 			SWBuf buf;
 			buf.setFormatted("%%-.2X", c);
+			m[c] = buf;
 	}
 	//the special encodings for certain chars
 	m[' '] = '+';
 
 	SWBuf buf;
 	const int length = url.length();
-	for (int i = 0; i <= length; i++) { //fill "buf"
+	for (int i = 0; i < length; i++) { //fill "buf"
 		const char& c = url[i];
-		buf += (!m[c].length()) ? (SWBuf)c : (SWBuf)m[c];
+		buf.append( m[c].length() ? m[c] : SWBuf(c) );
 	}
 
 	url = buf;
@@ -228,7 +228,7 @@
 }
 
 const SWBuf URL::decode(const char *encoded) {
-	static SWBuf text;
+	/*static*/ SWBuf text;
 	text = encoded;	
 
 	SWBuf decoded;	



More information about the sword-cvs mailing list