filename | src/loader.c |
changeset | 1298:d0eb2307b847 |
prev | 1296:30ecee61f811 |
next | 1300:d18488c8668b |
author | nkeynes |
date | Sun May 24 19:46:06 2015 +1000 (8 years ago) |
permissions | -rw-r--r-- |
last change | Remove static from gl_load_frame_buffer() - also needed by video_egl.c Fix error location in gl_frame_buffer_to_tex |
file | annotate | diff | log | raw |
1.1 --- a/src/loader.c Sat Jan 26 14:00:48 2013 +10001.2 +++ b/src/loader.c Sun May 24 19:46:06 2015 +10001.3 @@ -148,7 +148,7 @@1.4 if( disc != NULL ) {1.5 gdrom_mount_disc(disc);1.6 return FILE_DISC;1.7 - } else if( err != LX_ERR_FILE_UNKNOWN ) {1.8 + } else if( !IS_ERROR_CODE(err,LX_ERR_FILE_UNKNOWN) ) {1.9 return FILE_ERROR;1.10 }1.12 @@ -226,26 +226,17 @@1.13 g_free(bootstrap_file);1.14 }1.16 -1.17 -static gboolean is_sh4_elf( Elf32_Ehdr *head )1.18 -{1.19 +static gboolean is_arch( Elf32_Ehdr *head, Elf32_Half mach ) {1.20 return ( head->e_ident[EI_CLASS] == ELFCLASS32 &&1.21 head->e_ident[EI_DATA] == ELFDATA2LSB &&1.22 head->e_ident[EI_VERSION] == 1 &&1.23 head->e_type == ET_EXEC &&1.24 - head->e_machine == EM_SH &&1.25 + head->e_machine == mach &&1.26 head->e_version == 1 );1.27 }1.29 -static gboolean is_arm_elf( Elf32_Ehdr *head )1.30 -{1.31 - return ( head->e_ident[EI_CLASS] == ELFCLASS32 &&1.32 - head->e_ident[EI_DATA] == ELFDATA2LSB &&1.33 - head->e_ident[EI_VERSION] == 1 &&1.34 - head->e_type == ET_EXEC &&1.35 - head->e_machine == EM_ARM &&1.36 - head->e_version == 1 );1.37 -}1.38 +#define is_sh4_elf(head) is_arch(head, EM_SH)1.39 +#define is_arm_elf(head) is_arch(head, EM_ARM)1.41 static gboolean file_load_elf( const gchar *filename, int fd, ERROR *err )1.42 {1.43 @@ -437,7 +428,7 @@1.44 }1.46 /* Load the program into memory */1.47 - char *program = g_malloc0( end-start );1.48 + unsigned char *program = g_malloc0( end-start );1.49 for( i=0; i<head.e_phnum; i++ ) {1.50 if( phdr[i].p_type == PT_LOAD ) {1.51 lseek( fd, phdr[i].p_offset, SEEK_SET );1.52 @@ -458,7 +449,7 @@1.53 static cdrom_disc_t cdrom_wrap_binary( cdrom_disc_type_t type, const gchar *filename, int fd, ERROR *err )1.54 {1.55 struct stat st;1.56 - char *data;1.57 + unsigned char *data;1.58 size_t len;1.60 if( fstat(fd, &st) == -1 ) {
.