diff options
Diffstat (limited to 'xdelta1/xd_edsio.c')
-rwxr-xr-x | xdelta1/xd_edsio.c | 243 |
1 files changed, 7 insertions, 236 deletions
diff --git a/xdelta1/xd_edsio.c b/xdelta1/xd_edsio.c index 450320c..9e5c9ae 100755 --- a/xdelta1/xd_edsio.c +++ b/xdelta1/xd_edsio.c | |||
@@ -66,24 +66,7 @@ xd_edsio_init (void) | |||
66 | edsio_library_register (3, "xd"); | 66 | edsio_library_register (3, "xd"); |
67 | result = TRUE; | 67 | result = TRUE; |
68 | return TRUE; | 68 | return TRUE; |
69 | } | 69 | }; |
70 | |||
71 | /* XdeltaChecksum Count | ||
72 | */ | ||
73 | |||
74 | guint | ||
75 | serializeio_count_xdeltachecksum (guint16 high, guint16 low) { | ||
76 | guint size = sizeof (SerialXdeltaChecksum); | ||
77 | ALIGN_8 (size); | ||
78 | ALIGN_8 (size); | ||
79 | ALIGN_8 (size); | ||
80 | return size; | ||
81 | } | ||
82 | |||
83 | guint | ||
84 | serializeio_count_xdeltachecksum_obj (SerialXdeltaChecksum const* obj) { | ||
85 | return serializeio_count_xdeltachecksum (obj->high, obj->low); | ||
86 | } | ||
87 | 70 | ||
88 | /* XdeltaChecksum Print | 71 | /* XdeltaChecksum Print |
89 | */ | 72 | */ |
@@ -174,31 +157,6 @@ bail: | |||
174 | return FALSE; | 157 | return FALSE; |
175 | } | 158 | } |
176 | 159 | ||
177 | /* XdeltaIndex Count | ||
178 | */ | ||
179 | |||
180 | guint | ||
181 | serializeio_count_xdeltaindex (guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum const* index) { | ||
182 | guint size = sizeof (SerialXdeltaIndex); | ||
183 | ALIGN_8 (size); | ||
184 | ALIGN_8 (size); | ||
185 | ALIGN_8 (size); | ||
186 | { | ||
187 | gint i; | ||
188 | for (i = 0; i < index_len; i += 1) | ||
189 | { | ||
190 | size += serializeio_count_xdeltachecksum_obj (& (index[i])); | ||
191 | } | ||
192 | } | ||
193 | ALIGN_8 (size); | ||
194 | return size; | ||
195 | } | ||
196 | |||
197 | guint | ||
198 | serializeio_count_xdeltaindex_obj (SerialXdeltaIndex const* obj) { | ||
199 | return serializeio_count_xdeltaindex (obj->file_len, obj->file_md5, obj->index_len, obj->index); | ||
200 | } | ||
201 | |||
202 | /* XdeltaIndex Print | 160 | /* XdeltaIndex Print |
203 | */ | 161 | */ |
204 | 162 | ||
@@ -220,7 +178,7 @@ serializeio_print_xdeltaindex_obj (SerialXdeltaIndex* obj, guint indent_spaces) | |||
220 | for (i = 0; i < obj->index_len; i += 1) | 178 | for (i = 0; i < obj->index_len; i += 1) |
221 | { | 179 | { |
222 | print_spaces (indent_spaces); | 180 | print_spaces (indent_spaces); |
223 | g_print ("%d: ", i); | 181 | g_print ("%d:\n", i); |
224 | print_spaces (indent_spaces); | 182 | print_spaces (indent_spaces); |
225 | serializeio_print_xdeltachecksum_obj (& (obj->index[i]), indent_spaces + 2); | 183 | serializeio_print_xdeltachecksum_obj (& (obj->index[i]), indent_spaces + 2); |
226 | print_spaces (indent_spaces); | 184 | print_spaces (indent_spaces); |
@@ -321,27 +279,6 @@ bail: | |||
321 | return FALSE; | 279 | return FALSE; |
322 | } | 280 | } |
323 | 281 | ||
324 | /* XdeltaSourceInfo Count | ||
325 | */ | ||
326 | |||
327 | guint | ||
328 | serializeio_count_xdeltasourceinfo (const gchar* name, const guint8 md5[16], guint32 len, gboolean isdata, gboolean sequential) { | ||
329 | guint size = sizeof (SerialXdeltaSourceInfo); | ||
330 | ALIGN_8 (size); | ||
331 | size += strlen (name) + 1; | ||
332 | ALIGN_8 (size); | ||
333 | ALIGN_8 (size); | ||
334 | ALIGN_8 (size); | ||
335 | ALIGN_8 (size); | ||
336 | ALIGN_8 (size); | ||
337 | return size; | ||
338 | } | ||
339 | |||
340 | guint | ||
341 | serializeio_count_xdeltasourceinfo_obj (SerialXdeltaSourceInfo const* obj) { | ||
342 | return serializeio_count_xdeltasourceinfo (obj->name, obj->md5, obj->len, obj->isdata, obj->sequential); | ||
343 | } | ||
344 | |||
345 | /* XdeltaSourceInfo Print | 282 | /* XdeltaSourceInfo Print |
346 | */ | 283 | */ |
347 | 284 | ||
@@ -446,40 +383,6 @@ bail: | |||
446 | return FALSE; | 383 | return FALSE; |
447 | } | 384 | } |
448 | 385 | ||
449 | /* XdeltaControl Count | ||
450 | */ | ||
451 | |||
452 | guint | ||
453 | serializeio_count_xdeltacontrol (const guint8 to_md5[16], guint32 to_len, gboolean has_data, guint32 source_info_len, SerialXdeltaSourceInfo* const* source_info, guint32 inst_len, SerialXdeltaInstruction const* inst) { | ||
454 | guint size = sizeof (SerialXdeltaControl); | ||
455 | ALIGN_8 (size); | ||
456 | ALIGN_8 (size); | ||
457 | ALIGN_8 (size); | ||
458 | ALIGN_8 (size); | ||
459 | { | ||
460 | gint i; | ||
461 | for (i = 0; i < source_info_len; i += 1) | ||
462 | { | ||
463 | size += serializeio_count_xdeltasourceinfo_obj ((source_info[i])) + sizeof (void*); | ||
464 | } | ||
465 | } | ||
466 | ALIGN_8 (size); | ||
467 | { | ||
468 | gint i; | ||
469 | for (i = 0; i < inst_len; i += 1) | ||
470 | { | ||
471 | size += serializeio_count_xdeltainstruction_obj (& (inst[i])); | ||
472 | } | ||
473 | } | ||
474 | ALIGN_8 (size); | ||
475 | return size; | ||
476 | } | ||
477 | |||
478 | guint | ||
479 | serializeio_count_xdeltacontrol_obj (SerialXdeltaControl const* obj) { | ||
480 | return serializeio_count_xdeltacontrol (obj->to_md5, obj->to_len, obj->has_data, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); | ||
481 | } | ||
482 | |||
483 | /* XdeltaControl Print | 386 | /* XdeltaControl Print |
484 | */ | 387 | */ |
485 | 388 | ||
@@ -504,7 +407,7 @@ serializeio_print_xdeltacontrol_obj (SerialXdeltaControl* obj, guint indent_spac | |||
504 | for (i = 0; i < obj->source_info_len; i += 1) | 407 | for (i = 0; i < obj->source_info_len; i += 1) |
505 | { | 408 | { |
506 | print_spaces (indent_spaces); | 409 | print_spaces (indent_spaces); |
507 | g_print ("%d: ", i); | 410 | g_print ("%d:\n", i); |
508 | print_spaces (indent_spaces); | 411 | print_spaces (indent_spaces); |
509 | serializeio_print_xdeltasourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); | 412 | serializeio_print_xdeltasourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); |
510 | print_spaces (indent_spaces); | 413 | print_spaces (indent_spaces); |
@@ -520,7 +423,7 @@ serializeio_print_xdeltacontrol_obj (SerialXdeltaControl* obj, guint indent_spac | |||
520 | for (i = 0; i < obj->inst_len; i += 1) | 423 | for (i = 0; i < obj->inst_len; i += 1) |
521 | { | 424 | { |
522 | print_spaces (indent_spaces); | 425 | print_spaces (indent_spaces); |
523 | g_print ("%d: ", i); | 426 | g_print ("%d:\n", i); |
524 | print_spaces (indent_spaces); | 427 | print_spaces (indent_spaces); |
525 | serializeio_print_xdeltainstruction_obj (& (obj->inst[i]), indent_spaces + 2); | 428 | serializeio_print_xdeltainstruction_obj (& (obj->inst[i]), indent_spaces + 2); |
526 | print_spaces (indent_spaces); | 429 | print_spaces (indent_spaces); |
@@ -640,24 +543,6 @@ bail: | |||
640 | return FALSE; | 543 | return FALSE; |
641 | } | 544 | } |
642 | 545 | ||
643 | /* XdeltaInstruction Count | ||
644 | */ | ||
645 | |||
646 | guint | ||
647 | serializeio_count_xdeltainstruction (guint32 index, guint32 offset, guint32 length) { | ||
648 | guint size = sizeof (SerialXdeltaInstruction); | ||
649 | ALIGN_8 (size); | ||
650 | ALIGN_8 (size); | ||
651 | ALIGN_8 (size); | ||
652 | ALIGN_8 (size); | ||
653 | return size; | ||
654 | } | ||
655 | |||
656 | guint | ||
657 | serializeio_count_xdeltainstruction_obj (SerialXdeltaInstruction const* obj) { | ||
658 | return serializeio_count_xdeltainstruction (obj->index, obj->offset, obj->length); | ||
659 | } | ||
660 | |||
661 | /* XdeltaInstruction Print | 546 | /* XdeltaInstruction Print |
662 | */ | 547 | */ |
663 | 548 | ||
@@ -752,24 +637,6 @@ bail: | |||
752 | return FALSE; | 637 | return FALSE; |
753 | } | 638 | } |
754 | 639 | ||
755 | /* RsyncIndexElt Count | ||
756 | */ | ||
757 | |||
758 | guint | ||
759 | serializeio_count_rsyncindexelt (const guint8 md5[16], SerialXdeltaChecksum const* cksum) { | ||
760 | guint size = sizeof (SerialRsyncIndexElt); | ||
761 | ALIGN_8 (size); | ||
762 | ALIGN_8 (size); | ||
763 | size += serializeio_count_xdeltachecksum_obj (cksum) - sizeof (SerialXdeltaChecksum); | ||
764 | ALIGN_8 (size); | ||
765 | return size; | ||
766 | } | ||
767 | |||
768 | guint | ||
769 | serializeio_count_rsyncindexelt_obj (SerialRsyncIndexElt const* obj) { | ||
770 | return serializeio_count_rsyncindexelt (obj->md5, &obj->cksum); | ||
771 | } | ||
772 | |||
773 | /* RsyncIndexElt Print | 640 | /* RsyncIndexElt Print |
774 | */ | 641 | */ |
775 | 642 | ||
@@ -863,32 +730,6 @@ bail: | |||
863 | return FALSE; | 730 | return FALSE; |
864 | } | 731 | } |
865 | 732 | ||
866 | /* RsyncIndex Count | ||
867 | */ | ||
868 | |||
869 | guint | ||
870 | serializeio_count_rsyncindex (guint32 seg_len, guint32 file_len, const guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt const* index) { | ||
871 | guint size = sizeof (SerialRsyncIndex); | ||
872 | ALIGN_8 (size); | ||
873 | ALIGN_8 (size); | ||
874 | ALIGN_8 (size); | ||
875 | ALIGN_8 (size); | ||
876 | { | ||
877 | gint i; | ||
878 | for (i = 0; i < index_len; i += 1) | ||
879 | { | ||
880 | size += serializeio_count_rsyncindexelt_obj (& (index[i])); | ||
881 | } | ||
882 | } | ||
883 | ALIGN_8 (size); | ||
884 | return size; | ||
885 | } | ||
886 | |||
887 | guint | ||
888 | serializeio_count_rsyncindex_obj (SerialRsyncIndex const* obj) { | ||
889 | return serializeio_count_rsyncindex (obj->seg_len, obj->file_len, obj->file_md5, obj->index_len, obj->index); | ||
890 | } | ||
891 | |||
892 | /* RsyncIndex Print | 733 | /* RsyncIndex Print |
893 | */ | 734 | */ |
894 | 735 | ||
@@ -913,7 +754,7 @@ serializeio_print_rsyncindex_obj (SerialRsyncIndex* obj, guint indent_spaces) { | |||
913 | for (i = 0; i < obj->index_len; i += 1) | 754 | for (i = 0; i < obj->index_len; i += 1) |
914 | { | 755 | { |
915 | print_spaces (indent_spaces); | 756 | print_spaces (indent_spaces); |
916 | g_print ("%d: ", i); | 757 | g_print ("%d:\n", i); |
917 | print_spaces (indent_spaces); | 758 | print_spaces (indent_spaces); |
918 | serializeio_print_rsyncindexelt_obj (& (obj->index[i]), indent_spaces + 2); | 759 | serializeio_print_rsyncindexelt_obj (& (obj->index[i]), indent_spaces + 2); |
919 | print_spaces (indent_spaces); | 760 | print_spaces (indent_spaces); |
@@ -1016,24 +857,6 @@ bail: | |||
1016 | return FALSE; | 857 | return FALSE; |
1017 | } | 858 | } |
1018 | 859 | ||
1019 | /* Version0SourceInfo Count | ||
1020 | */ | ||
1021 | |||
1022 | guint | ||
1023 | serializeio_count_version0sourceinfo (const guint8 md5[16], const guint8 real_md5[16], guint32 length) { | ||
1024 | guint size = sizeof (SerialVersion0SourceInfo); | ||
1025 | ALIGN_8 (size); | ||
1026 | ALIGN_8 (size); | ||
1027 | ALIGN_8 (size); | ||
1028 | ALIGN_8 (size); | ||
1029 | return size; | ||
1030 | } | ||
1031 | |||
1032 | guint | ||
1033 | serializeio_count_version0sourceinfo_obj (SerialVersion0SourceInfo const* obj) { | ||
1034 | return serializeio_count_version0sourceinfo (obj->md5, obj->real_md5, obj->length); | ||
1035 | } | ||
1036 | |||
1037 | /* Version0SourceInfo Print | 860 | /* Version0SourceInfo Print |
1038 | */ | 861 | */ |
1039 | 862 | ||
@@ -1128,41 +951,6 @@ bail: | |||
1128 | return FALSE; | 951 | return FALSE; |
1129 | } | 952 | } |
1130 | 953 | ||
1131 | /* Version0Control Count | ||
1132 | */ | ||
1133 | |||
1134 | guint | ||
1135 | serializeio_count_version0control (gboolean normalized, guint32 data_len, SerialVersion0SourceInfo const* to_info, guint32 source_info_len, SerialVersion0SourceInfo* const* source_info, guint32 inst_len, SerialVersion0Instruction const* inst) { | ||
1136 | guint size = sizeof (SerialVersion0Control); | ||
1137 | ALIGN_8 (size); | ||
1138 | ALIGN_8 (size); | ||
1139 | ALIGN_8 (size); | ||
1140 | size += serializeio_count_version0sourceinfo_obj (to_info) - sizeof (SerialVersion0SourceInfo); | ||
1141 | ALIGN_8 (size); | ||
1142 | { | ||
1143 | gint i; | ||
1144 | for (i = 0; i < source_info_len; i += 1) | ||
1145 | { | ||
1146 | size += serializeio_count_version0sourceinfo_obj ((source_info[i])) + sizeof (void*); | ||
1147 | } | ||
1148 | } | ||
1149 | ALIGN_8 (size); | ||
1150 | { | ||
1151 | gint i; | ||
1152 | for (i = 0; i < inst_len; i += 1) | ||
1153 | { | ||
1154 | size += serializeio_count_version0instruction_obj (& (inst[i])); | ||
1155 | } | ||
1156 | } | ||
1157 | ALIGN_8 (size); | ||
1158 | return size; | ||
1159 | } | ||
1160 | |||
1161 | guint | ||
1162 | serializeio_count_version0control_obj (SerialVersion0Control const* obj) { | ||
1163 | return serializeio_count_version0control (obj->normalized, obj->data_len, &obj->to_info, obj->source_info_len, obj->source_info, obj->inst_len, obj->inst); | ||
1164 | } | ||
1165 | |||
1166 | /* Version0Control Print | 954 | /* Version0Control Print |
1167 | */ | 955 | */ |
1168 | 956 | ||
@@ -1191,7 +979,7 @@ serializeio_print_version0control_obj (SerialVersion0Control* obj, guint indent_ | |||
1191 | for (i = 0; i < obj->source_info_len; i += 1) | 979 | for (i = 0; i < obj->source_info_len; i += 1) |
1192 | { | 980 | { |
1193 | print_spaces (indent_spaces); | 981 | print_spaces (indent_spaces); |
1194 | g_print ("%d: ", i); | 982 | g_print ("%d:\n", i); |
1195 | print_spaces (indent_spaces); | 983 | print_spaces (indent_spaces); |
1196 | serializeio_print_version0sourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); | 984 | serializeio_print_version0sourceinfo_obj ((obj->source_info[i]), indent_spaces + 2); |
1197 | print_spaces (indent_spaces); | 985 | print_spaces (indent_spaces); |
@@ -1207,7 +995,7 @@ serializeio_print_version0control_obj (SerialVersion0Control* obj, guint indent_ | |||
1207 | for (i = 0; i < obj->inst_len; i += 1) | 995 | for (i = 0; i < obj->inst_len; i += 1) |
1208 | { | 996 | { |
1209 | print_spaces (indent_spaces); | 997 | print_spaces (indent_spaces); |
1210 | g_print ("%d: ", i); | 998 | g_print ("%d:\n", i); |
1211 | print_spaces (indent_spaces); | 999 | print_spaces (indent_spaces); |
1212 | serializeio_print_version0instruction_obj (& (obj->inst[i]), indent_spaces + 2); | 1000 | serializeio_print_version0instruction_obj (& (obj->inst[i]), indent_spaces + 2); |
1213 | print_spaces (indent_spaces); | 1001 | print_spaces (indent_spaces); |
@@ -1327,23 +1115,6 @@ bail: | |||
1327 | return FALSE; | 1115 | return FALSE; |
1328 | } | 1116 | } |
1329 | 1117 | ||
1330 | /* Version0Instruction Count | ||
1331 | */ | ||
1332 | |||
1333 | guint | ||
1334 | serializeio_count_version0instruction (guint32 offset, guint32 length) { | ||
1335 | guint size = sizeof (SerialVersion0Instruction); | ||
1336 | ALIGN_8 (size); | ||
1337 | ALIGN_8 (size); | ||
1338 | ALIGN_8 (size); | ||
1339 | return size; | ||
1340 | } | ||
1341 | |||
1342 | guint | ||
1343 | serializeio_count_version0instruction_obj (SerialVersion0Instruction const* obj) { | ||
1344 | return serializeio_count_version0instruction (obj->offset, obj->length); | ||
1345 | } | ||
1346 | |||
1347 | /* Version0Instruction Print | 1118 | /* Version0Instruction Print |
1348 | */ | 1119 | */ |
1349 | 1120 | ||