Separated abstractfile from dmg

This commit is contained in:
planetbeing 2008-05-16 10:34:17 -07:00
Родитель 842d55e1b7
Коммит 8efb3727dd
8 изменённых файлов: 51 добавлений и 48 удалений

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

@ -1,5 +1,5 @@
DMGOBJS=dmg.o base64.o resources.o checksum.o udif.o partition.o io.o abstractfile.o filevault.o dmgfile.o zlib-1.2.3/libz.a openssl-0.9.8g/libcrypto.a
HFSOBJS=../hfs/volume.o ../hfs/btree.o ../hfs/extents.o ../hfs/rawfile.o ../hfs/catalog.o ../hfs/flatfile.o ../hfs/utility.o ../hfs/fastunicodecompare.o
DMGOBJS=dmg.o base64.o resources.o checksum.o udif.o partition.o io.o filevault.o dmgfile.o zlib-1.2.3/libz.a openssl-0.9.8g/libcrypto.a
HFSOBJS=../hfs/volume.o ../hfs/btree.o ../hfs/extents.o ../hfs/rawfile.o ../hfs/catalog.o ../hfs/flatfile.o ../hfs/utility.o ../hfs/fastunicodecompare.o ../hfs/abstractfile.o
CFLAGS=-D_FILE_OFFSET_BITS=64 -DHAVE_CRYPT
LIBRARIES=`if $(CC) win32test.c -o /dev/null 2>/dev/null ; then echo ""; else echo "-lgdi32"; fi`
@ -17,7 +17,8 @@ zlib-1.2.3/Makefile:
zlib-1.2.3/libz.a: zlib-1.2.3/Makefile
cd zlib-1.2.3; make
openssl-0.9.8g/libcrypto.a:
openssl-0.9.8g/libcrypto.a:
touch openssl-0.9.8g/Makefile
cd openssl-0.9.8g/crypto; make
clean:

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

