summaryrefslogtreecommitdiff
path: root/src/lib/eet
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-07 14:32:37 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-07 15:47:59 +0900
commit7b018a9740924012e6a4f3ab9c13dfbea3780934 (patch)
treef5e5cfa604e6b96e331f85982582abfd2aeb542f /src/lib/eet
parentb031bbee9bf0b66bbe125abfaf066cd90042879a (diff)
eet - fix signature alignment and position
Diffstat (limited to 'src/lib/eet')
-rw-r--r--src/lib/eet/eet_lib.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index 579dc28faf..367c7409fd 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -481,22 +481,22 @@ eet_flush2(Eet_File *ef)
481 481
482 /* write data */ 482 /* write data */
483 data_offset = orig_data_offset; 483 data_offset = orig_data_offset;
484 pad = 0;
484 for (i = 0; i < num; i++) 485 for (i = 0; i < num; i++)
485 { 486 {
486 for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next) 487 for (efn = ef->header->directory->nodes[i]; efn; efn = efn->next)
487 { 488 {
488 if (fwrite(efn->data, efn->size, 1, fp) != 1)
489 goto write_error;
490
491 data_offset += efn->size;
492
493 pad = (((data_offset + (ALIGN - 1)) / ALIGN) * ALIGN) - data_offset;
494 if (pad > 0) 489 if (pad > 0)
495 { 490 {
496 data_offset += pad; 491 data_offset += pad;
497 if (fwrite(zeros, pad, 1, fp) != 1) 492 if (fwrite(zeros, pad, 1, fp) != 1)
498 goto write_error; 493 goto write_error;
499 } 494 }
495 if (fwrite(efn->data, efn->size, 1, fp) != 1)
496 goto write_error;
497
498 data_offset += efn->size;
499 pad = (((data_offset + (ALIGN - 1)) / ALIGN) * ALIGN) - data_offset;
500 } 500 }
501 } 501 }
502 502
@@ -882,10 +882,7 @@ eet_internal_read2(Eet_File *ef)
882 882
883 /* compute the possible position of a signature */ 883 /* compute the possible position of a signature */
884 if (signature_base_offset < (efn->offset + efn->size)) 884 if (signature_base_offset < (efn->offset + efn->size))
885 { 885 signature_base_offset = efn->offset + efn->size;
886 signature_base_offset = efn->offset +
887 (((efn->size + (ALIGN - 1)) / ALIGN) * ALIGN);
888 }
889 } 886 }
890 887
891 ef->ed = NULL; 888 ef->ed = NULL;