equal
deleted
inserted
replaced
25 |
25 |
26 #define FIO_BUFFER_SIZE 512 |
26 #define FIO_BUFFER_SIZE 512 |
27 |
27 |
28 struct Fio { |
28 struct Fio { |
29 byte *buffer, *buffer_end; ///< position pointer in local buffer and last valid byte of buffer |
29 byte *buffer, *buffer_end; ///< position pointer in local buffer and last valid byte of buffer |
30 uint32 pos; ///< current (system) position in file |
30 size_t pos; ///< current (system) position in file |
31 FILE *cur_fh; ///< current file handle |
31 FILE *cur_fh; ///< current file handle |
32 const char *filename; ///< current filename |
32 const char *filename; ///< current filename |
33 FILE *handles[MAX_FILE_SLOTS]; ///< array of file handles we can have open |
33 FILE *handles[MAX_FILE_SLOTS]; ///< array of file handles we can have open |
34 byte buffer_start[FIO_BUFFER_SIZE]; ///< local buffer when read from file |
34 byte buffer_start[FIO_BUFFER_SIZE]; ///< local buffer when read from file |
35 const char *filenames[MAX_FILE_SLOTS]; ///< array of filenames we (should) have open |
35 const char *filenames[MAX_FILE_SLOTS]; ///< array of filenames we (should) have open |
123 { |
123 { |
124 uint b = FioReadWord(); |
124 uint b = FioReadWord(); |
125 return (FioReadWord() << 16) | b; |
125 return (FioReadWord() << 16) | b; |
126 } |
126 } |
127 |
127 |
128 void FioReadBlock(void *ptr, uint size) |
128 void FioReadBlock(void *ptr, size_t size) |
129 { |
129 { |
130 FioSeekTo(FioGetPos(), SEEK_SET); |
130 FioSeekTo(FioGetPos(), SEEK_SET); |
131 _fio.pos += fread(ptr, 1, size, _fio.cur_fh); |
131 _fio.pos += fread(ptr, 1, size, _fio.cur_fh); |
132 } |
132 } |
133 |
133 |
478 _tar_list.insert(TarList::value_type(filename, tar_entry)); |
478 _tar_list.insert(TarList::value_type(filename, tar_entry)); |
479 |
479 |
480 TarHeader th; |
480 TarHeader th; |
481 char buf[sizeof(th.name) + 1], *end; |
481 char buf[sizeof(th.name) + 1], *end; |
482 char name[sizeof(th.prefix) + 1 + sizeof(th.name) + 1]; |
482 char name[sizeof(th.prefix) + 1 + sizeof(th.name) + 1]; |
483 int num = 0, pos = 0; |
483 size_t num = 0, pos = 0; |
484 |
484 |
485 /* Make a char of 512 empty bytes */ |
485 /* Make a char of 512 empty bytes */ |
486 char empty[512]; |
486 char empty[512]; |
487 memset(&empty[0], 0, sizeof(empty)); |
487 memset(&empty[0], 0, sizeof(empty)); |
488 |
488 |
497 DEBUG(misc, 0, "The file '%s' isn't a valid tar-file", filename); |
497 DEBUG(misc, 0, "The file '%s' isn't a valid tar-file", filename); |
498 return false; |
498 return false; |
499 } |
499 } |
500 |
500 |
501 name[0] = '\0'; |
501 name[0] = '\0'; |
502 int len = 0; |
502 size_t len = 0; |
503 |
503 |
504 /* The prefix contains the directory-name */ |
504 /* The prefix contains the directory-name */ |
505 if (th.prefix[0] != '\0') { |
505 if (th.prefix[0] != '\0') { |
506 memcpy(name, th.prefix, sizeof(th.prefix)); |
506 memcpy(name, th.prefix, sizeof(th.prefix)); |
507 name[sizeof(th.prefix)] = '\0'; |
507 name[sizeof(th.prefix)] = '\0'; |
548 fclose(f); |
548 fclose(f); |
549 |
549 |
550 return true; |
550 return true; |
551 } |
551 } |
552 |
552 |
553 static int ScanPathForTarFiles(const char *path, int basepath_length) |
553 static int ScanPathForTarFiles(const char *path, size_t basepath_length) |
554 { |
554 { |
555 extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb); |
555 extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb); |
556 |
556 |
557 uint num = 0; |
557 uint num = 0; |
558 struct stat sb; |
558 struct stat sb; |