Index: trunk/i386/libsaio/xml.h =================================================================== --- trunk/i386/libsaio/xml.h (revision 2582) +++ trunk/i386/libsaio/xml.h (revision 2583) @@ -2,7 +2,7 @@ * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ - * + * * Portions Copyright (c) 2003 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public @@ -10,7 +10,7 @@ * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource and read it before using * this file. - * + * * The Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -18,7 +18,7 @@ * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. - * + * * @APPLE_LICENSE_HEADER_END@ */ @@ -40,13 +40,13 @@ struct string_ref { - char* string; + char *string; int id; - struct string_ref* next; + struct string_ref *next; }; typedef struct string_ref string_ref; -extern string_ref* ref_strings; +extern string_ref *ref_strings; #define kXMLTagPList "plist " #define kXMLTagDict "dict" @@ -63,27 +63,17 @@ #define kXMLStringID "ID=" #define kXMLStringIDRef "IDREF=" -#define kPropCFBundleIdentifier ("CFBundleIdentifier") -#define kPropCFBundleExecutable ("CFBundleExecutable") -#define kPropOSBundleRequired ("OSBundleRequired") -#define kPropOSBundleLibraries ("OSBundleLibraries") -#define kPropIOKitPersonalities ("IOKitPersonalities") -#define kPropIONameMatch ("IONameMatch") +#define kPropCFBundleIdentifier ("CFBundleIdentifier") +#define kPropCFBundleExecutable ("CFBundleExecutable") +#define kPropOSBundleRequired ("OSBundleRequired") +#define kPropOSBundleLibraries ("OSBundleLibraries") +#define kPropIOKitPersonalities ("IOKitPersonalities") +#define kPropIONameMatch ("IONameMatch") -/* -struct Tag { - long type; - char *string; - struct Tag *tag; - struct Tag *tagNext; -}; -typedef struct Tag Tag, *TagPtr; - */ - extern long gImageFirstBootXAddr; extern long gImageLastKernelAddr; -TagPtr XMLGetProperty( TagPtr dict, const char * key ); +TagPtr XMLGetProperty( TagPtr dict, const char *key ); TagPtr XMLGetElement( TagPtr dict, int id ); TagPtr XMLGetKey( TagPtr dict, int id ); TagPtr XMLGetValueForKey(TagPtr key); @@ -98,7 +88,7 @@ int XMLCastInteger ( TagPtr dict ); TagPtr XMLCastDict ( TagPtr dict ); TagPtr XMLCastArray( TagPtr dict ); -char* XMLCastData( TagPtr dict, int* length ); +char* XMLCastData( TagPtr dict, int *length ); bool XMLIsBoolean(TagPtr entry); bool XMLIsString (TagPtr entry); @@ -108,7 +98,7 @@ bool XMLIsData (TagPtr entry); -bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value); +bool XMLAddTagToDictionary(TagPtr dict, char *key, TagPtr value); long XMLParseNextTag(char *buffer, TagPtr *tag); void XMLFreeTag(TagPtr tag); @@ -119,11 +109,11 @@ // Puts the first dictionary it finds in the // tag pointer and returns 0, or returns -1 if not found. // -long XMLParseFile( char * buffer, TagPtr * dict ); +long XMLParseFile( char *buffer, TagPtr *dict ); //========================================================================== // ParseTag* -long ParseTagBoolean( char * buffer, TagPtr * tag, long type ); +long ParseTagBoolean( char *buffer, TagPtr *tag, long type ); #endif /* __LIBSAIO_XML_H */ Index: trunk/i386/libsaio/ntfs_private.h =================================================================== --- trunk/i386/libsaio/ntfs_private.h (revision 2582) +++ trunk/i386/libsaio/ntfs_private.h (revision 2583) @@ -147,7 +147,7 @@ u_int64_t t_write; u_int64_t t_mftwrite; u_int64_t t_access; -} ntfs_times_t; +} ntfs_times_t; #define NTFS_FFLAG_RDONLY 0x01LL #define NTFS_FFLAG_HIDDEN 0x02LL Index: trunk/i386/libsaio/pci_root.c =================================================================== --- trunk/i386/libsaio/pci_root.c (revision 2582) +++ trunk/i386/libsaio/pci_root.c (revision 2583) @@ -49,7 +49,7 @@ void *new_dsdt; const char *val; - int len,fsize; + int len, fsize; const char * dsdt_filename = NULL; extern int search_and_get_acpi_fd(const char *, const char **); Index: trunk/i386/libsaio/nvidia.c =================================================================== --- trunk/i386/libsaio/nvidia.c (revision 2582) +++ trunk/i386/libsaio/nvidia.c (revision 2583) @@ -1963,7 +1963,6 @@ unsigned long long mem_detect(volatile uint8_t *regs, uint8_t nvCardType, pci_dt_t *nvda_dev, uint32_t device_id, uint32_t subsys_id) { uint64_t vram_size = 0; - // unsigned long long vram_size = 0; // First check if any value exist in the plist cardList_t * nvcard = FindCardWithIds(device_id, subsys_id); Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 2582) +++ trunk/i386/libsaio/disk.c (revision 2583) @@ -975,7 +975,13 @@ { // Create a new mapping. - map = (struct DiskBVMap *)malloc(sizeof(*map)); + map = (struct DiskBVMap *) malloc(sizeof(*map)); + + if ( !map ) + { + return NULL; + } + if ( map ) { map->biosdev = biosdev; @@ -1430,7 +1436,7 @@ // Determine whether the partition header signature is present. - if (memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG))) + if ( memcmp(headerMap->hdr_sig, GPT_HDR_SIG, strlen(GPT_HDR_SIG)) ) { goto scanErr; } @@ -1493,6 +1499,8 @@ goto scanErr; } + bzero(buffer,bufferSize); + if (readBytes(biosdev, gptBlock, 0, bufferSize, buffer) != 0) { goto scanErr; @@ -2218,7 +2226,7 @@ * hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" "alias"; etc... */ -bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen) +static bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen) { char *aliasList, *entryStart, *entryNext; Index: trunk/i386/libsaio/smbios.h =================================================================== --- trunk/i386/libsaio/smbios.h (revision 2582) +++ trunk/i386/libsaio/smbios.h (revision 2583) @@ -833,7 +833,7 @@ typedef struct SMBOemProcessorBusSpeed { SMB_STRUCT_HEADER // Type 132 - SMBWord ProcessorBusSpeed; // MT/s unit + SMBWord ProcessorBusSpeed; // MT/s unit } __attribute__((packed)) SMBOemProcessorBusSpeed; //---------------------------------------------------------------------------------------------------------- Index: trunk/i386/libsaio/pci.c =================================================================== --- trunk/i386/libsaio/pci.c (revision 2582) +++ trunk/i386/libsaio/pci.c (revision 2583) @@ -16,7 +16,7 @@ #if DEBUG_PCI #define DBG(x...) printf(x) #else -#define DBG(x...) +#define DBG(x...) msglog(x) #endif pci_dt_t *root_pci_dev; Index: trunk/i386/boot2/graphics.c =================================================================== --- trunk/i386/boot2/graphics.c (revision 2582) +++ trunk/i386/boot2/graphics.c (revision 2583) @@ -1120,8 +1120,8 @@ unsigned long numbers[], unsigned long maxArrayCount ) { - char *propStr; - unsigned long count = 0; + char *propStr; + unsigned long count = 0; propStr = newStringForKey((char *)propKey , &bootInfo->chameleonConfig); Index: trunk/i386/boot2/mboot.c =================================================================== --- trunk/i386/boot2/mboot.c (revision 2582) +++ trunk/i386/boot2/mboot.c (revision 2583) @@ -290,8 +290,8 @@ continue_at_low_address(); // Now fix our return address. - // JrCs: this macro should be rewritten because the code generated by XCode 4.x - // change the value of the argument passed as parameter (multiboot_magic) + // JrCs: this macro should be rewritten because the code generated by XCode 4.x + // change the value of the argument passed as parameter (multiboot_magic) // FIX_RETURN_ADDRESS_USING_FIRST_ARG(multiboot_magic); // We can now do just about anything, including return to our caller correctly. @@ -404,7 +404,7 @@ else doSelectDevice = true; } - + if(getValueForBootKey(mi->mi_cmdline, "timeout", &val, &size)) { char *endptr; @@ -415,8 +415,8 @@ multiboot_timeout = intVal; multiboot_timeout_set = 1; } - } - + } + if(getValueForBootKey(mi->mi_cmdline, "partno", &val, &size)) { char *endptr; Index: trunk/i386/boot2/lzvn.c =================================================================== --- trunk/i386/boot2/lzvn.c (revision 2582) +++ trunk/i386/boot2/lzvn.c (revision 2583) @@ -57,9 +57,9 @@ } while (0) -size_t lzvn_decode(void * dst, +size_t lzvn_decode(void *dst, size_t dst_size, - const void * src, + const void *src, size_t src_size) { size_t rax = 0; Index: trunk/i386/boot2/modules.c =================================================================== --- trunk/i386/boot2/modules.c (revision 2582) +++ trunk/i386/boot2/modules.c (revision 2583) @@ -25,8 +25,8 @@ #define DBGPAUSE() #endif -static inline void rebase_location(UInt32* location, char* base, int type); -static inline void bind_location(UInt32* location, char* value, UInt32 addend, int type); +static inline void rebase_location(UInt32 *location, char *base, int type); +static inline void bind_location(UInt32 *location, char *value, UInt32 addend, int type); // NOTE: Global so that modules can link with this static UInt64 textAddress = 0; @@ -118,7 +118,7 @@ last = mod->mm_string; } - char* name = strdup(last); + char *name = strdup(last); name[strlen(last) - sizeof("dylib")] = 0; DBG("Loading multiboot module %s\n", name); @@ -271,7 +271,7 @@ * adjust it's internal symbol list (sort) to optimize locating new symbols * NOTE: returns the address if the symbol is "start", else returns 0xFFFFFFFF */ -long long add_symbol(char* symbol, long long addr, char is64) +long long add_symbol(char *symbol, long long addr, char is64) { // This only can handle 32bit symbols symbolList_t* entry; @@ -300,7 +300,7 @@ */ void module_loaded(const char* name, void* start, const char* author, const char* description, UInt32 version, UInt32 compat) { - moduleList_t* new_entry = malloc(sizeof(moduleList_t)); + moduleList_t *new_entry = malloc(sizeof(moduleList_t)); new_entry->next = loadedModules; loadedModules = new_entry; @@ -1229,9 +1229,9 @@ return 0; } -void start_built_in_module(const char* name, - const char* author, - const char* description, +void start_built_in_module(const char *name, + const char *author, + const char *description, UInt32 version, UInt32 compat, void(*start_function)(void)) Index: trunk/i386/boot2/modules.h =================================================================== --- trunk/i386/boot2/modules.h (revision 2582) +++ trunk/i386/boot2/modules.h (revision 2583) @@ -34,14 +34,14 @@ typedef struct callbackList_t { void(*callback)(void*, void*, void*, void*); - struct callbackList_t* next; + struct callbackList_t *next; } callbackList_t; typedef struct moduleHook_t { - const char* name; - callbackList_t* callbacks; - struct moduleHook_t* next; + const char *name; + callbackList_t *callbacks; + struct moduleHook_t *next; } moduleHook_t; typedef struct modulesList_t @@ -68,7 +68,7 @@ int load_module(char* module); int is_module_loaded(const char* name); -void module_loaded(const char* name, void* start, const char* author, const char* description, UInt32 version, UInt32 compat); +void module_loaded(const char *name, void *start, const char *author, const char *description, UInt32 version, UInt32 compat); @@ -76,35 +76,35 @@ /********************************************************************************/ /* Symbol Functions */ /********************************************************************************/ -long long add_symbol(char* symbol, long long addr, char is64); -unsigned int lookup_all_symbols(const char* name); +long long add_symbol(char *symbol, long long addr, char is64); +unsigned int lookup_all_symbols(const char *name); /********************************************************************************/ /* Macho Parser */ /********************************************************************************/ -void* parse_mach(void* binary, +void* parse_mach(void *binary, int(*dylib_loader)(char*), long long(*symbol_handler)(char*, long long, char), - void (*section_handler)(char* section, char* segment, void* cmd, UInt64 offset, UInt64 address) + void (*section_handler)(char *section, char *segment, void *cmd, UInt64 offset, UInt64 address) ); unsigned int handle_symtable(UInt32 base, - struct symtab_command* symtabCommand, + struct symtab_command *symtabCommand, long long(*symbol_handler)(char*, long long, char), char is64); -void rebase_macho(void* base, char* rebase_stream, UInt32 size); +void rebase_macho(void *base, char *rebase_stream, UInt32 size); -void bind_macho(void* base, UInt8* bind_stream, UInt32 size); +void bind_macho(void *base, UInt8 *bind_stream, UInt32 size); /********************************************************************************/ /* Module Interface */ /********************************************************************************/ -int replace_function(const char* symbol, void* newAddress); -int execute_hook(const char* name, void*, void*, void*, void*); -void register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*)); -moduleHook_t* hook_exists(const char* name); +int replace_function(const char *symbol, void *newAddress); +int execute_hook(const char *name, void*, void*, void*, void*); +void register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*)); +moduleHook_t *hook_exists(const char* name); #if DEBUG_MODULES void print_hook_list(); Index: trunk/i386/modules/Resolution/Resolution.c =================================================================== --- trunk/i386/modules/Resolution/Resolution.c (revision 2582) +++ trunk/i386/modules/Resolution/Resolution.c (revision 2583) @@ -9,11 +9,11 @@ void Resolution_start(); void Resolution_start() { - UInt32 bp = 0; - UInt32 x, y; + UInt32 bp = 0; + UInt32 x, y; patchVideoBios(); - getResolution(&x, &y, &bp); - gui.screen.width = x; - gui.screen.height = y; + getResolution(&x, &y, &bp); + gui.screen.width = x; + gui.screen.height = y; } Index: trunk/i386/modules/AcpiCodec/acpi_codec.c =================================================================== --- trunk/i386/modules/AcpiCodec/acpi_codec.c (revision 2582) +++ trunk/i386/modules/AcpiCodec/acpi_codec.c (revision 2583) @@ -4330,7 +4330,7 @@ { DropTables_p = XMLCastDict(XMLGetProperty(bootInfo->chameleonConfig.dictionary, (const char*)"ACPIDropTables")); if (DropTables_p) DropTables_tag_count = XMLTagCount(DropTables_p) ; - } + } U32 new_table = 0ul; U8 new_table_index = 0, table_added = 0; Index: trunk/i386/util/dyldsymboltool.c =================================================================== --- trunk/i386/util/dyldsymboltool.c (revision 2582) +++ trunk/i386/util/dyldsymboltool.c (revision 2583) @@ -135,9 +135,9 @@ dylib.dylib_info.cmd = LC_ID_DYLIB; dylib.dylib_info.cmdsize = sizeof(struct dylib_command) + sizeof(dylib.module_name); // todo: verify dylib.dylib_info.dylib.name.offset = sizeof(struct dylib_command); - dylib.dylib_info.dylib.timestamp = 0; // TODO: populate with time - dylib.dylib_info.dylib.current_version = 0; // TODO - dylib.dylib_info.dylib.compatibility_version = 0; // TODO + dylib.dylib_info.dylib.timestamp = 0; // TODO: populate with time + dylib.dylib_info.dylib.current_version = 0; // TODO + dylib.dylib_info.dylib.compatibility_version = 0; // TODO //int offset = dylib.dylib_info.cmdsize%4 ? 4 - (dylib.dylib_info.cmdsize % 4) : 0; Index: trunk/i386/util/segsize.c =================================================================== --- trunk/i386/util/segsize.c (revision 2582) +++ trunk/i386/util/segsize.c (revision 2583) @@ -103,7 +103,7 @@ // bool isDATA; // unsigned vmsize; -#define lcp ((struct load_command *)cp) +#define lcp ((struct load_command *)cp) switch(swap(lcp->cmd)) { case LC_SEGMENT: