diff options
author | theuni <theuni-nospam-@xbmc.org> | 2012-05-27 16:27:58 -0400 |
---|---|---|
committer | Cory Fields <theuni-nospam-@xbmc.org> | 2012-08-08 18:53:38 -0400 |
commit | a215ec22b667a374657c13a7892eeccc999069be (patch) | |
tree | 758c068a7f51a4cc9b8b52dbb2f147a3ffd96571 /lib | |
parent | 4e3d35347fc629939e513dc806b9e41bff8acacc (diff) |
[droid] cximage fixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cximage-6.0/CxImage/ximaraw.cpp | 19 | ||||
-rw-r--r-- | lib/cximage-6.0/raw/dcr.c | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/lib/cximage-6.0/CxImage/ximaraw.cpp b/lib/cximage-6.0/CxImage/ximaraw.cpp index ea7b7023d0..fd86f965db 100644 --- a/lib/cximage-6.0/CxImage/ximaraw.cpp +++ b/lib/cximage-6.0/CxImage/ximaraw.cpp @@ -14,6 +14,23 @@ #if CXIMAGE_SUPPORT_RAW +#if defined(__ANDROID__) +#include <stdint.h> +#include <asm/byteorder.h> + +extern "C" void swab(const void *from, void*to, ssize_t n) +{ + ssize_t i; + + if (n < 0) + return; + + for (i = 0; i < (n/2)*2; i += 2) + *((uint16_t*)to+i) = __arch__swab16(*((uint16_t*)from+i)); +} + +#endif + //////////////////////////////////////////////////////////////////////////////// #if CXIMAGE_SUPPORT_DECODE //////////////////////////////////////////////////////////////////////////////// @@ -191,7 +208,7 @@ bool CxImageRAW::Decode(CxFile *hFile) for (c=0; c < dcr.colors; c++) ppm2[col*dcr.colors+c] = dcr.image[soff][c]; } if (dcr.opt.output_bps == 16 && !dcr.opt.output_tiff && htons(0x55aa) != 0x55aa) -#if defined(_LINUX) || defined(__APPLE__) +#if defined(_LINUX) || defined(__APPLE__) || defined(__ANDROID__) swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); #else _swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); diff --git a/lib/cximage-6.0/raw/dcr.c b/lib/cximage-6.0/raw/dcr.c index 1668dd0122..e688d6277e 100644 --- a/lib/cximage-6.0/raw/dcr.c +++ b/lib/cximage-6.0/raw/dcr.c @@ -145,7 +145,7 @@ int DCR_CLASS main (int argc, char **argv) //!!! set return point for error handling if (setjmp (dcr.failure)) { #if !defined(__FreeBSD__) - if (fileno(dcr.obj_) > 2) (*dcr.ops_->close_)(dcr.obj_); + if (fileno((FILE*)dcr.obj_) > 2) (*dcr.ops_->close_)(dcr.obj_); #endif if (fileno(ofp) > 2) fclose(ofp); status = 1; |