Merge commit '750917f7ea9876d7a97f48aa4b22097fcf7958d9'

This commit is contained in:
Justin Maggard 2014-04-28 10:47:01 -07:00
commit 4eeb0858e4
9 changed files with 15 additions and 16 deletions

View File

@ -159,7 +159,7 @@ update_if_album_art(const char *path)
} }
char * 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; int width = 0, height = 0;
char *art_path = NULL; char *art_path = NULL;
@ -346,7 +346,7 @@ found_file:
} }
int64_t 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; char *album_art = NULL;
int64_t ret = 0; int64_t ret = 0;

View File

@ -24,10 +24,7 @@
#ifndef __ALBUMART_H__ #ifndef __ALBUMART_H__
#define __ALBUMART_H__ #define __ALBUMART_H__
void void update_if_album_art(const char *path);
update_if_album_art(const char *path); int64_t find_album_art(const char *path, uint8_t *image_data, int image_size);
int64_t
find_album_art(const char *path, const char *image_data, int image_size);
#endif #endif

View File

@ -424,7 +424,7 @@ image_new(int32_t width, int32_t height)
} }
image_s * 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; image_s *vimage;
FILE *file = NULL; FILE *file = NULL;
@ -447,7 +447,7 @@ image_new_from_jpeg(const char * path, int is_file, const char * buf, int size,
} }
else else
{ {
jpeg_memory_src(&cinfo, (const unsigned char *)buf, size); jpeg_memory_src(&cinfo, buf, size);
} }
if( setjmp(setjmp_buffer) ) if( setjmp(setjmp_buffer) )
{ {

View File

@ -46,7 +46,7 @@ int
image_get_jpeg_resolution(const char * path, int * width, int * height); image_get_jpeg_resolution(const char * path, int * width, int * height);
image_s * 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_s *
image_resize(image_s * src_image, int32_t width, int32_t height); image_resize(image_s * src_image, int32_t width, int32_t height);

View File

@ -630,7 +630,7 @@ GetImageMetadata(const char *path, char *name)
/* We might need to verify that the thumbnail is 160x160 or smaller */ /* We might need to verify that the thumbnail is 160x160 or smaller */
if( ed->size > 12000 ) 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 )
{ {
if( (imsrc->width <= 160) && (imsrc->height <= 160) ) if( (imsrc->width <= 160) && (imsrc->height <= 160) )

View File

@ -63,11 +63,13 @@ AddMulticastMembership(int s, struct lan_addr_s *iface)
#ifdef HAVE_STRUCT_IP_MREQN #ifdef HAVE_STRUCT_IP_MREQN
struct ip_mreqn imr; /* Ip multicast membership */ struct ip_mreqn imr; /* Ip multicast membership */
/* setting up imr structure */ /* setting up imr structure */
memset(&imr, '\0', sizeof(imr));
imr.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDR); imr.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDR);
imr.imr_ifindex = iface->ifindex; imr.imr_ifindex = iface->ifindex;
#else #else
struct ip_mreq imr; /* Ip multicast membership */ struct ip_mreq imr; /* Ip multicast membership */
/* setting up imr structure */ /* setting up imr structure */
memset(&imr, '\0', sizeof(imr));
imr.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDR); imr.imr_multiaddr.s_addr = inet_addr(SSDP_MCAST_ADDR);
imr.imr_interface.s_addr = iface->addr.s_addr; imr.imr_interface.s_addr = iface->addr.s_addr;
#endif #endif

View File

@ -105,7 +105,7 @@ gen_dir_hash(const char *path)
return 0; return 0;
return DJBHash(dir, len); return DJBHash((uint8_t *)dir, len);
} }
int int

View File

@ -290,14 +290,14 @@ make_dir(char * path, mode_t mode)
/* Simple, efficient hash function from Daniel J. Bernstein */ /* Simple, efficient hash function from Daniel J. Bernstein */
unsigned int unsigned int
DJBHash(const char *str, int len) DJBHash(uint8_t *data, int len)
{ {
unsigned int hash = 5381; unsigned int hash = 5381;
unsigned int i = 0; 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; return hash;

View File

@ -77,6 +77,6 @@ const char *mime_to_ext(const char * mime);
/* Others */ /* Others */
int make_dir(char * path, mode_t mode); 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 #endif