mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-09 14:21:03 +03:00
All legacy tests are passing.
FossilOrigin-Name: 2c436806b8d5f57de99c00f6154b038454fb9ae427d00d7b4a46ab9c7c69bcb9
This commit is contained in:
18
src/json.c
18
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user