161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
if( manifestCache.aRid[i]>0 ){
manifest_clear(&manifestCache.aLine[i]);
}
}
memset(&manifestCache, 0, sizeof(manifestCache));
}
/*
** Parse a blob into a Manifest object. The Manifest object
** takes over the input blob and will free it when the
** Manifest object is freed. Zeros are inserted into the blob
** as string terminators so that blob should not be used again.
**
** Return TRUE if the content really is a control file of some
|
>
>
>
>
>
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
if( manifestCache.aRid[i]>0 ){
manifest_clear(&manifestCache.aLine[i]);
}
}
memset(&manifestCache, 0, sizeof(manifestCache));
}
#ifdef FOSSIL_DONT_VERIFY_MANIFEST_MD5SUM
# define md5sum_init(X)
# define md5sum_step_text(X,Y)
#endif
/*
** Parse a blob into a Manifest object. The Manifest object
** takes over the input blob and will free it when the
** Manifest object is freed. Zeros are inserted into the blob
** as string terminators so that blob should not be used again.
**
** Return TRUE if the content really is a control file of some
|
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
|
** line. This must be the last record.
**
** This card is required for all control file types except for
** Manifest. It is not required for manifest only for historical
** compatibility reasons.
*/
case 'Z': {
int rc;
Blob hash;
if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error;
if( blob_token(&line, &a2)!=0 ) goto manifest_syntax_error;
if( blob_size(&a1)!=32 ) goto manifest_syntax_error;
if( !validate16(blob_buffer(&a1), 32) ) goto manifest_syntax_error;
md5sum_finish(&hash);
rc = blob_compare(&hash, &a1);
blob_reset(&hash);
if( rc!=0 ) goto manifest_syntax_error;
seenZ = 1;
break;
}
default: {
goto manifest_syntax_error;
}
}
|
>
>
>
>
|
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
|
** line. This must be the last record.
**
** This card is required for all control file types except for
** Manifest. It is not required for manifest only for historical
** compatibility reasons.
*/
case 'Z': {
#ifndef FOSSIL_DONT_VERIFY_MANIFEST_MD5SUM
int rc;
Blob hash;
#endif
if( blob_token(&line, &a1)==0 ) goto manifest_syntax_error;
if( blob_token(&line, &a2)!=0 ) goto manifest_syntax_error;
if( blob_size(&a1)!=32 ) goto manifest_syntax_error;
if( !validate16(blob_buffer(&a1), 32) ) goto manifest_syntax_error;
#ifndef FOSSIL_DONT_VERIFY_MANIFEST_MD5SUM
md5sum_finish(&hash);
rc = blob_compare(&hash, &a1);
blob_reset(&hash);
if( rc!=0 ) goto manifest_syntax_error;
#endif
seenZ = 1;
break;
}
default: {
goto manifest_syntax_error;
}
}
|
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
|
manifest_clear(p);
return 0;
}
/*
** COMMAND: test-parse-manifest
**
** Usage: %fossil test-parse-manifest FILENAME
**
** Parse the manifest and discarded. Use for testing only.
*/
void manifest_test_parse_cmd(void){
Manifest m;
Blob b;
if( g.argc!=3 ){
usage("FILENAME");
}
db_must_be_within_tree();
blob_read_from_file(&b, g.argv[2]);
manifest_parse(&m, &b);
manifest_clear(&m);
}
/*
** Translate a filename into a filename-id (fnid). Create a new fnid
** if no previously exists.
*/
static int filename_to_fnid(const char *zFilename){
|
|
>
>
|
>
>
>
>
|
|
>
|
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
|
manifest_clear(p);
return 0;
}
/*
** COMMAND: test-parse-manifest
**
** Usage: %fossil test-parse-manifest FILENAME ?N?
**
** Parse the manifest and discarded. Use for testing only.
*/
void manifest_test_parse_cmd(void){
Manifest m;
Blob b;
int i;
int n = 1;
if( g.argc!=3 && g.argc!=4 ){
usage("FILENAME");
}
db_must_be_within_tree();
blob_read_from_file(&b, g.argv[2]);
if( g.argc>3 ) n = atoi(g.argv[3]);
for(i=0; i<n; i++){
Blob b2;
blob_copy(&b2, &b);
manifest_parse(&m, &b2);
manifest_clear(&m);
}
}
/*
** Translate a filename into a filename-id (fnid). Create a new fnid
** if no previously exists.
*/
static int filename_to_fnid(const char *zFilename){
|