Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/azatoth/minidlna.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard@users.sourceforge.net>2009-03-18 20:34:30 +0300
committerJustin Maggard <jmaggard@users.sourceforge.net>2009-03-18 20:34:30 +0300
commit092b1eec9eb63f5bf67bf4872f05317fcd505974 (patch)
treef37c54c108f64e9cb0d00fe7fec4b858841541ca /albumart.c
parente731022e2de6ca8d2f3412aee45bac54afbf90c0 (diff)
* Handle the case where we have a embedded album art image size, but no data.
Diffstat (limited to 'albumart.c')
-rw-r--r--albumart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/albumart.c b/albumart.c
index 8040f4c..8493ba2 100644
--- a/albumart.c
+++ b/albumart.c
@@ -187,7 +187,7 @@ jpeg_memory_src(j_decompress_ptr cinfo, unsigned char const *buffer, size_t bufs
}
/* Simple, efficient hash function from Daniel J. Bernstein */
-unsigned int DJBHash(const char* str, int len)
+unsigned int DJBHash(const char * str, int len)
{
unsigned int hash = 5381;
unsigned int i = 0;
@@ -215,8 +215,12 @@ check_embedded_art(const char * path, const char * image_data, int image_size)
static unsigned int last_hash = 0;
unsigned int hash;
+ if( !image_data || !image_size || !path )
+ {
+ return NULL;
+ }
/* If the embedded image matches the embedded image from the last file we
- * checked, just make a hard link. No use in storing it on the disk twice. */
+ * checked, just make a hard link. Better than storing it on the disk twice. */
hash = DJBHash(image_data, image_size);
if( hash == last_hash )
{