diff --git a/manifest b/manifest index 3e1841dc0f..0d87ba4a36 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C The\sjson_patch()\scode\sfor\sJSONB\scompiles\sand\sworks\ssometimes,\sbut\sthere\sare\nstill\sissues.\s\sIncremental\scheck-in. -D 2023-11-28T12:28:28.510 +C All\slegacy\stests\sare\spassing. +D 2023-11-28T13:35:53.633 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -688,7 +688,7 @@ F src/hash.h 3340ab6e1d13e725571d7cee6d3e3135f0779a7d8e76a9ce0a85971fa3953c51 F src/hwtime.h f9c2dfb84dce7acf95ce6d289e46f5f9d3d1afd328e53da8f8e9008e3b3caae6 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 3f0a94082d978bbdd33c38fefea15346c6c6bffb70bc645a71dc0f1f87dd3276 -F src/json.c 2dfbca7572f686feea28665d524a34cdde23cf3dcb15cfa79cabe77f8032524f +F src/json.c fa3a1b6f2432848dc03448d359a07040f7e4a44d868e9e16512c6066b65aeef9 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 7432c944ff197046d67a1207790a1b13eec4548c85a9457eb0896bb3641dfb36 F src/main.c 1b89f3de98d1b59fec5bac1d66d6ece21f703821b8eaa0d53d9604c35309f6f9 @@ -2145,11 +2145,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P fbca9570fd2e1465739e4d3a8d9bb40fad594fd78ab49b2cb34efa27ebdd8361 -R 74a90e7c3058a227c8ae29f97ecb7181 -T *branch * jsonb-patch -T *sym-jsonb-patch * -T -sym-jsonb * +P e0099464a0045a04f4ccf29bc2b8325fc8c7f39ccf4847e74818f928c9153588 +R e5b38e7d70999e4556fdfbbe91a82c08 U drh -Z 73c44f2da8d785efd9b8e3ab2061af48 +Z 686f56079312574c393270803643d299 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 477eefc522..7c28bb5a17 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0099464a0045a04f4ccf29bc2b8325fc8c7f39ccf4847e74818f928c9153588 \ No newline at end of file +2c436806b8d5f57de99c00f6154b038454fb9ae427d00d7b4a46ab9c7c69bcb9 \ No newline at end of file diff --git a/src/json.c b/src/json.c index 6f5021aafe..bdc9087323 100644 --- a/src/json.c +++ b/src/json.c @@ -5177,24 +5177,32 @@ static int jsonMergePatchBlob( if( pTarget->oom ) return JSON_MERGE_OOM; }else{ /* Algorithm line 12 */ - int rc = jsonMergePatchBlob(pTarget, iTValue, pPatch, iPValue); + int rc, savedDelta = pTarget->delta; + pTarget->delta = 0; + rc = jsonMergePatchBlob(pTarget, iTValue, pPatch, iPValue); if( rc ) return rc; + pTarget->delta += savedDelta; } }else if( x>0 ){ /* Algorithm line 13 */ /* No match and patch value is not NULL */ + u32 szNew = szPLabel+nPLabel; if( (pPatch->aBlob[iPValue] & 0x0f)!=JSONB_OBJECT ){ /* Line 14 */ - jsonBlobEdit(pTarget, iTEnd, 0, - pPatch->aBlob+iPValue, szPValue+nPValue); + jsonBlobEdit(pTarget, iTEnd, 0, 0, szPValue+nPValue+szNew); if( pTarget->oom ) return JSON_MERGE_OOM; + memcpy(&pTarget->aBlob[iTEnd], &pPatch->aBlob[iPLabel], szNew); + memcpy(&pTarget->aBlob[iTEnd+szNew], + &pPatch->aBlob[iPValue], szPValue+nPValue); }else{ - int rc; - u32 szNew = szPLabel+nPLabel; + int rc, savedDelta; jsonBlobEdit(pTarget, iTEnd, 0, 0, szNew+1); if( pTarget->oom ) return JSON_MERGE_OOM; memcpy(&pTarget->aBlob[iTEnd], &pPatch->aBlob[iPLabel], szNew); pTarget->aBlob[iTEnd+szNew] = 0x00; + savedDelta = pTarget->delta; + pTarget->delta = 0; rc = jsonMergePatchBlob(pTarget, iTEnd+szNew,pPatch,iPValue); if( rc ) return rc; + pTarget->delta += savedDelta; } } }