Skip to content

Commit

Permalink
More XADMaster commit stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Rauchfuss committed Feb 8, 2017
1 parent ce1dd9d commit 7e62cd6
Show file tree
Hide file tree
Showing 136 changed files with 12,252 additions and 58 deletions.
1 change: 1 addition & 0 deletions Frameworks/XADMaster.framework/Modules
1 change: 1 addition & 0 deletions Frameworks/XADMaster.framework/PrivateHeaders
38 changes: 0 additions & 38 deletions Frameworks/XADMaster.framework/Versions/A/Headers/XADRC4Handle.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#import "CSHandle.h"
#import "XADException.h"

@interface XADResourceFork:NSObject
{
NSDictionary *resources;
}

+(XADResourceFork *)resourceForkWithHandle:(CSHandle *)handle;
+(XADResourceFork *)resourceForkWithHandle:(CSHandle *)handle error:(XADError *)errorptr;

-(id)init;
-(void)dealloc;

-(void)parseFromHandle:(CSHandle *)handle;
-(NSData *)resourceDataForType:(uint32_t)type identifier:(int)identifier;

-(NSMutableDictionary *)_parseResourceDataFromHandle:(CSHandle *)handle;
-(NSDictionary *)_parseMapFromHandle:(CSHandle *)handle withDataObjects:(NSMutableDictionary *)dataobjects;
-(NSDictionary *)_parseReferencesFromHandle:(CSHandle *)handle count:(int)count;

@end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework module XADMaster {
umbrella header "XADMaster.h"

export *
module * { export * }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef __WINZIP_JPEG_ARITHMETIC_DECODER_H__
#define __WINZIP_JPEG_ARITHMETIC_DECODER_H__

#include "InputStream.h"

#include <stdint.h>
#include <stdbool.h>

typedef struct WinZipJPEGArithmeticDecoder
{
WinZipJPEGReadFunction *readfunc;
void *inputcontext;

bool eof;

uint8_t currbyte,lastbyte;

uint8_t kmin2; // LPS count for reduction of Q by 4
uint8_t kmin1; // LPS count for reduction of Q by 2
uint8_t kmin; // largest LSP[sic] count for smaller Q
//uint8_t kavg; // expected average LPS count
uint8_t kmax; // smallest LPS count for larger Q
uint32_t x; // finite pricesion window on code stream
int32_t lp; // minus log p --- used only for testing
int32_t lr; // minus log of the range
int32_t lrm; // maximum lr before change index
int32_t lx; // decoder - log x
uint32_t dx; // antilog of lr -- used only for testing
} WinZipJPEGArithmeticDecoder;

typedef struct WinZipJPEGContext
{
int i;
int32_t dlrm; // difference between lrm and lr
uint8_t mps; // most probable symbol value - 0 or 1
uint8_t k; // least probable symbol count
} WinZipJPEGContext;

void InitializeWinZipJPEGArithmeticDecoder(WinZipJPEGArithmeticDecoder *self,WinZipJPEGReadFunction *readfunc, void *inputcontext);
void InitializeWinZipJPEGContext(WinZipJPEGContext *self);
void InitializeWinZipJPEGContexts(WinZipJPEGContext *first,size_t bytes);
void InitializeFixedWinZipJPEGContext(WinZipJPEGContext *self);

int NextBitFromWinZipJPEGArithmeticDecoder(WinZipJPEGArithmeticDecoder *self,WinZipJPEGContext *context);

void FlushWinZipJPEGArithmeticDecoder(WinZipJPEGArithmeticDecoder *self);

static inline bool WinZipJPEGArithmeticDecoderEncounteredEOF(WinZipJPEGArithmeticDecoder *self) { return self->eof; }

#endif

68 changes: 68 additions & 0 deletions Frameworks/XADMaster.framework/Versions/A/PrivateHeaders/Bra.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* Bra.h -- Branch converters for executables
2009-02-07 : Igor Pavlov : Public domain */

#ifndef __BRA_H
#define __BRA_H

#include "Types.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
These functions convert relative addresses to absolute addresses
in CALL instructions to increase the compression ratio.
In:
data - data buffer
size - size of data
ip - current virtual Instruction Pinter (IP) value
state - state variable for x86 converter
encoding - 0 (for decoding), 1 (for encoding)
Out:
state - state variable for x86 converter
Returns:
The number of processed bytes. If you call these functions with multiple calls,
you must start next call with first byte after block of processed bytes.
Type Endian Alignment LookAhead
x86 little 1 4
ARMT little 2 2
ARM little 4 0
PPC big 4 0
SPARC big 4 0
IA64 little 16 0
size must be >= Alignment + LookAhead, if it's not last block.
If (size < Alignment + LookAhead), converter returns 0.
Example:
UInt32 ip = 0;
for ()
{
; size must be >= Alignment + LookAhead, if it's not last block
SizeT processed = Convert(data, size, ip, 1);
data += processed;
size -= processed;
ip += processed;
}
*/

#define x86_Convert_Init(state) { state = 0; }
SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);

#ifdef __cplusplus
}
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
-(id)initWithHandle:(CSHandle *)handle length:(off_t)length bufferSize:(int)buffersize;
-(id)initAsCopyOf:(CSBlockStreamHandle *)other;

// Public methods
-(uint8_t *)blockPointer;
-(int)blockLength;
-(off_t)blockStartOffset;
-(void)skipToNextBlock;

// Implemented by this class
-(void)seekToFileOffset:(off_t)offs;
-(void)resetStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@ extern NSString *CSBzip2Exception;
CSHandle *parent;
off_t startoffs;
bz_stream bzs;
BOOL inited;
BOOL inited,checksumcorrect;

uint8_t inbuffer[16*1024];
}

+(CSBzip2Handle *)bzip2HandleWithHandle:(CSHandle *)handle;
+(CSBzip2Handle *)bzip2HandleWithHandle:(CSHandle *)handle length:(off_t)length;

// Initializers
// Initializers.
-(id)initWithHandle:(CSHandle *)handle length:(off_t)length name:(NSString *)descname;
-(void)dealloc;

// Implemented by this class
// Implemented by this class.
-(void)resetStream;
-(int)streamAtMost:(int)num toBuffer:(void *)buffer;

// Internal methods
// Checksum functions for XADMaster.
-(BOOL)hasChecksum;
-(BOOL)isChecksumCorrect;

// Internal methods.
-(void)_raiseBzip2:(int)error;

@end
Loading

0 comments on commit 7e62cd6

Please sign in to comment.