1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Ensure that all object labels for individual objects generated by

randomjson.c are unique.

FossilOrigin-Name: 29c46aca231b3f1e997ef306a5a651408185bf3ad09ab9fc1fe21ed18caa4d02
This commit is contained in:
drh
2023-12-18 14:16:58 +00:00
parent 52a4691fff
commit 0a46ff995b
3 changed files with 13 additions and 10 deletions

View File

@ -108,10 +108,9 @@ static char *azJsonTemplate[] = {
"{\"a\":%,\"b\":%,\"c\":%,\"d\":%,\"\":%}", "{a:%,b:%,c:%,d:%,'':%}",
"{\"d\":%}", "{d:%}",
"{\"eeee\":%, \"ffff\":%}", "{eeee:% /*and*/, ffff:%}",
"{\"$g\":%,\"_h_\":%}", "{$g:%,_h_:%,}",
"{\"$g\":%,\"_h_\":%,\"a b c d\":%}", "{$g:%,_h_:%,\"a b c d\":%}",
"{\"x\":%,\n \"y\":%}", "{\"x\":%,\n \"y\":%}",
"{\"a b c d\":%,\"\\u00XX\":%,\"\\uXXXX\":%,\"x\":%,\"y\":%}",
"{\"a b c d\":%,\"\\xXX\":%,\"\\uXXXX\":%,x:%,y:%}",
"{\"\\u00XX\":%,\"\\uXXXX\":%}", "{\"\\xXX\":%,\"\\uXXXX\":%}",
"{\"Z\":%}", "{Z:%,}",
"[%]", "[%,]",
"[%,%]", "[%,%]",
@ -159,6 +158,10 @@ static void jsonExpand(
n = strlen(z);
if( (zX = strstr(z,"XX"))!=0 ){
unsigned int r = prngInt(p);
if( (r&0xff)==((r>>8)&0xff) ) r += 0x100;
while( (r&0xff)==((r>>16)&0xff) || ((r>>8)&0xff)==((r>>16)&0xff) ){
r += 0x10000;
}
memcpy(zBuf, z, n+1);
z = zBuf;
zX = strstr(z,"XX");