File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ namespace cage
226226 if (*pSrc == ' %' )
227227 {
228228 uint8 dec1, dec2;
229- if (- 1 != (dec1 = HEX2DEC[*(pSrc + 1 )]) && - 1 != (dec2 = HEX2DEC[*(pSrc + 2 )]))
229+ if (uint8 (- 1 ) != (dec1 = HEX2DEC[*(pSrc + 1 )]) && uint8 (- 1 ) != (dec2 = HEX2DEC[*(pSrc + 2 )]))
230230 {
231231 *pEnd++ = (dec1 << 4 ) + dec2;
232232 pSrc += 3 ;
Original file line number Diff line number Diff line change @@ -382,18 +382,23 @@ namespace
382382 }
383383 {
384384 CAGE_TESTCASE (" url encode and decode" );
385- CAGE_TEST (encodeUrl (String (" for (uint i = 0; i < sts.size (); i++)" )) == " for%20(uint%20i%20%3D%200%3B%20i%20%3C%20sts.size%20()%3B%20i++)" );
385+ {
386+ const String a = " for (uint i = 0; i < sts.size (); i++)" ;
387+ const String b = " for%20(uint%20i%20%3D%200%3B%20i%20%3C%20sts.size%20()%3B%20i++)" ;
388+ CAGE_TEST (encodeUrl (a) == b);
389+ CAGE_TEST (decodeUrl (b) == a);
390+ }
386391 for (uint32 i = 0 ; i < 1000 ; i++)
387392 {
388393 String s;
389- for (uint32 j = 0 , e = randomRange (0 , 100 ); j < e; j++)
390- {
391- char c = randomRange (0 , 255 );
392- s += Stringizer () + c;
393- }
394- String sen = encodeUrl (s);
395- String sde = decodeUrl (sen);
394+ s.rawLength () = randomRange (0 , 100 );
395+ for (uint32 j = 0 ; j < s.length (); j++)
396+ s.rawData ()[j] = (char )randomRange (0 , 255 );
397+ const String sen = encodeUrl (s);
398+ const String sde = decodeUrl (sen);
396399 CAGE_TEST (sde == s);
400+ const String corrupted = remove (sen, randomRange (0u , sen.length ()), 1 );
401+ decodeUrl (corrupted);
397402 }
398403 }
399404 }
You can’t perform that action at this time.
0 commit comments