@@ -583,9 +583,10 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato
583
583
atom -> u .contents .option = C_BARE ;
584
584
else if (!strcmp (arg , "body" ))
585
585
atom -> u .contents .option = C_BODY ;
586
- else if (!strcmp (arg , "size" ))
586
+ else if (!strcmp (arg , "size" )) {
587
+ atom -> type = FIELD_ULONG ;
587
588
atom -> u .contents .option = C_LENGTH ;
588
- else if (!strcmp (arg , "signature" ))
589
+ } else if (!strcmp (arg , "signature" ))
589
590
atom -> u .contents .option = C_SIG ;
590
591
else if (!strcmp (arg , "subject" ))
591
592
atom -> u .contents .option = C_SUB ;
@@ -691,9 +692,10 @@ static int raw_atom_parser(struct ref_format *format UNUSED,
691
692
{
692
693
if (!arg )
693
694
atom -> u .raw_data .option = RAW_BARE ;
694
- else if (!strcmp (arg , "size" ))
695
+ else if (!strcmp (arg , "size" )) {
696
+ atom -> type = FIELD_ULONG ;
695
697
atom -> u .raw_data .option = RAW_LENGTH ;
696
- else
698
+ } else
697
699
return err_bad_arg (err , "raw" , arg );
698
700
return 0 ;
699
701
}
@@ -1859,7 +1861,8 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
1859
1861
v -> s = xmemdupz (buf , buf_size );
1860
1862
v -> s_size = buf_size ;
1861
1863
} else if (atom -> u .raw_data .option == RAW_LENGTH ) {
1862
- v -> s = xstrfmt ("%" PRIuMAX , (uintmax_t )buf_size );
1864
+ v -> value = buf_size ;
1865
+ v -> s = xstrfmt ("%" PRIuMAX , v -> value );
1863
1866
}
1864
1867
continue ;
1865
1868
}
@@ -1885,9 +1888,10 @@ static void grab_sub_body_contents(struct atom_value *val, int deref, struct exp
1885
1888
v -> s = strbuf_detach (& sb , NULL );
1886
1889
} else if (atom -> u .contents .option == C_BODY_DEP )
1887
1890
v -> s = xmemdupz (bodypos , bodylen );
1888
- else if (atom -> u .contents .option == C_LENGTH )
1889
- v -> s = xstrfmt ("%" PRIuMAX , (uintmax_t )strlen (subpos ));
1890
- else if (atom -> u .contents .option == C_BODY )
1891
+ else if (atom -> u .contents .option == C_LENGTH ) {
1892
+ v -> value = strlen (subpos );
1893
+ v -> s = xstrfmt ("%" PRIuMAX , v -> value );
1894
+ } else if (atom -> u .contents .option == C_BODY )
1891
1895
v -> s = xmemdupz (bodypos , nonsiglen );
1892
1896
else if (atom -> u .contents .option == C_SIG )
1893
1897
v -> s = xmemdupz (sigpos , siglen );
@@ -2267,6 +2271,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
2267
2271
2268
2272
v -> s_size = ATOM_SIZE_UNSPECIFIED ;
2269
2273
v -> handler = append_atom ;
2274
+ v -> value = 0 ;
2270
2275
v -> atom = atom ;
2271
2276
2272
2277
if (* name == '*' ) {
0 commit comments