This commit is contained in:
planetbeing 2008-08-04 04:03:22 -04:00
Родитель fc2ae6be8e
Коммит f6092c564a
1 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -12,14 +12,17 @@
#define BUFSIZE 1024*1024
void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume) {
unsigned char buffer[BUFSIZE];
unsigned char* buffer;
io_func* io;
off_t curPosition;
size_t bytesLeft;
buffer = (unsigned char*) malloc(BUFSIZE);
io = openRawFile(file->fileID, &file->dataFork, (HFSPlusCatalogRecord*)file, volume);
if(io == NULL) {
hfs_panic("error opening file");
free(buffer);
return;
}
@ -48,19 +51,24 @@ void writeToFile(HFSPlusCatalogFile* file, AbstractFile* output, Volume* volume)
}
}
CLOSE(io);
free(buffer);
}
void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volume) {
unsigned char buffer[BUFSIZE];
unsigned char *buffer;
io_func* io;
off_t curPosition;
off_t bytesLeft;
buffer = (unsigned char*) malloc(BUFSIZE);
bytesLeft = input->getLength(input);
io = openRawFile(file->fileID, &file->dataFork, (HFSPlusCatalogRecord*)file, volume);
if(io == NULL) {
hfs_panic("error opening file");
free(buffer);
return;
}
@ -91,6 +99,8 @@ void writeToHFSFile(HFSPlusCatalogFile* file, AbstractFile* input, Volume* volum
}
CLOSE(io);
free(buffer);
}
void get_hfs(Volume* volume, const char* inFileName, AbstractFile* output) {