Fossil SCM

Infrastructure changes: Simplify content_put() to a single parameter. Add content_put_ex() with lots of extra parameters. Add isPrivate parameters to content_put_ex() and content_new().

drh 2011-02-24 17:11 trunk
Commit 1b4516168d1e979ed743d5982fb591305dde447b
+3 -3
--- src/attach.c
+++ src/attach.c
@@ -241,11 +241,11 @@
241241
int rid;
242242
int i, n;
243243
244244
db_begin_transaction();
245245
blob_init(&content, aContent, szContent);
246
- rid = content_put(&content, 0, 0, 0);
246
+ rid = content_put(&content);
247247
zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
248248
blob_zero(&manifest);
249249
for(i=n=0; zName[i]; i++){
250250
if( zName[i]=='/' || zName[i]=='\\' ) n = i;
251251
}
@@ -262,11 +262,11 @@
262262
zDate = date_in_standard_format("now");
263263
blob_appendf(&manifest, "D %s\n", zDate);
264264
blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
265265
md5sum_blob(&manifest, &cksum);
266266
blob_appendf(&manifest, "Z %b\n", &cksum);
267
- rid = content_put(&manifest, 0, 0, 0);
267
+ rid = content_put(&manifest);
268268
manifest_crosslink(rid, &manifest);
269269
assert( blob_is_reset(&manifest) );
270270
db_end_transaction(0);
271271
cgi_redirect(zFrom);
272272
}
@@ -342,11 +342,11 @@
342342
zDate = date_in_standard_format("now");
343343
blob_appendf(&manifest, "D %s\n", zDate);
344344
blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
345345
md5sum_blob(&manifest, &cksum);
346346
blob_appendf(&manifest, "Z %b\n", &cksum);
347
- rid = content_put(&manifest, 0, 0, 0);
347
+ rid = content_put(&manifest);
348348
manifest_crosslink(rid, &manifest);
349349
db_end_transaction(0);
350350
cgi_redirect(zFrom);
351351
}
352352
style_header("Delete Attachment");
353353
--- src/attach.c
+++ src/attach.c
@@ -241,11 +241,11 @@
241 int rid;
242 int i, n;
243
244 db_begin_transaction();
245 blob_init(&content, aContent, szContent);
246 rid = content_put(&content, 0, 0, 0);
247 zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
248 blob_zero(&manifest);
249 for(i=n=0; zName[i]; i++){
250 if( zName[i]=='/' || zName[i]=='\\' ) n = i;
251 }
@@ -262,11 +262,11 @@
262 zDate = date_in_standard_format("now");
263 blob_appendf(&manifest, "D %s\n", zDate);
264 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
265 md5sum_blob(&manifest, &cksum);
266 blob_appendf(&manifest, "Z %b\n", &cksum);
267 rid = content_put(&manifest, 0, 0, 0);
268 manifest_crosslink(rid, &manifest);
269 assert( blob_is_reset(&manifest) );
270 db_end_transaction(0);
271 cgi_redirect(zFrom);
272 }
@@ -342,11 +342,11 @@
342 zDate = date_in_standard_format("now");
343 blob_appendf(&manifest, "D %s\n", zDate);
344 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
345 md5sum_blob(&manifest, &cksum);
346 blob_appendf(&manifest, "Z %b\n", &cksum);
347 rid = content_put(&manifest, 0, 0, 0);
348 manifest_crosslink(rid, &manifest);
349 db_end_transaction(0);
350 cgi_redirect(zFrom);
351 }
352 style_header("Delete Attachment");
353
--- src/attach.c
+++ src/attach.c
@@ -241,11 +241,11 @@
241 int rid;
242 int i, n;
243
244 db_begin_transaction();
245 blob_init(&content, aContent, szContent);
246 rid = content_put(&content);
247 zUUID = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
248 blob_zero(&manifest);
249 for(i=n=0; zName[i]; i++){
250 if( zName[i]=='/' || zName[i]=='\\' ) n = i;
251 }
@@ -262,11 +262,11 @@
262 zDate = date_in_standard_format("now");
263 blob_appendf(&manifest, "D %s\n", zDate);
264 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
265 md5sum_blob(&manifest, &cksum);
266 blob_appendf(&manifest, "Z %b\n", &cksum);
267 rid = content_put(&manifest);
268 manifest_crosslink(rid, &manifest);
269 assert( blob_is_reset(&manifest) );
270 db_end_transaction(0);
271 cgi_redirect(zFrom);
272 }
@@ -342,11 +342,11 @@
342 zDate = date_in_standard_format("now");
343 blob_appendf(&manifest, "D %s\n", zDate);
344 blob_appendf(&manifest, "U %F\n", g.zLogin ? g.zLogin : "nobody");
345 md5sum_blob(&manifest, &cksum);
346 blob_appendf(&manifest, "Z %b\n", &cksum);
347 rid = content_put(&manifest);
348 manifest_crosslink(rid, &manifest);
349 db_end_transaction(0);
350 cgi_redirect(zFrom);
351 }
352 style_header("Delete Attachment");
353
+1 -1
--- src/branch.c
+++ src/branch.c
@@ -136,11 +136,11 @@
136136
db_end_transaction(1);
137137
fossil_exit(1);
138138
}
139139
}
140140
141
- brid = content_put(&branch, 0, 0, 0);
141
+ brid = content_put(&branch);
142142
if( brid==0 ){
143143
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
144144
}
145145
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
146146
if( manifest_crosslink(brid, &branch)==0 ){
147147
--- src/branch.c
+++ src/branch.c
@@ -136,11 +136,11 @@
136 db_end_transaction(1);
137 fossil_exit(1);
138 }
139 }
140
141 brid = content_put(&branch, 0, 0, 0);
142 if( brid==0 ){
143 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
144 }
145 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
146 if( manifest_crosslink(brid, &branch)==0 ){
147
--- src/branch.c
+++ src/branch.c
@@ -136,11 +136,11 @@
136 db_end_transaction(1);
137 fossil_exit(1);
138 }
139 }
140
141 brid = content_put(&branch);
142 if( brid==0 ){
143 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
144 }
145 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", brid);
146 if( manifest_crosslink(brid, &branch)==0 ){
147
+2 -2
--- src/checkin.c
+++ src/checkin.c
@@ -994,11 +994,11 @@
994994
zFullname = db_column_text(&q, 1);
995995
rid = db_column_int(&q, 2);
996996
997997
blob_zero(&content);
998998
blob_read_from_file(&content, zFullname);
999
- nrid = content_put(&content, 0, 0, 0);
999
+ nrid = content_put(&content);
10001000
blob_reset(&content);
10011001
if( rid>0 ){
10021002
content_deltify(rid, nrid, 0);
10031003
}
10041004
db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
@@ -1086,11 +1086,11 @@
10861086
blob_write_to_file(&manifest, zManifestFile);
10871087
blob_reset(&manifest);
10881088
blob_read_from_file(&manifest, zManifestFile);
10891089
free(zManifestFile);
10901090
}
1091
- nvid = content_put(&manifest, 0, 0, 0);
1091
+ nvid = content_put(&manifest);
10921092
if( nvid==0 ){
10931093
fossil_panic("trouble committing manifest: %s", g.zErrMsg);
10941094
}
10951095
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
10961096
manifest_crosslink(nvid, &manifest);
10971097
--- src/checkin.c
+++ src/checkin.c
@@ -994,11 +994,11 @@
994 zFullname = db_column_text(&q, 1);
995 rid = db_column_int(&q, 2);
996
997 blob_zero(&content);
998 blob_read_from_file(&content, zFullname);
999 nrid = content_put(&content, 0, 0, 0);
1000 blob_reset(&content);
1001 if( rid>0 ){
1002 content_deltify(rid, nrid, 0);
1003 }
1004 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
@@ -1086,11 +1086,11 @@
1086 blob_write_to_file(&manifest, zManifestFile);
1087 blob_reset(&manifest);
1088 blob_read_from_file(&manifest, zManifestFile);
1089 free(zManifestFile);
1090 }
1091 nvid = content_put(&manifest, 0, 0, 0);
1092 if( nvid==0 ){
1093 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
1094 }
1095 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
1096 manifest_crosslink(nvid, &manifest);
1097
--- src/checkin.c
+++ src/checkin.c
@@ -994,11 +994,11 @@
994 zFullname = db_column_text(&q, 1);
995 rid = db_column_int(&q, 2);
996
997 blob_zero(&content);
998 blob_read_from_file(&content, zFullname);
999 nrid = content_put(&content);
1000 blob_reset(&content);
1001 if( rid>0 ){
1002 content_deltify(rid, nrid, 0);
1003 }
1004 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
@@ -1086,11 +1086,11 @@
1086 blob_write_to_file(&manifest, zManifestFile);
1087 blob_reset(&manifest);
1088 blob_read_from_file(&manifest, zManifestFile);
1089 free(zManifestFile);
1090 }
1091 nvid = content_put(&manifest);
1092 if( nvid==0 ){
1093 fossil_panic("trouble committing manifest: %s", g.zErrMsg);
1094 }
1095 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nvid);
1096 manifest_crosslink(nvid, &manifest);
1097
+30 -6
--- src/content.c
+++ src/content.c
@@ -430,11 +430,13 @@
430430
/*
431431
** Write content into the database. Return the record ID. If the
432432
** content is already in the database, just return the record ID.
433433
**
434434
** If srcId is specified, then pBlob is delta content from
435
-** the srcId record. srcId might be a phantom. If nBlob>0 then the
435
+** the srcId record. srcId might be a phantom.
436
+**
437
+** pBlob is normally uncompressed text. But if nBlob>0 then the
436438
** pBlob value has already been compressed and nBlob is its uncompressed
437439
** size. If nBlob>0 then zUuid must be valid.
438440
**
439441
** zUuid is the UUID of the artifact, if it is specified. When srcId is
440442
** specified then zUuid must always be specified. If srcId is zero,
@@ -445,11 +447,17 @@
445447
**
446448
** The original content of pBlob is not disturbed. The caller continues
447449
** to be responsible for pBlob. This routine does *not* take over
448450
** responsiblity for freeing pBlob.
449451
*/
450
-int content_put(Blob *pBlob, const char *zUuid, int srcId, int nBlob){
452
+int content_put_ex(
453
+ Blob *pBlob, /* Content to add to the repository */
454
+ const char *zUuid, /* SHA1 hash of reconstructed pBlob */
455
+ int srcId, /* pBlob is a delta from this entry */
456
+ int nBlob, /* pBlob is compressed. Original size is this */
457
+ int isPrivate /* The content should be marked private */
458
+){
451459
int size;
452460
int rid;
453461
Stmt s1;
454462
Blob cmpr;
455463
Blob hash;
@@ -535,11 +543,11 @@
535543
db_exec(&s1);
536544
rid = db_last_insert_rowid();
537545
if( !pBlob ){
538546
db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
539547
}
540
- if( g.markPrivate ){
548
+ if( g.markPrivate || isPrivate ){
541549
db_multi_exec("INSERT INTO private VALUES(%d)", rid);
542550
markAsUnclustered = 0;
543551
}
544552
}
545553
if( nBlob==0 ) blob_reset(&cmpr);
@@ -573,15 +581,31 @@
573581
/* Make arrangements to verify that the data can be recovered
574582
** before we commit */
575583
verify_before_commit(rid);
576584
return rid;
577585
}
586
+
587
+/*
588
+** This is the simple common case for inserting content into the
589
+** repository. pBlob is the content to be inserted.
590
+**
591
+** pBlob is uncompressed and is not deltaed. It is exactly the content
592
+** to be inserted.
593
+**
594
+** The original content of pBlob is not disturbed. The caller continues
595
+** to be responsible for pBlob. This routine does *not* take over
596
+** responsiblity for freeing pBlob.
597
+*/
598
+int content_put(Blob *pBlob){
599
+ return content_put_ex(pBlob, 0, 0, 0, 0);
600
+}
601
+
578602
579603
/*
580604
** Create a new phantom with the given UUID and return its artifact ID.
581605
*/
582
-int content_new(const char *zUuid){
606
+int content_new(const char *zUuid, int isPrivate){
583607
int rid;
584608
static Stmt s1, s2, s3;
585609
586610
assert( g.repositoryOpen );
587611
db_begin_transaction();
@@ -599,11 +623,11 @@
599623
db_static_prepare(&s2,
600624
"INSERT INTO phantom VALUES(:rid)"
601625
);
602626
db_bind_int(&s2, ":rid", rid);
603627
db_exec(&s2);
604
- if( g.markPrivate ){
628
+ if( g.markPrivate || isPrivate ){
605629
db_multi_exec("INSERT INTO private VALUES(%d)", rid);
606630
}else{
607631
db_static_prepare(&s3,
608632
"INSERT INTO unclustered VALUES(:rid)"
609633
);
@@ -626,11 +650,11 @@
626650
Blob content;
627651
if( g.argc!=3 ) usage("FILENAME");
628652
db_must_be_within_tree();
629653
user_select();
630654
blob_read_from_file(&content, g.argv[2]);
631
- rid = content_put(&content, 0, 0, 0);
655
+ rid = content_put(&content);
632656
printf("inserted as record %d\n", rid);
633657
}
634658
635659
/*
636660
** Make sure the content at rid is the original content and is not a
637661
--- src/content.c
+++ src/content.c
@@ -430,11 +430,13 @@
430 /*
431 ** Write content into the database. Return the record ID. If the
432 ** content is already in the database, just return the record ID.
433 **
434 ** If srcId is specified, then pBlob is delta content from
435 ** the srcId record. srcId might be a phantom. If nBlob>0 then the
 
 
436 ** pBlob value has already been compressed and nBlob is its uncompressed
437 ** size. If nBlob>0 then zUuid must be valid.
438 **
439 ** zUuid is the UUID of the artifact, if it is specified. When srcId is
440 ** specified then zUuid must always be specified. If srcId is zero,
@@ -445,11 +447,17 @@
445 **
446 ** The original content of pBlob is not disturbed. The caller continues
447 ** to be responsible for pBlob. This routine does *not* take over
448 ** responsiblity for freeing pBlob.
449 */
450 int content_put(Blob *pBlob, const char *zUuid, int srcId, int nBlob){
 
 
 
 
 
 
451 int size;
452 int rid;
453 Stmt s1;
454 Blob cmpr;
455 Blob hash;
@@ -535,11 +543,11 @@
535 db_exec(&s1);
536 rid = db_last_insert_rowid();
537 if( !pBlob ){
538 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
539 }
540 if( g.markPrivate ){
541 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
542 markAsUnclustered = 0;
543 }
544 }
545 if( nBlob==0 ) blob_reset(&cmpr);
@@ -573,15 +581,31 @@
573 /* Make arrangements to verify that the data can be recovered
574 ** before we commit */
575 verify_before_commit(rid);
576 return rid;
577 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
579 /*
580 ** Create a new phantom with the given UUID and return its artifact ID.
581 */
582 int content_new(const char *zUuid){
583 int rid;
584 static Stmt s1, s2, s3;
585
586 assert( g.repositoryOpen );
587 db_begin_transaction();
@@ -599,11 +623,11 @@
599 db_static_prepare(&s2,
600 "INSERT INTO phantom VALUES(:rid)"
601 );
602 db_bind_int(&s2, ":rid", rid);
603 db_exec(&s2);
604 if( g.markPrivate ){
605 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
606 }else{
607 db_static_prepare(&s3,
608 "INSERT INTO unclustered VALUES(:rid)"
609 );
@@ -626,11 +650,11 @@
626 Blob content;
627 if( g.argc!=3 ) usage("FILENAME");
628 db_must_be_within_tree();
629 user_select();
630 blob_read_from_file(&content, g.argv[2]);
631 rid = content_put(&content, 0, 0, 0);
632 printf("inserted as record %d\n", rid);
633 }
634
635 /*
636 ** Make sure the content at rid is the original content and is not a
637
--- src/content.c
+++ src/content.c
@@ -430,11 +430,13 @@
430 /*
431 ** Write content into the database. Return the record ID. If the
432 ** content is already in the database, just return the record ID.
433 **
434 ** If srcId is specified, then pBlob is delta content from
435 ** the srcId record. srcId might be a phantom.
436 **
437 ** pBlob is normally uncompressed text. But if nBlob>0 then the
438 ** pBlob value has already been compressed and nBlob is its uncompressed
439 ** size. If nBlob>0 then zUuid must be valid.
440 **
441 ** zUuid is the UUID of the artifact, if it is specified. When srcId is
442 ** specified then zUuid must always be specified. If srcId is zero,
@@ -445,11 +447,17 @@
447 **
448 ** The original content of pBlob is not disturbed. The caller continues
449 ** to be responsible for pBlob. This routine does *not* take over
450 ** responsiblity for freeing pBlob.
451 */
452 int content_put_ex(
453 Blob *pBlob, /* Content to add to the repository */
454 const char *zUuid, /* SHA1 hash of reconstructed pBlob */
455 int srcId, /* pBlob is a delta from this entry */
456 int nBlob, /* pBlob is compressed. Original size is this */
457 int isPrivate /* The content should be marked private */
458 ){
459 int size;
460 int rid;
461 Stmt s1;
462 Blob cmpr;
463 Blob hash;
@@ -535,11 +543,11 @@
543 db_exec(&s1);
544 rid = db_last_insert_rowid();
545 if( !pBlob ){
546 db_multi_exec("INSERT OR IGNORE INTO phantom VALUES(%d)", rid);
547 }
548 if( g.markPrivate || isPrivate ){
549 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
550 markAsUnclustered = 0;
551 }
552 }
553 if( nBlob==0 ) blob_reset(&cmpr);
@@ -573,15 +581,31 @@
581 /* Make arrangements to verify that the data can be recovered
582 ** before we commit */
583 verify_before_commit(rid);
584 return rid;
585 }
586
587 /*
588 ** This is the simple common case for inserting content into the
589 ** repository. pBlob is the content to be inserted.
590 **
591 ** pBlob is uncompressed and is not deltaed. It is exactly the content
592 ** to be inserted.
593 **
594 ** The original content of pBlob is not disturbed. The caller continues
595 ** to be responsible for pBlob. This routine does *not* take over
596 ** responsiblity for freeing pBlob.
597 */
598 int content_put(Blob *pBlob){
599 return content_put_ex(pBlob, 0, 0, 0, 0);
600 }
601
602
603 /*
604 ** Create a new phantom with the given UUID and return its artifact ID.
605 */
606 int content_new(const char *zUuid, int isPrivate){
607 int rid;
608 static Stmt s1, s2, s3;
609
610 assert( g.repositoryOpen );
611 db_begin_transaction();
@@ -599,11 +623,11 @@
623 db_static_prepare(&s2,
624 "INSERT INTO phantom VALUES(:rid)"
625 );
626 db_bind_int(&s2, ":rid", rid);
627 db_exec(&s2);
628 if( g.markPrivate || isPrivate ){
629 db_multi_exec("INSERT INTO private VALUES(%d)", rid);
630 }else{
631 db_static_prepare(&s3,
632 "INSERT INTO unclustered VALUES(:rid)"
633 );
@@ -626,11 +650,11 @@
650 Blob content;
651 if( g.argc!=3 ) usage("FILENAME");
652 db_must_be_within_tree();
653 user_select();
654 blob_read_from_file(&content, g.argv[2]);
655 rid = content_put(&content);
656 printf("inserted as record %d\n", rid);
657 }
658
659 /*
660 ** Make sure the content at rid is the original content and is not a
661
+1 -1
--- src/db.c
+++ src/db.c
@@ -1118,11 +1118,11 @@
11181118
blob_appendf(&manifest, "T *sym-trunk *\n");
11191119
blob_appendf(&manifest, "U %F\n", g.zLogin);
11201120
md5sum_blob(&manifest, &hash);
11211121
blob_appendf(&manifest, "Z %b\n", &hash);
11221122
blob_reset(&hash);
1123
- rid = content_put(&manifest, 0, 0, 0);
1123
+ rid = content_put(&manifest);
11241124
manifest_crosslink(rid, &manifest);
11251125
}
11261126
}
11271127
11281128
/*
11291129
--- src/db.c
+++ src/db.c
@@ -1118,11 +1118,11 @@
1118 blob_appendf(&manifest, "T *sym-trunk *\n");
1119 blob_appendf(&manifest, "U %F\n", g.zLogin);
1120 md5sum_blob(&manifest, &hash);
1121 blob_appendf(&manifest, "Z %b\n", &hash);
1122 blob_reset(&hash);
1123 rid = content_put(&manifest, 0, 0, 0);
1124 manifest_crosslink(rid, &manifest);
1125 }
1126 }
1127
1128 /*
1129
--- src/db.c
+++ src/db.c
@@ -1118,11 +1118,11 @@
1118 blob_appendf(&manifest, "T *sym-trunk *\n");
1119 blob_appendf(&manifest, "U %F\n", g.zLogin);
1120 md5sum_blob(&manifest, &hash);
1121 blob_appendf(&manifest, "Z %b\n", &hash);
1122 blob_reset(&hash);
1123 rid = content_put(&manifest);
1124 manifest_crosslink(rid, &manifest);
1125 }
1126 }
1127
1128 /*
1129
+1 -1
--- src/event.c
+++ src/event.c
@@ -343,11 +343,11 @@
343343
}
344344
blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
345345
md5sum_blob(&event, &cksum);
346346
blob_appendf(&event, "Z %b\n", &cksum);
347347
blob_reset(&cksum);
348
- nrid = content_put(&event, 0, 0, 0);
348
+ nrid = content_put(&event);
349349
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
350350
manifest_crosslink(nrid, &event);
351351
assert( blob_is_reset(&event) );
352352
content_deltify(rid, nrid, 0);
353353
db_end_transaction(0);
354354
--- src/event.c
+++ src/event.c
@@ -343,11 +343,11 @@
343 }
344 blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
345 md5sum_blob(&event, &cksum);
346 blob_appendf(&event, "Z %b\n", &cksum);
347 blob_reset(&cksum);
348 nrid = content_put(&event, 0, 0, 0);
349 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
350 manifest_crosslink(nrid, &event);
351 assert( blob_is_reset(&event) );
352 content_deltify(rid, nrid, 0);
353 db_end_transaction(0);
354
--- src/event.c
+++ src/event.c
@@ -343,11 +343,11 @@
343 }
344 blob_appendf(&event, "W %d\n%s\n", strlen(zBody), zBody);
345 md5sum_blob(&event, &cksum);
346 blob_appendf(&event, "Z %b\n", &cksum);
347 blob_reset(&cksum);
348 nrid = content_put(&event);
349 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
350 manifest_crosslink(nrid, &event);
351 assert( blob_is_reset(&event) );
352 content_deltify(rid, nrid, 0);
353 db_end_transaction(0);
354
+1 -1
--- src/info.c
+++ src/info.c
@@ -1652,11 +1652,11 @@
16521652
blob_appendf(&ctrl, "U %F\n", g.zLogin);
16531653
md5sum_blob(&ctrl, &cksum);
16541654
blob_appendf(&ctrl, "Z %b\n", &cksum);
16551655
db_begin_transaction();
16561656
g.markPrivate = content_is_private(rid);
1657
- nrid = content_put(&ctrl, 0, 0, 0);
1657
+ nrid = content_put(&ctrl);
16581658
manifest_crosslink(nrid, &ctrl);
16591659
assert( blob_is_reset(&ctrl) );
16601660
db_end_transaction(0);
16611661
}
16621662
cgi_redirectf("ci?name=%s", zUuid);
16631663
--- src/info.c
+++ src/info.c
@@ -1652,11 +1652,11 @@
1652 blob_appendf(&ctrl, "U %F\n", g.zLogin);
1653 md5sum_blob(&ctrl, &cksum);
1654 blob_appendf(&ctrl, "Z %b\n", &cksum);
1655 db_begin_transaction();
1656 g.markPrivate = content_is_private(rid);
1657 nrid = content_put(&ctrl, 0, 0, 0);
1658 manifest_crosslink(nrid, &ctrl);
1659 assert( blob_is_reset(&ctrl) );
1660 db_end_transaction(0);
1661 }
1662 cgi_redirectf("ci?name=%s", zUuid);
1663
--- src/info.c
+++ src/info.c
@@ -1652,11 +1652,11 @@
1652 blob_appendf(&ctrl, "U %F\n", g.zLogin);
1653 md5sum_blob(&ctrl, &cksum);
1654 blob_appendf(&ctrl, "Z %b\n", &cksum);
1655 db_begin_transaction();
1656 g.markPrivate = content_is_private(rid);
1657 nrid = content_put(&ctrl);
1658 manifest_crosslink(nrid, &ctrl);
1659 assert( blob_is_reset(&ctrl) );
1660 db_end_transaction(0);
1661 }
1662 cgi_redirectf("ci?name=%s", zUuid);
1663
+1 -1
--- src/rebuild.c
+++ src/rebuild.c
@@ -596,11 +596,11 @@
596596
blob_appendf(&path, "%s", zSubpath);
597597
if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
598598
fossil_panic("some unknown error occurred while reading \"%s\"",
599599
blob_str(&path));
600600
}
601
- content_put(&aContent, 0, 0, 0);
601
+ content_put(&aContent);
602602
blob_reset(&path);
603603
blob_reset(&aContent);
604604
free(zSubpath);
605605
printf("\r%d", ++nFileRead);
606606
fflush(stdout);
607607
--- src/rebuild.c
+++ src/rebuild.c
@@ -596,11 +596,11 @@
596 blob_appendf(&path, "%s", zSubpath);
597 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
598 fossil_panic("some unknown error occurred while reading \"%s\"",
599 blob_str(&path));
600 }
601 content_put(&aContent, 0, 0, 0);
602 blob_reset(&path);
603 blob_reset(&aContent);
604 free(zSubpath);
605 printf("\r%d", ++nFileRead);
606 fflush(stdout);
607
--- src/rebuild.c
+++ src/rebuild.c
@@ -596,11 +596,11 @@
596 blob_appendf(&path, "%s", zSubpath);
597 if( blob_read_from_file(&aContent, blob_str(&path))==-1 ){
598 fossil_panic("some unknown error occurred while reading \"%s\"",
599 blob_str(&path));
600 }
601 content_put(&aContent);
602 blob_reset(&path);
603 blob_reset(&aContent);
604 free(zSubpath);
605 printf("\r%d", ++nFileRead);
606 fflush(stdout);
607
+1 -1
--- src/tag.c
+++ src/tag.c
@@ -309,11 +309,11 @@
309309
blob_appendf(&ctrl, "\n");
310310
}
311311
blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
312312
md5sum_blob(&ctrl, &cksum);
313313
blob_appendf(&ctrl, "Z %b\n", &cksum);
314
- nrid = content_put(&ctrl, 0, 0, 0);
314
+ nrid = content_put(&ctrl);
315315
manifest_crosslink(nrid, &ctrl);
316316
assert( blob_is_reset(&ctrl) );
317317
}
318318
319319
/*
320320
--- src/tag.c
+++ src/tag.c
@@ -309,11 +309,11 @@
309 blob_appendf(&ctrl, "\n");
310 }
311 blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
312 md5sum_blob(&ctrl, &cksum);
313 blob_appendf(&ctrl, "Z %b\n", &cksum);
314 nrid = content_put(&ctrl, 0, 0, 0);
315 manifest_crosslink(nrid, &ctrl);
316 assert( blob_is_reset(&ctrl) );
317 }
318
319 /*
320
--- src/tag.c
+++ src/tag.c
@@ -309,11 +309,11 @@
309 blob_appendf(&ctrl, "\n");
310 }
311 blob_appendf(&ctrl, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
312 md5sum_blob(&ctrl, &cksum);
313 blob_appendf(&ctrl, "Z %b\n", &cksum);
314 nrid = content_put(&ctrl);
315 manifest_crosslink(nrid, &ctrl);
316 assert( blob_is_reset(&ctrl) );
317 }
318
319 /*
320
+2 -2
--- src/tkt.c
+++ src/tkt.c
@@ -479,11 +479,11 @@
479479
}else if( g.thTrace ){
480480
Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n"
481481
"}<br />\n",
482482
blob_str(&tktchng));
483483
}else{
484
- rid = content_put(&tktchng, 0, 0, 0);
484
+ rid = content_put(&tktchng);
485485
if( rid==0 ){
486486
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
487487
}
488488
manifest_crosslink_begin();
489489
manifest_crosslink(rid, &tktchng);
@@ -1056,11 +1056,11 @@
10561056
}
10571057
blob_appendf(&tktchng, "K %s\n", zTktUuid);
10581058
blob_appendf(&tktchng, "U %F\n", g.zLogin);
10591059
md5sum_blob(&tktchng, &cksum);
10601060
blob_appendf(&tktchng, "Z %b\n", &cksum);
1061
- rid = content_put(&tktchng, 0, 0, 0);
1061
+ rid = content_put(&tktchng);
10621062
if( rid==0 ){
10631063
fossil_panic("trouble committing ticket: %s", g.zErrMsg);
10641064
}
10651065
manifest_crosslink_begin();
10661066
manifest_crosslink(rid, &tktchng);
10671067
--- src/tkt.c
+++ src/tkt.c
@@ -479,11 +479,11 @@
479 }else if( g.thTrace ){
480 Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n"
481 "}<br />\n",
482 blob_str(&tktchng));
483 }else{
484 rid = content_put(&tktchng, 0, 0, 0);
485 if( rid==0 ){
486 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
487 }
488 manifest_crosslink_begin();
489 manifest_crosslink(rid, &tktchng);
@@ -1056,11 +1056,11 @@
1056 }
1057 blob_appendf(&tktchng, "K %s\n", zTktUuid);
1058 blob_appendf(&tktchng, "U %F\n", g.zLogin);
1059 md5sum_blob(&tktchng, &cksum);
1060 blob_appendf(&tktchng, "Z %b\n", &cksum);
1061 rid = content_put(&tktchng, 0, 0, 0);
1062 if( rid==0 ){
1063 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
1064 }
1065 manifest_crosslink_begin();
1066 manifest_crosslink(rid, &tktchng);
1067
--- src/tkt.c
+++ src/tkt.c
@@ -479,11 +479,11 @@
479 }else if( g.thTrace ){
480 Th_Trace("submit_ticket {\n<blockquote><pre>\n%h\n</pre></blockquote>\n"
481 "}<br />\n",
482 blob_str(&tktchng));
483 }else{
484 rid = content_put(&tktchng);
485 if( rid==0 ){
486 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
487 }
488 manifest_crosslink_begin();
489 manifest_crosslink(rid, &tktchng);
@@ -1056,11 +1056,11 @@
1056 }
1057 blob_appendf(&tktchng, "K %s\n", zTktUuid);
1058 blob_appendf(&tktchng, "U %F\n", g.zLogin);
1059 md5sum_blob(&tktchng, &cksum);
1060 blob_appendf(&tktchng, "Z %b\n", &cksum);
1061 rid = content_put(&tktchng);
1062 if( rid==0 ){
1063 fossil_panic("trouble committing ticket: %s", g.zErrMsg);
1064 }
1065 manifest_crosslink_begin();
1066 manifest_crosslink(rid, &tktchng);
1067
+4 -3
--- src/vfile.c
+++ src/vfile.c
@@ -50,12 +50,13 @@
5050
** does not exist, then return 0.
5151
**
5252
** For this routine, the UUID must be exact. For a match against
5353
** user input with mixed case, use resolve_uuid().
5454
**
55
-** If the UUID is not found and phantomize is 1, then attempt to
56
-** create a phantom record.
55
+** If the UUID is not found and phantomize is 1 or 2, then attempt to
56
+** create a phantom record. A private phantom is created for 2 and
57
+** a public phantom is created for 1.
5758
*/
5859
int uuid_to_rid(const char *zUuid, int phantomize){
5960
int rid, sz;
6061
char z[UUID_SIZE+1];
6162
@@ -65,11 +66,11 @@
6566
}
6667
memcpy(z, zUuid, UUID_SIZE+1);
6768
canonical16(z, sz);
6869
rid = fast_uuid_to_rid(z);
6970
if( rid==0 && phantomize ){
70
- rid = content_new(zUuid);
71
+ rid = content_new(zUuid, phantomize-1);
7172
}
7273
return rid;
7374
}
7475
7576
/*
7677
--- src/vfile.c
+++ src/vfile.c
@@ -50,12 +50,13 @@
50 ** does not exist, then return 0.
51 **
52 ** For this routine, the UUID must be exact. For a match against
53 ** user input with mixed case, use resolve_uuid().
54 **
55 ** If the UUID is not found and phantomize is 1, then attempt to
56 ** create a phantom record.
 
57 */
58 int uuid_to_rid(const char *zUuid, int phantomize){
59 int rid, sz;
60 char z[UUID_SIZE+1];
61
@@ -65,11 +66,11 @@
65 }
66 memcpy(z, zUuid, UUID_SIZE+1);
67 canonical16(z, sz);
68 rid = fast_uuid_to_rid(z);
69 if( rid==0 && phantomize ){
70 rid = content_new(zUuid);
71 }
72 return rid;
73 }
74
75 /*
76
--- src/vfile.c
+++ src/vfile.c
@@ -50,12 +50,13 @@
50 ** does not exist, then return 0.
51 **
52 ** For this routine, the UUID must be exact. For a match against
53 ** user input with mixed case, use resolve_uuid().
54 **
55 ** If the UUID is not found and phantomize is 1 or 2, then attempt to
56 ** create a phantom record. A private phantom is created for 2 and
57 ** a public phantom is created for 1.
58 */
59 int uuid_to_rid(const char *zUuid, int phantomize){
60 int rid, sz;
61 char z[UUID_SIZE+1];
62
@@ -65,11 +66,11 @@
66 }
67 memcpy(z, zUuid, UUID_SIZE+1);
68 canonical16(z, sz);
69 rid = fast_uuid_to_rid(z);
70 if( rid==0 && phantomize ){
71 rid = content_new(zUuid, phantomize-1);
72 }
73 return rid;
74 }
75
76 /*
77
+3 -3
--- src/wiki.c
+++ src/wiki.c
@@ -321,11 +321,11 @@
321321
}
322322
blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody);
323323
md5sum_blob(&wiki, &cksum);
324324
blob_appendf(&wiki, "Z %b\n", &cksum);
325325
blob_reset(&cksum);
326
- nrid = content_put(&wiki, 0, 0, 0);
326
+ nrid = content_put(&wiki);
327327
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
328328
manifest_crosslink(nrid, &wiki);
329329
assert( blob_is_reset(&wiki) );
330330
content_deltify(rid, nrid, 0);
331331
}
@@ -493,11 +493,11 @@
493493
appendRemark(&body);
494494
blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
495495
md5sum_blob(&wiki, &cksum);
496496
blob_appendf(&wiki, "Z %b\n", &cksum);
497497
blob_reset(&cksum);
498
- nrid = content_put(&wiki, 0, 0, 0);
498
+ nrid = content_put(&wiki);
499499
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
500500
manifest_crosslink(nrid, &wiki);
501501
assert( blob_is_reset(&wiki) );
502502
content_deltify(rid, nrid, 0);
503503
db_end_transaction(0);
@@ -817,11 +817,11 @@
817817
blob_str(pContent) );
818818
md5sum_blob(&wiki, &cksum);
819819
blob_appendf(&wiki, "Z %b\n", &cksum);
820820
blob_reset(&cksum);
821821
db_begin_transaction();
822
- nrid = content_put( &wiki, 0, 0, 0);
822
+ nrid = content_put( &wiki);
823823
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
824824
manifest_crosslink(nrid,&wiki);
825825
assert( blob_is_reset(&wiki) );
826826
content_deltify(rid,nrid,0);
827827
db_end_transaction(0);
828828
--- src/wiki.c
+++ src/wiki.c
@@ -321,11 +321,11 @@
321 }
322 blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody);
323 md5sum_blob(&wiki, &cksum);
324 blob_appendf(&wiki, "Z %b\n", &cksum);
325 blob_reset(&cksum);
326 nrid = content_put(&wiki, 0, 0, 0);
327 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
328 manifest_crosslink(nrid, &wiki);
329 assert( blob_is_reset(&wiki) );
330 content_deltify(rid, nrid, 0);
331 }
@@ -493,11 +493,11 @@
493 appendRemark(&body);
494 blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
495 md5sum_blob(&wiki, &cksum);
496 blob_appendf(&wiki, "Z %b\n", &cksum);
497 blob_reset(&cksum);
498 nrid = content_put(&wiki, 0, 0, 0);
499 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
500 manifest_crosslink(nrid, &wiki);
501 assert( blob_is_reset(&wiki) );
502 content_deltify(rid, nrid, 0);
503 db_end_transaction(0);
@@ -817,11 +817,11 @@
817 blob_str(pContent) );
818 md5sum_blob(&wiki, &cksum);
819 blob_appendf(&wiki, "Z %b\n", &cksum);
820 blob_reset(&cksum);
821 db_begin_transaction();
822 nrid = content_put( &wiki, 0, 0, 0);
823 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
824 manifest_crosslink(nrid,&wiki);
825 assert( blob_is_reset(&wiki) );
826 content_deltify(rid,nrid,0);
827 db_end_transaction(0);
828
--- src/wiki.c
+++ src/wiki.c
@@ -321,11 +321,11 @@
321 }
322 blob_appendf(&wiki, "W %d\n%s\n", strlen(zBody), zBody);
323 md5sum_blob(&wiki, &cksum);
324 blob_appendf(&wiki, "Z %b\n", &cksum);
325 blob_reset(&cksum);
326 nrid = content_put(&wiki);
327 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
328 manifest_crosslink(nrid, &wiki);
329 assert( blob_is_reset(&wiki) );
330 content_deltify(rid, nrid, 0);
331 }
@@ -493,11 +493,11 @@
493 appendRemark(&body);
494 blob_appendf(&wiki, "W %d\n%s\n", blob_size(&body), blob_str(&body));
495 md5sum_blob(&wiki, &cksum);
496 blob_appendf(&wiki, "Z %b\n", &cksum);
497 blob_reset(&cksum);
498 nrid = content_put(&wiki);
499 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
500 manifest_crosslink(nrid, &wiki);
501 assert( blob_is_reset(&wiki) );
502 content_deltify(rid, nrid, 0);
503 db_end_transaction(0);
@@ -817,11 +817,11 @@
817 blob_str(pContent) );
818 md5sum_blob(&wiki, &cksum);
819 blob_appendf(&wiki, "Z %b\n", &cksum);
820 blob_reset(&cksum);
821 db_begin_transaction();
822 nrid = content_put( &wiki);
823 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
824 manifest_crosslink(nrid,&wiki);
825 assert( blob_is_reset(&wiki) );
826 content_deltify(rid,nrid,0);
827 db_end_transaction(0);
828
+8 -8
--- src/xfer.c
+++ src/xfer.c
@@ -62,11 +62,11 @@
6262
}else{
6363
rid = 0;
6464
}
6565
db_reset(&q);
6666
if( rid==0 && phantomize ){
67
- rid = content_new(blob_str(pUuid));
67
+ rid = content_new(blob_str(pUuid), 0);
6868
}
6969
return rid;
7070
}
7171
7272
/*
@@ -132,20 +132,20 @@
132132
pXfer->nDeltaRcvd++;
133133
}else{
134134
srcid = 0;
135135
pXfer->nFileRcvd++;
136136
}
137
- rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, 0);
137
+ rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, 0, 0);
138138
remote_has(rid);
139139
blob_reset(&content);
140140
return;
141141
}
142142
if( pXfer->nToken==4 ){
143143
Blob src, next;
144144
srcid = rid_from_uuid(&pXfer->aToken[2], 1);
145145
if( content_get(srcid, &src)==0 ){
146
- rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, 0);
146
+ rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, 0, 0);
147147
pXfer->nDanglingFile++;
148148
db_multi_exec("DELETE FROM phantom WHERE rid=%d", rid);
149149
content_make_public(rid);
150150
return;
151151
}
@@ -159,11 +159,11 @@
159159
}
160160
sha1sum_blob(&content, &hash);
161161
if( !blob_eq_str(&pXfer->aToken[1], blob_str(&hash), -1) ){
162162
blob_appendf(&pXfer->err, "content does not match sha1 hash");
163163
}
164
- rid = content_put(&content, blob_str(&hash), 0, 0);
164
+ rid = content_put_ex(&content, blob_str(&hash), 0, 0, 0);
165165
blob_reset(&hash);
166166
if( rid==0 ){
167167
blob_appendf(&pXfer->err, "%s", g.zErrMsg);
168168
blob_reset(&content);
169169
}else{
@@ -226,11 +226,11 @@
226226
pXfer->nDeltaRcvd++;
227227
}else{
228228
srcid = 0;
229229
pXfer->nFileRcvd++;
230230
}
231
- rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, szC);
231
+ rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, szC, 0);
232232
remote_has(rid);
233233
blob_reset(&content);
234234
}
235235
236236
/*
@@ -617,11 +617,11 @@
617617
nRow++;
618618
if( nRow>=800 && nUncl>nRow+100 ){
619619
md5sum_blob(&cluster, &cksum);
620620
blob_appendf(&cluster, "Z %b\n", &cksum);
621621
blob_reset(&cksum);
622
- rid = content_put(&cluster, 0, 0, 0);
622
+ rid = content_put(&cluster);
623623
blob_reset(&cluster);
624624
nUncl -= nRow;
625625
nRow = 0;
626626
blob_appendf(&deleteWhere, ",%d", rid);
627627
}
@@ -634,11 +634,11 @@
634634
blob_reset(&deleteWhere);
635635
if( nRow>0 ){
636636
md5sum_blob(&cluster, &cksum);
637637
blob_appendf(&cluster, "Z %b\n", &cksum);
638638
blob_reset(&cksum);
639
- content_put(&cluster, 0, 0, 0);
639
+ content_put(&cluster);
640640
blob_reset(&cluster);
641641
}
642642
}
643643
}
644644
@@ -1368,11 +1368,11 @@
13681368
){
13691369
int rid = rid_from_uuid(&xfer.aToken[1], 0);
13701370
if( rid>0 ){
13711371
content_make_public(rid);
13721372
}else if( pullFlag || cloneFlag ){
1373
- rid = content_new(blob_str(&xfer.aToken[1]));
1373
+ rid = content_new(blob_str(&xfer.aToken[1]), 0);
13741374
if( rid ) newPhantom = 1;
13751375
}
13761376
remote_has(rid);
13771377
}else
13781378
13791379
--- src/xfer.c
+++ src/xfer.c
@@ -62,11 +62,11 @@
62 }else{
63 rid = 0;
64 }
65 db_reset(&q);
66 if( rid==0 && phantomize ){
67 rid = content_new(blob_str(pUuid));
68 }
69 return rid;
70 }
71
72 /*
@@ -132,20 +132,20 @@
132 pXfer->nDeltaRcvd++;
133 }else{
134 srcid = 0;
135 pXfer->nFileRcvd++;
136 }
137 rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, 0);
138 remote_has(rid);
139 blob_reset(&content);
140 return;
141 }
142 if( pXfer->nToken==4 ){
143 Blob src, next;
144 srcid = rid_from_uuid(&pXfer->aToken[2], 1);
145 if( content_get(srcid, &src)==0 ){
146 rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, 0);
147 pXfer->nDanglingFile++;
148 db_multi_exec("DELETE FROM phantom WHERE rid=%d", rid);
149 content_make_public(rid);
150 return;
151 }
@@ -159,11 +159,11 @@
159 }
160 sha1sum_blob(&content, &hash);
161 if( !blob_eq_str(&pXfer->aToken[1], blob_str(&hash), -1) ){
162 blob_appendf(&pXfer->err, "content does not match sha1 hash");
163 }
164 rid = content_put(&content, blob_str(&hash), 0, 0);
165 blob_reset(&hash);
166 if( rid==0 ){
167 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
168 blob_reset(&content);
169 }else{
@@ -226,11 +226,11 @@
226 pXfer->nDeltaRcvd++;
227 }else{
228 srcid = 0;
229 pXfer->nFileRcvd++;
230 }
231 rid = content_put(&content, blob_str(&pXfer->aToken[1]), srcid, szC);
232 remote_has(rid);
233 blob_reset(&content);
234 }
235
236 /*
@@ -617,11 +617,11 @@
617 nRow++;
618 if( nRow>=800 && nUncl>nRow+100 ){
619 md5sum_blob(&cluster, &cksum);
620 blob_appendf(&cluster, "Z %b\n", &cksum);
621 blob_reset(&cksum);
622 rid = content_put(&cluster, 0, 0, 0);
623 blob_reset(&cluster);
624 nUncl -= nRow;
625 nRow = 0;
626 blob_appendf(&deleteWhere, ",%d", rid);
627 }
@@ -634,11 +634,11 @@
634 blob_reset(&deleteWhere);
635 if( nRow>0 ){
636 md5sum_blob(&cluster, &cksum);
637 blob_appendf(&cluster, "Z %b\n", &cksum);
638 blob_reset(&cksum);
639 content_put(&cluster, 0, 0, 0);
640 blob_reset(&cluster);
641 }
642 }
643 }
644
@@ -1368,11 +1368,11 @@
1368 ){
1369 int rid = rid_from_uuid(&xfer.aToken[1], 0);
1370 if( rid>0 ){
1371 content_make_public(rid);
1372 }else if( pullFlag || cloneFlag ){
1373 rid = content_new(blob_str(&xfer.aToken[1]));
1374 if( rid ) newPhantom = 1;
1375 }
1376 remote_has(rid);
1377 }else
1378
1379
--- src/xfer.c
+++ src/xfer.c
@@ -62,11 +62,11 @@
62 }else{
63 rid = 0;
64 }
65 db_reset(&q);
66 if( rid==0 && phantomize ){
67 rid = content_new(blob_str(pUuid), 0);
68 }
69 return rid;
70 }
71
72 /*
@@ -132,20 +132,20 @@
132 pXfer->nDeltaRcvd++;
133 }else{
134 srcid = 0;
135 pXfer->nFileRcvd++;
136 }
137 rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, 0, 0);
138 remote_has(rid);
139 blob_reset(&content);
140 return;
141 }
142 if( pXfer->nToken==4 ){
143 Blob src, next;
144 srcid = rid_from_uuid(&pXfer->aToken[2], 1);
145 if( content_get(srcid, &src)==0 ){
146 rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, 0, 0);
147 pXfer->nDanglingFile++;
148 db_multi_exec("DELETE FROM phantom WHERE rid=%d", rid);
149 content_make_public(rid);
150 return;
151 }
@@ -159,11 +159,11 @@
159 }
160 sha1sum_blob(&content, &hash);
161 if( !blob_eq_str(&pXfer->aToken[1], blob_str(&hash), -1) ){
162 blob_appendf(&pXfer->err, "content does not match sha1 hash");
163 }
164 rid = content_put_ex(&content, blob_str(&hash), 0, 0, 0);
165 blob_reset(&hash);
166 if( rid==0 ){
167 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
168 blob_reset(&content);
169 }else{
@@ -226,11 +226,11 @@
226 pXfer->nDeltaRcvd++;
227 }else{
228 srcid = 0;
229 pXfer->nFileRcvd++;
230 }
231 rid = content_put_ex(&content, blob_str(&pXfer->aToken[1]), srcid, szC, 0);
232 remote_has(rid);
233 blob_reset(&content);
234 }
235
236 /*
@@ -617,11 +617,11 @@
617 nRow++;
618 if( nRow>=800 && nUncl>nRow+100 ){
619 md5sum_blob(&cluster, &cksum);
620 blob_appendf(&cluster, "Z %b\n", &cksum);
621 blob_reset(&cksum);
622 rid = content_put(&cluster);
623 blob_reset(&cluster);
624 nUncl -= nRow;
625 nRow = 0;
626 blob_appendf(&deleteWhere, ",%d", rid);
627 }
@@ -634,11 +634,11 @@
634 blob_reset(&deleteWhere);
635 if( nRow>0 ){
636 md5sum_blob(&cluster, &cksum);
637 blob_appendf(&cluster, "Z %b\n", &cksum);
638 blob_reset(&cksum);
639 content_put(&cluster);
640 blob_reset(&cluster);
641 }
642 }
643 }
644
@@ -1368,11 +1368,11 @@
1368 ){
1369 int rid = rid_from_uuid(&xfer.aToken[1], 0);
1370 if( rid>0 ){
1371 content_make_public(rid);
1372 }else if( pullFlag || cloneFlag ){
1373 rid = content_new(blob_str(&xfer.aToken[1]), 0);
1374 if( rid ) newPhantom = 1;
1375 }
1376 remote_has(rid);
1377 }else
1378
1379

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button