Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Make sure manifest_crosslink() resets its input blob and that callers know this and do not attempt to reuse that blob. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
d22519e500b37a55a1dcb34a2bb95fbb |
| User & Date: | drh 2011-02-17 20:44:11.731 |
Context
|
2011-02-17
| ||
| 22:43 | Add a new contributor agreement that is based loosely on the Oracle CLA. ... (check-in: 252e83d952 user: drh tags: trunk) | |
| 20:44 | Make sure manifest_crosslink() resets its input blob and that callers know this and do not attempt to reuse that blob. ... (check-in: d22519e500 user: drh tags: trunk) | |
| 17:43 | Further clarification of the limitations on the copyright release. ... (check-in: 74aabf965f user: drh tags: trunk) | |
Changes
Changes to src/attach.c.
| ︙ | ︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
zDate = date_in_standard_format("now");
blob_appendf(&manifest, "D %s\n", zDate);
blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
md5sum_blob(&manifest, &cksum);
blob_appendf(&manifest, "Z %b\n", &cksum);
rid = content_put(&manifest, 0, 0, 0);
manifest_crosslink(rid, &manifest);
db_end_transaction(0);
cgi_redirect(zFrom);
}
style_header("Add Attachment");
@ <h2>Add Attachment To %s(zTargetType)</h2>
@ <form action="%s(g.zTop)/attachadd" method="post"
@ enctype="multipart/form-data"><div>
| > | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
zDate = date_in_standard_format("now");
blob_appendf(&manifest, "D %s\n", zDate);
blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
md5sum_blob(&manifest, &cksum);
blob_appendf(&manifest, "Z %b\n", &cksum);
rid = content_put(&manifest, 0, 0, 0);
manifest_crosslink(rid, &manifest);
assert( blob_is_reset(&manifest) );
db_end_transaction(0);
cgi_redirect(zFrom);
}
style_header("Add Attachment");
@ <h2>Add Attachment To %s(zTargetType)</h2>
@ <form action="%s(g.zTop)/attachadd" method="post"
@ enctype="multipart/form-data"><div>
|
| ︙ | ︙ |
Changes to src/blob.c.
| ︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 | ** Make sure a blob is initialized */ #define blob_is_init(x) \ assert((x)->xRealloc==blobReallocMalloc || (x)->xRealloc==blobReallocStatic) /* ** Make sure a blob does not contain malloced memory. */ #if 0 /* Enable for debugging only */ | > > > > | < | > > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
** Make sure a blob is initialized
*/
#define blob_is_init(x) \
assert((x)->xRealloc==blobReallocMalloc || (x)->xRealloc==blobReallocStatic)
/*
** Make sure a blob does not contain malloced memory.
**
** This might fail if we are unlucky and x is uninitialized. For that
** reason it should only be used locally for debugging. Leave it turned
** off for production.
*/
#if 0 /* Enable for debugging only */
#define assert_blob_is_reset(x) assert(blob_is_reset(x))
#else
#define assert_blob_is_reset(x)
#endif
/*
** We find that the built-in isspace() function does not work for
** some international character sets. So here is a substitute.
*/
int fossil_isspace(char c){
return c==' ' || (c<='\r' && c>='\t');
|
| ︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 |
** Reset a blob to be an empty container.
*/
void blob_reset(Blob *pBlob){
blob_is_init(pBlob);
pBlob->xRealloc(pBlob, 0);
}
/*
** Initialize a blob to a string or byte-array constant of a specified length.
** Any prior data in the blob is discarded.
*/
void blob_init(Blob *pBlob, const char *zData, int size){
| > > > > > > > > > > > > > | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
** Reset a blob to be an empty container.
*/
void blob_reset(Blob *pBlob){
blob_is_init(pBlob);
pBlob->xRealloc(pBlob, 0);
}
/*
** Return true if the blob has been zeroed - in other words if it contains
** no malloced memory. This only works reliably if the blob has been
** initialized - it can return a false negative on an uninitialized blob.
*/
int blob_is_reset(Blob *pBlob){
if( pBlob==0 ) return 1;
if( pBlob->nUsed ) return 0;
if( pBlob->xRealloc==blobReallocMalloc && pBlob->nAlloc ) return 0;
return 1;
}
/*
** Initialize a blob to a string or byte-array constant of a specified length.
** Any prior data in the blob is discarded.
*/
void blob_init(Blob *pBlob, const char *zData, int size){
assert_blob_is_reset(pBlob);
if( zData==0 ){
*pBlob = empty_blob;
}else{
if( size<=0 ) size = strlen(zData);
pBlob->nUsed = pBlob->nAlloc = size;
pBlob->aData = (char*)zData;
pBlob->iCursor = 0;
|
| ︙ | ︙ | |||
206 207 208 209 210 211 212 |
}
/*
** Initialize a blob to an empty string.
*/
void blob_zero(Blob *pBlob){
static const char zEmpty[] = "";
| | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
}
/*
** Initialize a blob to an empty string.
*/
void blob_zero(Blob *pBlob){
static const char zEmpty[] = "";
assert_blob_is_reset(pBlob);
pBlob->nUsed = 0;
pBlob->nAlloc = 1;
pBlob->aData = (char*)zEmpty;
pBlob->iCursor = 0;
pBlob->xRealloc = blobReallocStatic;
}
|
| ︙ | ︙ | |||
355 356 357 358 359 360 361 |
** Extract N bytes from blob pFrom and use it to initialize blob pTo.
** Return the actual number of bytes extracted.
**
** After this call completes, pTo will be an ephemeral blob.
*/
int blob_extract(Blob *pFrom, int N, Blob *pTo){
blob_is_init(pFrom);
| | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
** Extract N bytes from blob pFrom and use it to initialize blob pTo.
** Return the actual number of bytes extracted.
**
** After this call completes, pTo will be an ephemeral blob.
*/
int blob_extract(Blob *pFrom, int N, Blob *pTo){
blob_is_init(pFrom);
assert_blob_is_reset(pTo);
if( pFrom->iCursor + N > pFrom->nUsed ){
N = pFrom->nUsed - pFrom->iCursor;
if( N<=0 ){
blob_zero(pTo);
return 0;
}
}
|
| ︙ | ︙ | |||
733 734 735 736 737 738 739 |
outBuf[1] = nIn>>16 & 0xff;
outBuf[2] = nIn>>8 & 0xff;
outBuf[3] = nIn & 0xff;
nOut2 = (long int)nOut;
compress(&outBuf[4], &nOut2,
(unsigned char*)blob_buffer(pIn), blob_size(pIn));
if( pOut==pIn ) blob_reset(pOut);
| | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
outBuf[1] = nIn>>16 & 0xff;
outBuf[2] = nIn>>8 & 0xff;
outBuf[3] = nIn & 0xff;
nOut2 = (long int)nOut;
compress(&outBuf[4], &nOut2,
(unsigned char*)blob_buffer(pIn), blob_size(pIn));
if( pOut==pIn ) blob_reset(pOut);
assert_blob_is_reset(pOut);
*pOut = temp;
blob_resize(pOut, nOut2+4);
}
/*
** COMMAND: test-compress
*/
|
| ︙ | ︙ | |||
786 787 788 789 790 791 792 | stream.next_in = (unsigned char*)blob_buffer(pIn2); deflate(&stream, 0); deflate(&stream, Z_FINISH); blob_resize(&temp, stream.total_out + 4); deflateEnd(&stream); if( pOut==pIn1 ) blob_reset(pOut); if( pOut==pIn2 ) blob_reset(pOut); | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 |
stream.next_in = (unsigned char*)blob_buffer(pIn2);
deflate(&stream, 0);
deflate(&stream, Z_FINISH);
blob_resize(&temp, stream.total_out + 4);
deflateEnd(&stream);
if( pOut==pIn1 ) blob_reset(pOut);
if( pOut==pIn2 ) blob_reset(pOut);
assert_blob_is_reset(pOut);
*pOut = temp;
}
/*
** COMMAND: test-compress-2
*/
void compress2_cmd(void){
|
| ︙ | ︙ | |||
831 832 833 834 835 836 837 |
&inBuf[4], nIn - 4);
if( rc!=Z_OK ){
blob_reset(&temp);
return 1;
}
blob_resize(&temp, nOut2);
if( pOut==pIn ) blob_reset(pOut);
| | | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 |
&inBuf[4], nIn - 4);
if( rc!=Z_OK ){
blob_reset(&temp);
return 1;
}
blob_resize(&temp, nOut2);
if( pOut==pIn ) blob_reset(pOut);
assert_blob_is_reset(pOut);
*pOut = temp;
return 0;
}
/*
** COMMAND: test-uncompress
*/
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
if( brid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( manifest_crosslink(brid, &branch)==0 ){
fossil_panic("unable to install new manifest");
}
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
printf("New branch: %s\n", zUuid);
if( g.argc==3 ){
printf(
"\n"
"Note: the local check-out has not been updated to the new\n"
| > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
if( brid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
if( manifest_crosslink(brid, &branch)==0 ){
fossil_panic("unable to install new manifest");
}
assert( blob_is_reset(&branch) );
content_deltify(rootid, brid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", brid);
printf("New branch: %s\n", zUuid);
if( g.argc==3 ){
printf(
"\n"
"Note: the local check-out has not been updated to the new\n"
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 |
}
nvid = content_put(&manifest, 0, 0, 0);
if( nvid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
manifest_crosslink(nvid, &manifest);
content_deltify(vid, nvid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
printf("New_Version: %s\n", zUuid);
if( outputManifest ){
zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
blob_zero(&muuid);
blob_appendf(&muuid, "%s\n", zUuid);
| > | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 |
}
nvid = content_put(&manifest, 0, 0, 0);
if( nvid==0 ){
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
}
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
manifest_crosslink(nvid, &manifest);
assert( blob_is_reset(&manifest) );
content_deltify(vid, nvid, 0);
zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", nvid);
printf("New_Version: %s\n", zUuid);
if( outputManifest ){
zManifestFile = mprintf("%smanifest.uuid", g.zLocalRoot);
blob_zero(&muuid);
blob_appendf(&muuid, "%s\n", zUuid);
|
| ︙ | ︙ |
Changes to src/content.c.
| ︙ | ︙ | |||
69 70 71 72 73 74 75 |
blob_reset(&contentCache.a[mn].content);
contentCache.n--;
contentCache.a[mn] = contentCache.a[contentCache.n];
}
}
/*
| | > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
blob_reset(&contentCache.a[mn].content);
contentCache.n--;
contentCache.a[mn] = contentCache.a[contentCache.n];
}
}
/*
** Add an entry to the content cache.
**
** This routines hands responsibility for the artifact over to the cache.
** The cache will deallocate memory when it has finished with it.
*/
void content_cache_insert(int rid, Blob *pBlob){
struct cacheLine *p;
if( contentCache.n>500 || contentCache.szTotal>50000000 ){
content_cache_expire_oldest();
}
if( contentCache.n>=contentCache.nAlloc ){
|
| ︙ | ︙ | |||
359 360 361 362 363 364 365 |
int nChildUsed = 0;
int i;
/* Parse the object rid itself */
if( linkFlag ){
content_get(rid, &content);
manifest_crosslink(rid, &content);
| | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
int nChildUsed = 0;
int i;
/* Parse the object rid itself */
if( linkFlag ){
content_get(rid, &content);
manifest_crosslink(rid, &content);
assert( blob_is_reset(&content) );
}
/* Parse all delta-manifests that depend on baseline-manifest rid */
db_prepare(&q, "SELECT rid FROM orphan WHERE baseline=%d", rid);
while( db_step(&q)==SQLITE_ROW ){
int child = db_column_int(&q, 0);
if( nChildUsed>=nChildAlloc ){
nChildAlloc = nChildAlloc*2 + 10;
aChild = fossil_realloc(aChild, nChildAlloc*sizeof(aChild));
}
aChild[nChildUsed++] = child;
}
db_finalize(&q);
for(i=0; i<nChildUsed; i++){
content_get(aChild[i], &content);
manifest_crosslink(aChild[i], &content);
assert( blob_is_reset(&content) );
}
if( nChildUsed ){
db_multi_exec("DELETE FROM orphan WHERE baseline=%d", rid);
}
/* Recursively dephantomize all artifacts that are derived by
** delta from artifact rid and which have not already been
|
| ︙ | ︙ | |||
435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
**
** zUuid is the UUID of the artifact, if it is specified. When srcId is
** specified then zUuid must always be specified. If srcId is zero,
** and zUuid is zero then the correct zUuid is computed from pBlob.
**
** If the record already exists but is a phantom, the pBlob content
** is inserted and the phatom becomes a real record.
*/
int content_put(Blob *pBlob, const char *zUuid, int srcId, int nBlob){
int size;
int rid;
Stmt s1;
Blob cmpr;
Blob hash;
| > > > > | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
**
** zUuid is the UUID of the artifact, if it is specified. When srcId is
** specified then zUuid must always be specified. If srcId is zero,
** and zUuid is zero then the correct zUuid is computed from pBlob.
**
** If the record already exists but is a phantom, the pBlob content
** is inserted and the phatom becomes a real record.
**
** The original content of pBlob is not disturbed. The caller continues
** to be responsible for pBlob. This routine does *not* take over
** responsiblity for freeing pBlob.
*/
int content_put(Blob *pBlob, const char *zUuid, int srcId, int nBlob){
int size;
int rid;
Stmt s1;
Blob cmpr;
Blob hash;
|
| ︙ | ︙ |
Changes to src/event.c.
| ︙ | ︙ | |||
344 345 346 347 348 349 350 |
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &event);
| | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&event, &cksum);
blob_appendf(&event, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&event, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &event);
assert( blob_is_reset(&event) );
content_deltify(rid, nrid, 0);
db_end_transaction(0);
cgi_redirectf("event?name=%T", zEventId);
}
if( P("cancel")!=0 ){
cgi_redirectf("event?name=%T", zEventId);
return;
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 |
blob_appendf(&ctrl, "U %F\n", g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
db_begin_transaction();
g.markPrivate = content_is_private(rid);
nrid = content_put(&ctrl, 0, 0, 0);
manifest_crosslink(nrid, &ctrl);
db_end_transaction(0);
}
cgi_redirectf("ci?name=%s", zUuid);
}
blob_zero(&comment);
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
| > | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 |
blob_appendf(&ctrl, "U %F\n", g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
db_begin_transaction();
g.markPrivate = content_is_private(rid);
nrid = content_put(&ctrl, 0, 0, 0);
manifest_crosslink(nrid, &ctrl);
assert( blob_is_reset(&ctrl) );
db_end_transaction(0);
}
cgi_redirectf("ci?name=%s", zUuid);
}
blob_zero(&comment);
blob_append(&comment, zNewComment, -1);
zUuid[10] = 0;
|
| ︙ | ︙ |
Changes to src/manifest.c.
| ︙ | ︙ | |||
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
blob_reset(&p->content);
free(p->aFile);
free(p->azParent);
free(p->azCChild);
free(p->aTag);
free(p->aField);
if( p->pBaseline ) manifest_destroy(p->pBaseline);
fossil_free(p);
}
}
/*
** Add an element to the manifest cache using LRU replacement.
*/
| > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
blob_reset(&p->content);
free(p->aFile);
free(p->azParent);
free(p->azCChild);
free(p->aTag);
free(p->aField);
if( p->pBaseline ) manifest_destroy(p->pBaseline);
memset(p, 0, sizeof(*p));
fossil_free(p);
}
}
/*
** Add an element to the manifest cache using LRU replacement.
*/
|
| ︙ | ︙ | |||
1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 |
**
** If the input is a control artifact, then make appropriate entries
** in the auxiliary tables of the database in order to crosslink the
** artifact.
**
** If global variable g.xlinkClusterOnly is true, then ignore all
** control artifacts other than clusters.
**
** Historical note: This routine original processed manifests only.
** Processing for other control artifacts was added later. The name
** of the routine, "manifest_crosslink", and the name of this source
** file, is a legacy of its original use.
*/
int manifest_crosslink(int rid, Blob *pContent){
int i;
Manifest *p;
Stmt q;
int parentid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid))==0 ){
return 0;
}
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
manifest_destroy(p);
return 0;
}
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
manifest_destroy(p);
return 0;
}
db_begin_transaction();
if( p->type==CFTYPE_MANIFEST ){
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
char *zCom;
for(i=0; i<p->nParent; i++){
| > > > > > | 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
**
** If the input is a control artifact, then make appropriate entries
** in the auxiliary tables of the database in order to crosslink the
** artifact.
**
** If global variable g.xlinkClusterOnly is true, then ignore all
** control artifacts other than clusters.
**
** This routine always resets the pContent blob before returning.
**
** Historical note: This routine original processed manifests only.
** Processing for other control artifacts was added later. The name
** of the routine, "manifest_crosslink", and the name of this source
** file, is a legacy of its original use.
*/
int manifest_crosslink(int rid, Blob *pContent){
int i;
Manifest *p;
Stmt q;
int parentid = 0;
if( (p = manifest_cache_find(rid))!=0 ){
blob_reset(pContent);
}else if( (p = manifest_parse(pContent, rid))==0 ){
assert( blob_is_reset(pContent) || pContent==0 );
return 0;
}
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
manifest_destroy(p);
assert( blob_is_reset(pContent) );
return 0;
}
db_begin_transaction();
if( p->type==CFTYPE_MANIFEST ){
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", rid) ){
char *zCom;
for(i=0; i<p->nParent; i++){
|
| ︙ | ︙ | |||
1710 1711 1712 1713 1714 1715 1716 1717 1718 |
}
db_end_transaction(0);
if( p->type==CFTYPE_MANIFEST ){
manifest_cache_insert(p);
}else{
manifest_destroy(p);
}
return 1;
}
| > | 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 |
}
db_end_transaction(0);
if( p->type==CFTYPE_MANIFEST ){
manifest_cache_insert(p);
}else{
manifest_destroy(p);
}
assert( blob_is_reset(pContent) );
return 1;
}
|
Changes to src/rebuild.c.
| ︙ | ︙ | |||
172 173 174 175 176 177 178 179 |
}else{
/* We are doing "fossil deconstruct" */
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
char *zFile = mprintf(zFNameFormat, zUuid, zUuid+prefixLength);
blob_write_to_file(pUse,zFile);
free(zFile);
free(zUuid);
}
| > | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
}else{
/* We are doing "fossil deconstruct" */
char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
char *zFile = mprintf(zFNameFormat, zUuid, zUuid+prefixLength);
blob_write_to_file(pUse,zFile);
free(zFile);
free(zUuid);
blob_reset(pUse);
}
assert( blob_is_reset(pUse) );
rebuild_step_done(rid);
/* Call all children recursively */
rid = 0;
for(cid=bag_first(&children), i=1; cid; cid=bag_next(&children, cid), i++){
static Stmt q2;
int sz;
|
| ︙ | ︙ |
Changes to src/tag.c.
| ︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
blob_appendf(&ctrl, "\n");
}
blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
nrid = content_put(&ctrl, 0, 0, 0);
manifest_crosslink(nrid, &ctrl);
}
/*
** COMMAND: tag
** Usage: %fossil tag SUBCOMMAND ...
**
** Run various subcommands to control tags and properties
| > | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
blob_appendf(&ctrl, "\n");
}
blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
md5sum_blob(&ctrl, &cksum);
blob_appendf(&ctrl, "Z %b\n", &cksum);
nrid = content_put(&ctrl, 0, 0, 0);
manifest_crosslink(nrid, &ctrl);
assert( blob_is_reset(&ctrl) );
}
/*
** COMMAND: tag
** Usage: %fossil tag SUBCOMMAND ...
**
** Run various subcommands to control tags and properties
|
| ︙ | ︙ |
Changes to src/tkt.c.
| ︙ | ︙ | |||
483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
}else{
rid = content_put(&tktchng, 0, 0, 0);
if( rid==0 ){
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
}
manifest_crosslink_begin();
manifest_crosslink(rid, &tktchng);
manifest_crosslink_end();
}
return TH_RETURN;
}
/*
| > | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
}else{
rid = content_put(&tktchng, 0, 0, 0);
if( rid==0 ){
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
}
manifest_crosslink_begin();
manifest_crosslink(rid, &tktchng);
assert( blob_is_reset(&tktchng) );
manifest_crosslink_end();
}
return TH_RETURN;
}
/*
|
| ︙ | ︙ | |||
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
rid = content_put(&tktchng, 0, 0, 0);
if( rid==0 ){
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
}
manifest_crosslink_begin();
manifest_crosslink(rid, &tktchng);
manifest_crosslink_end();
printf("ticket %s succeeded for UID %s\n",
(eCmd==set?"set":"add"),zTktUuid);
}
}
}
}
| > | 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
rid = content_put(&tktchng, 0, 0, 0);
if( rid==0 ){
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
}
manifest_crosslink_begin();
manifest_crosslink(rid, &tktchng);
manifest_crosslink_end();
assert( blob_is_reset(&tktchng) );
printf("ticket %s succeeded for UID %s\n",
(eCmd==set?"set":"add"),zTktUuid);
}
}
}
}
|
Changes to src/wiki.c.
| ︙ | ︙ | |||
322 323 324 325 326 327 328 |
blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &wiki);
| | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody);
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &wiki);
assert( blob_is_reset(&wiki) );
content_deltify(rid, nrid, 0);
}
db_end_transaction(0);
cgi_redirectf("wiki?name=%T", zPageName);
}
if( P("cancel")!=0 ){
cgi_redirectf("wiki?name=%T", zPageName);
|
| ︙ | ︙ | |||
494 495 496 497 498 499 500 |
blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &wiki);
| | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
nrid = content_put(&wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid, &wiki);
assert( blob_is_reset(&wiki) );
content_deltify(rid, nrid, 0);
db_end_transaction(0);
}
cgi_redirectf("wiki?name=%T", zPageName);
}
if( P("cancel")!=0 ){
cgi_redirectf("wiki?name=%T", zPageName);
|
| ︙ | ︙ | |||
818 819 820 821 822 823 824 |
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
db_begin_transaction();
nrid = content_put( &wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid,&wiki);
| | | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 |
md5sum_blob(&wiki, &cksum);
blob_appendf(&wiki, "Z %b\n", &cksum);
blob_reset(&cksum);
db_begin_transaction();
nrid = content_put( &wiki, 0, 0, 0);
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
manifest_crosslink(nrid,&wiki);
assert( blob_is_reset(&wiki) );
content_deltify(rid,nrid,0);
db_end_transaction(0);
autosync(AUTOSYNC_PUSH);
return 1;
}
/*
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
if( !blob_eq_str(&pXfer->aToken[1], blob_str(&hash), -1) ){
blob_appendf(&pXfer->err, "content does not match sha1 hash");
}
rid = content_put(&content, blob_str(&hash), 0, 0);
blob_reset(&hash);
if( rid==0 ){
blob_appendf(&pXfer->err, "%s", g.zErrMsg);
}else{
content_make_public(rid);
manifest_crosslink(rid, &content);
}
remote_has(rid);
}
/*
** The aToken[0..nToken-1] blob array is a parse of a "cfile" line
** message. This routine finishes parsing that message and does
** a record insert of the file. The difference between "file" and
| > > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
if( !blob_eq_str(&pXfer->aToken[1], blob_str(&hash), -1) ){
blob_appendf(&pXfer->err, "content does not match sha1 hash");
}
rid = content_put(&content, blob_str(&hash), 0, 0);
blob_reset(&hash);
if( rid==0 ){
blob_appendf(&pXfer->err, "%s", g.zErrMsg);
blob_reset(&content);
}else{
content_make_public(rid);
manifest_crosslink(rid, &content);
}
assert( blob_is_reset(&content) );
remote_has(rid);
}
/*
** The aToken[0..nToken-1] blob array is a parse of a "cfile" line
** message. This routine finishes parsing that message and does
** a record insert of the file. The difference between "file" and
|
| ︙ | ︙ |