Merged r2903:2904 from SDL-1.2 branch to trunk: BeOS loadso updates.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 07 Nov 2006 15:18:42 +0000
changeset 20698d4c2498bb72
parent 2068 f16a7d02a176
child 2070 dbfa1ebd73b0
Merged r2903:2904 from SDL-1.2 branch to trunk: BeOS loadso updates.
src/loadso/beos/SDL_sysloadso.c
     1.1 --- a/src/loadso/beos/SDL_sysloadso.c	Tue Nov 07 15:02:12 2006 +0000
     1.2 +++ b/src/loadso/beos/SDL_sysloadso.c	Tue Nov 07 15:18:42 2006 +0000
     1.3 @@ -35,35 +35,25 @@
     1.4  SDL_LoadObject(const char *sofile)
     1.5  {
     1.6      void *handle = NULL;
     1.7 -    const char *loaderror = "Unknown error";
     1.8      image_id library_id = load_add_on(sofile);
     1.9 -    if (library_id == B_ERROR) {
    1.10 -        loaderror = "BeOS error";
    1.11 +    if (library_id < 0) {
    1.12 +        SDL_SetError(strerror((int) library_id));
    1.13      } else {
    1.14          handle = (void *) (library_id);
    1.15      }
    1.16 -
    1.17 -    if (handle == NULL) {
    1.18 -        SDL_SetError("Failed loading %s: %s", sofile, loaderror);
    1.19 -    }
    1.20      return (handle);
    1.21  }
    1.22  
    1.23  void *
    1.24  SDL_LoadFunction(void *handle, const char *name)
    1.25  {
    1.26 -    void *symbol = NULL;
    1.27 -    const char *loaderror = "Unknown error";
    1.28 +    void *sym = NULL;
    1.29      image_id library_id = (image_id) handle;
    1.30 -    if (get_image_symbol(library_id,
    1.31 -                         name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR) {
    1.32 -        loaderror = "Symbol not found";
    1.33 +    status_t rc = get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
    1.34 +    if (rc != B_NO_ERROR) {
    1.35 +        SDL_SetError(strerror(rc));
    1.36      }
    1.37 -
    1.38 -    if (symbol == NULL) {
    1.39 -        SDL_SetError("Failed loading %s: %s", name, loaderror);
    1.40 -    }
    1.41 -    return (symbol);
    1.42 +    return (sym);
    1.43  }
    1.44  
    1.45  void
    1.46 @@ -77,4 +67,6 @@
    1.47  }
    1.48  
    1.49  #endif /* SDL_LOADSO_BEOS */
    1.50 +
    1.51  /* vi: set ts=4 sw=4 expandtab: */
    1.52 +