diff --git a/albumart.c b/albumart.c index ea71be9..da1b58a 100644 --- a/albumart.c +++ b/albumart.c @@ -159,7 +159,7 @@ update_if_album_art(const char *path) } char * -check_embedded_art(const char *path, const char *image_data, int image_size) +check_embedded_art(const char *path, uint8_t *image_data, int image_size) { int width = 0, height = 0; char *art_path = NULL; @@ -346,7 +346,7 @@ found_file: } int64_t -find_album_art(const char *path, const char *image_data, int image_size) +find_album_art(const char *path, uint8_t *image_data, int image_size) { char *album_art = NULL; int64_t ret = 0; diff --git a/albumart.h b/albumart.h index 94be569..f3db00a 100644 --- a/albumart.h +++ b/albumart.h @@ -24,10 +24,7 @@ #ifndef __ALBUMART_H__ #define __ALBUMART_H__ -void -update_if_album_art(const char *path); - -int64_t -find_album_art(const char *path, const char *image_data, int image_size); +void update_if_album_art(const char *path); +int64_t find_album_art(const char *path, uint8_t *image_data, int image_size); #endif diff --git a/image_utils.c b/image_utils.c index c71fa77..454156f 100644 --- a/image_utils.c +++ b/image_utils.c @@ -424,7 +424,7 @@ image_new(int32_t width, int32_t height) } image_s * -image_new_from_jpeg(const char * path, int is_file, const char * buf, int size, int scale, int rotate) +image_new_from_jpeg(const char *path, int is_file, const uint8_t *buf, int size, int scale, int rotate) { image_s *vimage; FILE *file = NULL; @@ -447,7 +447,7 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size, } else { - jpeg_memory_src(&cinfo, (const unsigned char *)buf, size); + jpeg_memory_src(&cinfo, buf, size); } if( setjmp(setjmp_buffer) ) { diff --git a/image_utils.h b/image_utils.h index 10b2d75..7011c73 100644 --- a/image_utils.h +++ b/image_utils.h @@ -46,7 +46,7 @@ int image_get_jpeg_resolution(const char * path, int * width, int * height); image_s * -image_new_from_jpeg(const char * path, int is_file, const char * ptr, int size, int scale, int resize); +image_new_from_jpeg(const char *path, int is_file, const uint8_t *ptr, int size, int scale, int resize); image_s * image_resize(image_s * src_image, int32_t width, int32_t height); diff --git a/metadata.c b/metadata.c index 43bda48..1a7b733 100644 --- a/metadata.c +++ b/metadata.c @@ -630,7 +630,7 @@ GetImageMetadata(const char *path, char *name) /* We might need to verify that the thumbnail is 160x160 or smaller */ if( ed->size > 12000 ) { - imsrc = image_new_from_jpeg(NULL, 0, (char *)ed->data, ed->size, 1, ROTATE_NONE); + imsrc = image_new_from_jpeg(NULL, 0, ed->data, ed->size, 1, ROTATE_NONE); if( imsrc ) { if( (imsrc->width <= 160) && (imsrc->height <= 160) ) diff --git a/playlist.c b/playlist.c index b9fe8ad..ae3a27e 100644 --- a/playlist.c +++ b/playlist.c @@ -105,7 +105,7 @@ gen_dir_hash(const char *path) return 0; - return DJBHash(dir, len); + return DJBHash((uint8_t *)dir, len); } int diff --git a/utils.c b/utils.c index 16d92ca..4213faf 100644 --- a/utils.c +++ b/utils.c @@ -290,14 +290,14 @@ make_dir(char * path, mode_t mode) /* Simple, efficient hash function from Daniel J. Bernstein */ unsigned int -DJBHash(const char *str, int len) +DJBHash(uint8_t *data, int len) { unsigned int hash = 5381; unsigned int i = 0; - for(i = 0; i < len; str++, i++) + for(i = 0; i < len; data++, i++) { - hash = ((hash << 5) + hash) + (*str); + hash = ((hash << 5) + hash) + (*data); } return hash; diff --git a/utils.h b/utils.h index 1694654..a15a7ae 100644 --- a/utils.h +++ b/utils.h @@ -77,6 +77,6 @@ const char *mime_to_ext(const char * mime); /* Others */ int make_dir(char * path, mode_t mode); -unsigned int DJBHash(const char *str, int len); +unsigned int DJBHash(uint8_t *data, int len); #endif