equal
deleted
inserted
replaced
232 KURL::KURL(const char *url) |
232 KURL::KURL(const char *url) |
233 { |
233 { |
234 if (url && url[0] == '/') { |
234 if (url && url[0] == '/') { |
235 // 5 for "file:", 1 for terminator |
235 // 5 for "file:", 1 for terminator |
236 size_t urlLength = strlen(url) + 1; |
236 size_t urlLength = strlen(url) + 1; |
|
237 #if PLATFORM(SYMBIAN) |
|
238 Vector<char, 256> buffer(urlLength + 5); |
|
239 #else |
237 Vector<char, 2048> buffer(urlLength + 5); |
240 Vector<char, 2048> buffer(urlLength + 5); |
|
241 #endif |
238 buffer[0] = 'f'; |
242 buffer[0] = 'f'; |
239 buffer[1] = 'i'; |
243 buffer[1] = 'i'; |
240 buffer[2] = 'l'; |
244 buffer[2] = 'l'; |
241 buffer[3] = 'e'; |
245 buffer[3] = 'e'; |
242 buffer[4] = ':'; |
246 buffer[4] = ':'; |
248 |
252 |
249 KURL::KURL(const DeprecatedString &url) |
253 KURL::KURL(const DeprecatedString &url) |
250 { |
254 { |
251 if (!url.isEmpty() && url[0] == '/') { |
255 if (!url.isEmpty() && url[0] == '/') { |
252 // 5 for "file:", 1 for terminator |
256 // 5 for "file:", 1 for terminator |
|
257 #if PLATFORM(SYMBIAN) |
|
258 Vector<char, 256> buffer(url.length() + 6); |
|
259 #else |
253 Vector<char, 2048> buffer(url.length() + 6); |
260 Vector<char, 2048> buffer(url.length() + 6); |
|
261 #endif |
254 buffer[0] = 'f'; |
262 buffer[0] = 'f'; |
255 buffer[1] = 'i'; |
263 buffer[1] = 'i'; |
256 buffer[2] = 'l'; |
264 buffer[2] = 'l'; |
257 buffer[3] = 'e'; |
265 buffer[3] = 'e'; |
258 buffer[4] = ':'; |
266 buffer[4] = ':'; |
401 default: |
409 default: |
402 { |
410 { |
403 // must be relative-path reference |
411 // must be relative-path reference |
404 |
412 |
405 // Base part plus relative part plus one possible slash added in between plus terminating \0 byte. |
413 // Base part plus relative part plus one possible slash added in between plus terminating \0 byte. |
|
414 #if PLATFORM(SYMBIAN) |
|
415 Vector<char, 256> buffer(base.pathEndPos + 1 + strlen(str) + 1); |
|
416 #else |
406 Vector<char, 2048> buffer(base.pathEndPos + 1 + strlen(str) + 1); |
417 Vector<char, 2048> buffer(base.pathEndPos + 1 + strlen(str) + 1); |
|
418 #endif |
407 |
419 |
408 char *bufferPos = buffer.data(); |
420 char *bufferPos = buffer.data(); |
409 |
421 |
410 // first copy everything before the path from the base |
422 // first copy everything before the path from the base |
411 const char *baseString = base.urlString.ascii(); |
423 const char *baseString = base.urlString.ascii(); |
762 |
774 |
763 DeprecatedString KURL::decode_string(const DeprecatedString& urlString, const TextEncoding& encoding) |
775 DeprecatedString KURL::decode_string(const DeprecatedString& urlString, const TextEncoding& encoding) |
764 { |
776 { |
765 DeprecatedString result(""); |
777 DeprecatedString result(""); |
766 |
778 |
|
779 #if PLATFORM(SYMBIAN) |
|
780 Vector<char, 256> buffer(0); |
|
781 #else |
767 Vector<char, 2048> buffer(0); |
782 Vector<char, 2048> buffer(0); |
|
783 #endif |
768 |
784 |
769 int length = urlString.length(); |
785 int length = urlString.length(); |
770 int decodedPosition = 0; |
786 int decodedPosition = 0; |
771 int searchPosition = 0; |
787 int searchPosition = 0; |
772 int encodedRunPosition; |
788 int encodedRunPosition; |
1102 } |
1118 } |
1103 } |
1119 } |
1104 |
1120 |
1105 // assemble it all, remembering the real ranges |
1121 // assemble it all, remembering the real ranges |
1106 |
1122 |
|
1123 #if PLATFORM(SYMBIAN) |
|
1124 Vector<char, 256> buffer(fragmentEnd * 3 + 1); |
|
1125 #else |
1107 Vector<char, 4096> buffer(fragmentEnd * 3 + 1); |
1126 Vector<char, 4096> buffer(fragmentEnd * 3 + 1); |
|
1127 #endif |
1108 |
1128 |
1109 char *p = buffer.data(); |
1129 char *p = buffer.data(); |
1110 const char *strPtr = url; |
1130 const char *strPtr = url; |
1111 |
1131 |
1112 // copy in the scheme |
1132 // copy in the scheme |
1221 } |
1241 } |
1222 |
1242 |
1223 // add path, escaping bad characters |
1243 // add path, escaping bad characters |
1224 |
1244 |
1225 if (hierarchical && hasSlashDotOrDotDot(url)) { |
1245 if (hierarchical && hasSlashDotOrDotDot(url)) { |
|
1246 #if PLATFORM(SYMBIAN) |
|
1247 Vector<char, 256> path_buffer(pathEnd - pathStart + 1); |
|
1248 #else |
1226 Vector<char, 4096> path_buffer(pathEnd - pathStart + 1); |
1249 Vector<char, 4096> path_buffer(pathEnd - pathStart + 1); |
|
1250 #endif |
1227 copyPathRemovingDots(path_buffer.data(), url, pathStart, pathEnd); |
1251 copyPathRemovingDots(path_buffer.data(), url, pathStart, pathEnd); |
1228 appendEscapingBadChars(p, path_buffer.data(), strlen(path_buffer.data())); |
1252 appendEscapingBadChars(p, path_buffer.data(), strlen(path_buffer.data())); |
1229 } else |
1253 } else |
1230 appendEscapingBadChars(p, url + pathStart, pathEnd - pathStart); |
1254 appendEscapingBadChars(p, url + pathStart, pathEnd - pathStart); |
1231 |
1255 |
1266 |
1290 |
1267 DeprecatedString KURL::encode_string(const DeprecatedString& notEncodedString) |
1291 DeprecatedString KURL::encode_string(const DeprecatedString& notEncodedString) |
1268 { |
1292 { |
1269 DeprecatedCString asUTF8 = notEncodedString.utf8(); |
1293 DeprecatedCString asUTF8 = notEncodedString.utf8(); |
1270 |
1294 |
|
1295 #if PLATFORM(SYMBIAN) |
|
1296 Vector<char, 256> buffer(asUTF8.length() * 3 + 1); |
|
1297 #else |
1271 Vector<char, 4096> buffer(asUTF8.length() * 3 + 1); |
1298 Vector<char, 4096> buffer(asUTF8.length() * 3 + 1); |
|
1299 #endif |
1272 char *p = buffer.data(); |
1300 char *p = buffer.data(); |
1273 |
1301 |
1274 const char *str = asUTF8; |
1302 const char *str = asUTF8; |
1275 const char *strEnd = str + asUTF8.length(); |
1303 const char *strEnd = str + asUTF8.length(); |
1276 while (str < strEnd) { |
1304 while (str < strEnd) { |