This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  c1f44a459ac37a5d5d9be7553292239aec918fef (commit)
      from  774cfafedc660e7add21fe4ba28c6bf554824371 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/c1f44a459ac37a5d5d9be7553292239aec918fef

commit c1f44a459ac37a5d5d9be7553292239aec918fef
Author: David Maciejak <[email protected]>
Date:   Mon Feb 24 20:31:24 2014 +0800

    wrlib: Add webp return error code
    
    Based on the feedback from Christophe Curis, this patch adds some error
    code report for webp module.

diff --git a/wrlib/load_webp.c b/wrlib/load_webp.c
index d69a107f..9364332e 100644
--- a/wrlib/load_webp.c
+++ b/wrlib/load_webp.c
@@ -58,7 +58,6 @@ RLoadWEBP(const char *file_name)
                return NULL;
        }
 
-
        if (!(buffer[0] == 'R' &&
              buffer[1] == 'I' &&
              buffer[2] == 'F' &&
@@ -78,12 +77,12 @@ RLoadWEBP(const char *file_name)
                return NULL;
        }
 
-
        fseek(file, 0, SEEK_END);
        raw_data_size = ftell(file);
 
        if (raw_data_size <= 0) {
                fprintf(stderr, "Failed to find the WEBP image sizen");
+               RErrorCode = RERR_BADIMAGEFILE;
                return NULL;
        }
 
@@ -92,7 +91,8 @@ RLoadWEBP(const char *file_name)
        raw_data = (uint8_t *) malloc(raw_data_size);
 
        if (!raw_data) {
-               fprintf(stderr, "Failed to allocate enought buffer for WEBPn");
+               fprintf(stderr, "Failed to allocate enough buffer for WEBPn");
+               RErrorCode = RERR_NOMEMORY;
                return NULL;
        }
 
@@ -100,27 +100,33 @@ RLoadWEBP(const char *file_name)
 
        if (r != raw_data_size) {
                fprintf(stderr, "Failed to read WEBPn");
+               RErrorCode = RERR_READ;
                return NULL;
        }
 
        if (WebPGetFeatures(raw_data, raw_data_size, &features) !=
            VP8_STATUS_OK) {
                fprintf(stderr, "WebPGetFeatures has failedn");
+               RErrorCode = RERR_BADIMAGEFILE;
                return NULL;
        }
 
        if (features.has_alpha) {
                image = RCreateImage(features.width, features.height, True);
-               if (!image)
+               if (!image) {
+                       RErrorCode = RERR_NOMEMORY;
                        return NULL;
+               }
                ret =
                    WebPDecodeRGBAInto(raw_data, raw_data_size, image->data,
                                       features.width * features.height * 4,
                                       features.width * 4);
        } else {
                image = RCreateImage(features.width, features.height, False);
-               if (!image)
+               if (!image) {
+                       RErrorCode = RERR_NOMEMORY;
                        return NULL;
+               }
                ret =
                    WebPDecodeRGBInto(raw_data, raw_data_size, image->data,
                                      features.width * features.height * 3,
@@ -129,6 +135,8 @@ RLoadWEBP(const char *file_name)
 
        if (!ret) {
                fprintf(stderr, "Failed to decode WEBPn");
+               RErrorCode = RERR_BADIMAGEFILE;
+               RReleaseImage(image);
                return NULL;
        }
 

-----------------------------------------------------------------------

Summary of changes:
 wrlib/load_webp.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


-- 
To unsubscribe, send mail to [email protected].

Reply via email to