From 51d097f9144193c98d881f14c4e4bd6b579574f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 16 Mar 2007 19:31:57 +0000 Subject: There's no need to check if the shared object to open is 32 or 64 bits, as dlopen() will not load a codec if it's not loadable in the current process (which means it won't load 64-bit codecs on 32-bit xine, or 32-bit codecs on 64-bit xine). CVS patchset: 8678 CVS date: 2007/03/16 19:31:57 --- src/libreal/audio_decoder.c | 54 +-------------------------------------------- src/libreal/xine_decoder.c | 54 +-------------------------------------------- 2 files changed, 2 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index 8b8e40126..d60e8f8e1 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.51 2007/02/20 00:34:57 dgp85 Exp $ + * $Id: audio_decoder.c,v 1.52 2007/03/16 19:31:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -32,9 +32,6 @@ #include #include #include -#ifdef __x86_64__ - #include -#endif #define LOG_MODULE "real_audio_decoder" #define LOG_VERBOSE @@ -121,49 +118,6 @@ void __builtin_delete (void *foo) { free (foo); } -#ifdef __x86_64__ -/* (gb) quick-n-dirty check to be run natively */ -static int is_x86_64_object_(FILE *f) -{ - Elf64_Ehdr *hdr = malloc(sizeof(Elf64_Ehdr)); - if (hdr == NULL) - return 0; - - if (fseek(f, 0, SEEK_SET) != 0) { - free(hdr); - return 0; - } - - if (fread(hdr, sizeof(Elf64_Ehdr), 1, f) != 1) { - free(hdr); - return 0; - } - - if (hdr->e_ident[EI_MAG0] != ELFMAG0 || - hdr->e_ident[EI_MAG1] != ELFMAG1 || - hdr->e_ident[EI_MAG2] != ELFMAG2 || - hdr->e_ident[EI_MAG3] != ELFMAG3) { - free(hdr); - return 0; - } - - return hdr->e_machine == EM_X86_64; -} - -static inline int is_x86_64_object(const char *filename) -{ - FILE *f; - int ret; - - if ((f = fopen(filename, "r")) == NULL) - return 0; - - ret = is_x86_64_object_(f); - fclose(f); - return ret; -} -#endif - static int load_syms_linux (realdec_decoder_t *this, char *codec_name, const char *alt_codec_name) { @@ -176,12 +130,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name, if (stat(path, &sb)) snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); -#ifdef __x86_64__ - /* check whether it's a real x86-64 library */ - if (!is_x86_64_object(path)) - return 0; -#endif - lprintf ("(audio) opening shared obj '%s'\n", path); this->ra_handle = dlopen (path, RTLD_LAZY); diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index ffd89178b..28770636b 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.85 2007/02/20 00:34:57 dgp85 Exp $ + * $Id: xine_decoder.c,v 1.86 2007/03/16 19:31:57 dgp85 Exp $ * * thin layer to use real binary-only codecs in xine * @@ -32,9 +32,6 @@ #include #include #include -#ifdef __x86_64__ - #include -#endif #define LOG_MODULE "real_decoder" #define LOG_VERBOSE @@ -106,49 +103,6 @@ void *__builtin_vec_new(uint32_t size); void __builtin_vec_delete(void *mem); void __pure_virtual(void); -#ifdef __x86_64__ -/* (gb) quick-n-dirty check to be run natively */ -static int is_x86_64_object_(FILE *f) -{ - Elf64_Ehdr *hdr = malloc(sizeof(Elf64_Ehdr)); - if (hdr == NULL) - return 0; - - if (fseek(f, 0, SEEK_SET) != 0) { - free(hdr); - return 0; - } - - if (fread(hdr, sizeof(Elf64_Ehdr), 1, f) != 1) { - free(hdr); - return 0; - } - - if (hdr->e_ident[EI_MAG0] != ELFMAG0 || - hdr->e_ident[EI_MAG1] != ELFMAG1 || - hdr->e_ident[EI_MAG2] != ELFMAG2 || - hdr->e_ident[EI_MAG3] != ELFMAG3) { - free(hdr); - return 0; - } - - return hdr->e_machine == EM_X86_64; -} - -static inline int is_x86_64_object(const char *filename) -{ - FILE *f; - int ret; - - if ((f = fopen(filename, "r")) == NULL) - return 0; - - ret = is_x86_64_object_(f); - fclose(f); - return ret; -} -#endif - /* * real codec loader */ @@ -165,12 +119,6 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name, if (stat(path, &sb)) snprintf (path, sizeof(path), "%s/%s", entry->str_value, alt_codec_name); -#ifdef __x86_64__ - /* check whether it's a real x86-64 library */ - if (!is_x86_64_object(path)) - return 0; -#endif - lprintf ("opening shared obj '%s'\n", path); this->rv_handle = dlopen (path, RTLD_LAZY); -- cgit v1.2.3