@ -5,7 +5,8 @@
#include <stdint.h>
#include <stdio.h>
#include "../hfs/hfsplus.h"
#include "../hfs/hfsplus.h"
#include "../hfs/abstractfile.h"
#define CHECKSUM_CRC32 0x00000002
#define CHECKSUM_MKBLOCK 0x0002
@ -221,26 +222,6 @@ typedef struct ResourceData {
typedef void (*FlipDataFunc)(unsigned char* data, char out);
typedef void (*ChecksumFunc)(void* ckSum, const unsigned char* data, size_t len);
typedef struct AbstractFile AbstractFile;
typedef size_t (*WriteFunc)(AbstractFile* file, const void* data, size_t len);
typedef size_t (*ReadFunc)(AbstractFile* file, void* data, size_t len);
typedef int (*SeekFunc)(AbstractFile* file, off_t offset);
typedef off_t (*TellFunc)(AbstractFile* file);
typedef void (*CloseFunc)(AbstractFile* file);
typedef off_t (*GetLengthFunc)(AbstractFile* file);
struct AbstractFile {
void* data;
WriteFunc write;
ReadFunc read;
SeekFunc seek;
TellFunc tell;
GetLengthFunc getLength;
CloseFunc close;
};
typedef struct ResourceKey {
unsigned char* key;
ResourceData* data;
@ -248,19 +229,6 @@ typedef struct ResourceKey {
FlipDataFunc flipData;
} ResourceKey;
typedef struct {
size_t offset;
void** buffer;
size_t bufferSize;
} MemWrapperInfo;
typedef struct {
size_t offset;
void** buffer;
size_t* bufferSize;
size_t actualBufferSize;
} MemFileWrapperInfo;
typedef struct {
unsigned long state[5];
unsigned long count[2];

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

@ -2830,8 +2830,8 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
&(nid_objs[648]),/* "Microsoft Smartcardlogin" */
&(nid_objs[136]),/* "Microsoft Trust List Signing" */
&(nid_objs[649]),/* "Microsoft Universal Principal Name" */
&(nid_objs[404]),/* "NULL" */
&(nid_objs[393]),/* "NULL" */
&(nid_objs[404]),/* "NULL" */
&(nid_objs[72]),/* "Netscape Base Url" */
&(nid_objs[76]),/* "Netscape CA Policy Url" */
&(nid_objs[74]),/* "Netscape CA Revocation Url" */
@ -3565,14 +3565,14 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={
static ASN1_OBJECT *obj_objs[NUM_OBJ]={
&(nid_objs[ 0]),/* OBJ_undef 0 */
&(nid_objs[645]),/* OBJ_itu_t 0 */
&(nid_objs[404]),/* OBJ_ccitt OBJ_itu_t */
&(nid_objs[393]),/* OBJ_joint_iso_ccitt OBJ_joint_iso_itu_t */
&(nid_objs[404]),/* OBJ_ccitt OBJ_itu_t */
&(nid_objs[645]),/* OBJ_itu_t 0 */
&(nid_objs[434]),/* OBJ_data 0 9 */
&(nid_objs[181]),/* OBJ_iso 1 */
&(nid_objs[182]),/* OBJ_member_body 1 2 */
&(nid_objs[676]),/* OBJ_identified_organization 1 3 */
&(nid_objs[379]),/* OBJ_org 1 3 */
&(nid_objs[676]),/* OBJ_identified_organization 1 3 */
&(nid_objs[646]),/* OBJ_joint_iso_itu_t 2 */
&(nid_objs[11]),/* OBJ_X500 2 5 */
&(nid_objs[647]),/* OBJ_international_organizations 2 23 */

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

@ -1,6 +1,6 @@
UTILOBJS=hdutil.o
DMGOBJS=../dmg/base64.o ../dmg/resources.o ../dmg/checksum.o ../dmg/udif.o ../dmg/partition.o ../dmg/io.o ../dmg/abstractfile.o ../dmg/filevault.o ../dmg/dmgfile.o ../dmg/zlib-1.2.3/libz.a ../dmg/openssl-0.9.8g/libcrypto.a
HFSOBJS=../hfs/volume.o ../hfs/btree.o ../hfs/extents.o ../hfs/rawfile.o ../hfs/catalog.o ../hfs/flatfile.o ../hfs/utility.o ../hfs/fastunicodecompare.o
DMGOBJS=../dmg/base64.o ../dmg/resources.o ../dmg/checksum.o ../dmg/udif.o ../dmg/partition.o ../dmg/io.o ../dmg/filevault.o ../dmg/dmgfile.o ../dmg/zlib-1.2.3/libz.a ../dmg/openssl-0.9.8g/libcrypto.a
HFSOBJS=../hfs/volume.o ../hfs/btree.o ../hfs/extents.o ../hfs/rawfile.o ../hfs/catalog.o ../hfs/flatfile.o ../hfs/utility.o ../hfs/fastunicodecompare.o ../hfs/abstractfile.o
CFLAGS=-D_FILE_OFFSET_BITS=64 -DHAVE_CRYPT
LIBRARIES=`if $(CC) win32test.c -o /dev/null 2>/dev/null ; then echo ""; else echo "-lgdi32"; fi`

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

@ -511,7 +511,7 @@ void addAllInFolder(HFSCatalogNodeID folderID, Volume* volume, const char* paren
while(list != NULL) {
name = unicodeToAscii(&list->name);
if(strcmp(name, ent->d_name) == 0) {
list->record = getLinkTarget(list->record, NULL, volume);
list->record = getLinkTarget(list->record, folderID, NULL, volume);
cnid = (list->record->recordType == kHFSPlusFolderRecord) ? (((HFSPlusCatalogFolder*)list->record)->folderID)
: (((HFSPlusCatalogFile*)list->record)->fileID);
free(name);

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

@ -1,4 +1,4 @@
HFSPLUSOBJS=btree.o catalog.o extents.o flatfile.o rawfile.o volume.o utility.o hfs.o fastunicodecompare.o
HFSPLUSOBJS=btree.o catalog.o extents.o flatfile.o rawfile.o volume.o utility.o hfs.o fastunicodecompare.o abstractfile.o
CFLAGS=-D_FILE_OFFSET_BITS=64 -O3
all: hfsplus

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

@ -1,9 +1,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "dmg.h"
#include <stdarg.h>
#include <stdint.h>
#include "abstractfile.h"
#include "common.h"
size_t freadWrapper(AbstractFile* file, void* data, size_t len) {
return fread(data, 1, len, (FILE*) (file->data));

32
hfs/abstractfile.h Normal file
Просмотреть файл

@ -0,0 +1,32 @@
typedef struct AbstractFile AbstractFile;
typedef size_t (*WriteFunc)(AbstractFile* file, const void* data, size_t len);
typedef size_t (*ReadFunc)(AbstractFile* file, void* data, size_t len);
typedef int (*SeekFunc)(AbstractFile* file, off_t offset);
typedef off_t (*TellFunc)(AbstractFile* file);
typedef void (*CloseFunc)(AbstractFile* file);
typedef off_t (*GetLengthFunc)(AbstractFile* file);
struct AbstractFile {
void* data;
WriteFunc write;
ReadFunc read;
SeekFunc seek;
TellFunc tell;
GetLengthFunc getLength;
CloseFunc close;
};
typedef struct {
size_t offset;
void** buffer;
size_t bufferSize;
} MemWrapperInfo;
typedef struct {
size_t offset;
void** buffer;
size_t* bufferSize;
size_t actualBufferSize;
} MemFileWrapperInfo;