Re: [PATCH] Added webp return error code
On Mon, 24 Feb 2014 at 20:37:09 +0800, David Maciejak wrote: Based on the feedback from Christophe, this patch is adding some error code report for webp module. Patch is inlined and enclosed. Thanks, but the attached patch does not correspond to the inlined version... -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
Re: [PATCH] Added webp return error code
oops sorry, please see the one enclosed On Mon, Feb 24, 2014 at 10:03 PM, Carlos R. Mafra crma...@gmail.com wrote: On Mon, 24 Feb 2014 at 20:37:09 +0800, David Maciejak wrote: Based on the feedback from Christophe, this patch is adding some error code report for webp module. Patch is inlined and enclosed. Thanks, but the attached patch does not correspond to the inlined version... -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org. 0001-Added-webp-return-error-code.patch Description: Binary data
[repo.or.cz] wmaker-crm.git branch next updated: wmaker-0.95.5-253-gc1f44a45
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 david.macie...@gmail.com 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 crma...@gmail.com if you want to unsubscribe, or site admin ad...@repo.or.cz if you receive no reply. -- wmaker-crm.git (The Window Maker window manager) -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[PATCH 0/2] Patches rebased on next
Hello, I'm sending my two not yet merged patches rebased to the next branch. Regards, BALATON Zoltan --- BALATON Zoltan (2): WPrefs: Make Dock preferences pane less busy and fix up some strings Updated Hungarian translation WINGs/po/hu.po | 213 +--- WPrefs.app/Configurations.c | 6 +- WPrefs.app/Docks.c | 36 +--- WPrefs.app/Focus.c | 2 +- WPrefs.app/WindowHandling.c | 6 +- WPrefs.app/Workspace.c | 4 +- WPrefs.app/po/hu.po | 171 +-- po/hu.po| 8 +- 8 files changed, 203 insertions(+), 243 deletions(-) -- 1.8.1.5 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.
[PATCH 1/2] WPrefs: Make Dock preferences pane less busy and fix up some strings
Signed-off-by: BALATON Zoltan bala...@eik.bme.hu --- WPrefs.app/Configurations.c | 6 +++--- WPrefs.app/Docks.c | 36 +--- WPrefs.app/Focus.c | 2 +- WPrefs.app/WindowHandling.c | 6 +++--- WPrefs.app/Workspace.c | 4 ++-- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/WPrefs.app/Configurations.c b/WPrefs.app/Configurations.c index 4fdc777..34b716d 100644 --- a/WPrefs.app/Configurations.c +++ b/WPrefs.app/Configurations.c @@ -204,9 +204,6 @@ static void createPanel(Panel *p) WMResizeWidget(panel-smoF, 94, 100); WMMoveWidget(panel-smoF, 420, 10); WMSetFrameTitle(panel-smoF, _(Smooth Scaling)); - WMSetBalloonTextForView(_(Smooth scaled background images, neutralizing\n - the `pixelization' effect. This will slow\n - down loading of background images considerably.), WMWidgetView(panel-smoF)); panel-smoB = WMCreateButton(panel-smoF, WBTToggle); WMResizeWidget(panel-smoB, 64, 64); @@ -237,6 +234,9 @@ static void createPanel(Panel *p) RReleaseImage(image); } + WMSetBalloonTextForView(_(Smooth scaled background images, neutralizing\n + the `pixelization' effect. This will slow\n + down loading of background images considerably.), WMWidgetView(panel-smoB)); WMMapSubwidgets(panel-smoF); diff --git a/WPrefs.app/Docks.c b/WPrefs.app/Docks.c index e85f5df..7d54f30 100644 --- a/WPrefs.app/Docks.c +++ b/WPrefs.app/Docks.c @@ -36,6 +36,7 @@ typedef struct _Panel { WMLabel *autoDelayL[4]; WMButton *autoDelayB[4][5]; WMTextField *autoDelayT[4]; + WMLabel *autoDelayMsL[4]; WMFrame *dockF; WMButton *docksB[3]; @@ -51,10 +52,10 @@ static const struct { const char *key; const char *string; } auto_delay[] = { - { ClipAutoexpandDelay, N_(Delay before auto-expansion) }, - { ClipAutocollapseDelay, N_(Delay before auto-collapsing) }, - { ClipAutoraiseDelay,N_(Delay before auto-raise) }, - { ClipAutolowerDelay,N_(Delay before auto-lowering) } + { ClipAutoexpandDelay, N_(Before auto-expansion) }, + { ClipAutocollapseDelay, N_(Before auto-collapsing) }, + { ClipAutoraiseDelay,N_(Before auto-raise) }, + { ClipAutolowerDelay,N_(Before auto-lowering) } }; @@ -149,6 +150,8 @@ static void createPanel(Panel *p) char *path; int i, j, k; char *buf1, *buf2; + WMColor *color; + WMFont *font; path = LocateImage(ARQUIVO_XIS); if (path) { @@ -172,23 +175,23 @@ static void createPanel(Panel *p) WMResizeWidget(panel-autoDelayF[k], 370, 100); WMMoveWidget(panel-autoDelayF[k], 15, 10 + k * 110); if (k == 0) - WMSetFrameTitle(panel-autoDelayF[k], _(Delays in milliseconds for autocollapsing clips)); + WMSetFrameTitle(panel-autoDelayF[k], _(Clip autocollapsing delays)); else - WMSetFrameTitle(panel-autoDelayF[k], _(Delays in milliseconds for autoraising clips)); + WMSetFrameTitle(panel-autoDelayF[k], _(Clip autoraising delays)); for (i = 0; i 2; i++) { panel-autoDelayL[i + k * 2] = WMCreateLabel(panel-autoDelayF[k]); - WMResizeWidget(panel-autoDelayL[i + k * 2], 175, 20); + WMResizeWidget(panel-autoDelayL[i + k * 2], 155, 20); WMMoveWidget(panel-autoDelayL[i + k * 2], 10, 27 + 40 * i); WMSetLabelText(panel-autoDelayL[i + k * 2], _(auto_delay[i + k * 2].string)); - WMSetLabelTextAlignment(panel-autoDelayL[i + k * 2], WARight); + /* WMSetLabelTextAlignment(panel-autoDelayL[i + k * 2], WARight); */ for (j = 0; j 5; j++) { panel-autoDelayB[i + k * 2][j] = WMCreateCustomButton(panel-autoDelayF[k], WBBStateChangeMask); WMResizeWidget(panel-autoDelayB[i + k * 2][j], 25, 25); - WMMoveWidget(panel-autoDelayB[i + k * 2][j], 185 + (25 * j), 25 + 40 * i); + WMMoveWidget(panel-autoDelayB[i + k * 2][j], 145 + (28 * j), 25 + 40 * i); WMSetButtonBordered(panel-autoDelayB[i + k * 2][j], False); WMSetButtonImagePosition(panel-autoDelayB[i + k * 2][j], WIPImageOnly); WMSetButtonAction(panel-autoDelayB[i + k * 2][j], pushAutoDelayButton, panel); @@ -213,9 +216,20 @@ static void createPanel(Panel *p) }
[PATCH 2/2] Updated Hungarian translation
Signed-off-by: BALATON Zoltan bala...@eik.bme.hu --- WINGs/po/hu.po | 213 +--- WPrefs.app/po/hu.po | 171 +++-- po/hu.po| 8 +- 3 files changed, 169 insertions(+), 223 deletions(-) diff --git a/WINGs/po/hu.po b/WINGs/po/hu.po index 8d875be..753edc4 100644 --- a/WINGs/po/hu.po +++ b/WINGs/po/hu.po @@ -7,8 +7,8 @@ msgid msgstr Project-Id-Version: Window Maker 0.95.5\n Report-Msgid-Bugs-To: \n -POT-Creation-Date: 2014-02-16 18:47+0100\n -PO-Revision-Date: 2014-02-17 18:00+0100\n +POT-Creation-Date: 2014-02-18 00:14+0100\n +PO-Revision-Date: 2014-02-18 00:25+0100\n Last-Translator: BALATON Zoltán bala...@eik.bme.hu\n Language-Team: Hungarian\n Language: \n @@ -16,16 +16,16 @@ msgstr Content-Type: text/plain; charset=UTF-8\n Content-Transfer-Encoding: 8bit\n -#: ../../../wmaker-crm/WINGs/error.c:68 -msgid fatal error: +#: ../../../wmaker-crm/WINGs/error.c:117 +msgid fatal: msgstr végzetes hiba: -#: ../../../wmaker-crm/WINGs/error.c:71 +#: ../../../wmaker-crm/WINGs/error.c:124 msgid error: msgstr hiba: -#: ../../../wmaker-crm/WINGs/error.c:74 -msgid warning: +#: ../../../wmaker-crm/WINGs/error.c:131 +msgid warn: msgstr figyelmeztetés: #: ../../../wmaker-crm/WINGs/findfile.c:58 @@ -133,9 +133,7 @@ msgid missing ; in PropList dictionary entry msgstr hiányzó ; a PropList szótár elemben #: ../../../wmaker-crm/WINGs/proplist.c:885 -msgid -was expecting a string, data, array or dictionary. If it's a string, try -enclosing it with \. +msgid was expecting a string, data, array or dictionary. If it's a string, try enclosing it with \. msgstr karakterlánc, adat, tömb vagy szótár tÃpusra számÃtottam. Ha karakterláncot adtál meg, próbáld idézÅjelbe tenni! #: ../../../wmaker-crm/WINGs/proplist.c:888 @@ -233,198 +231,197 @@ msgstr szürke msgid dark gray msgstr sötétszürke -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:384 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:383 msgid Colors msgstr SzÃnek -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:559 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2625 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:558 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2624 msgid Brightness msgstr Világosság -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:561 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:635 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:666 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:697 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:755 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:786 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:818 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:851 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:1989 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2627 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2661 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2695 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:560 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:634 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:665 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:696 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:754 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:785 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:817 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:850 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:1988 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2626 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2660 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2694 msgid Color Panel: Could not allocate memory msgstr SzÃn panel: nem sikerült a memória foglalás -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:633 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:632 msgid Red msgstr Piros -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:664 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:663 msgid Green msgstr Zöld -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:695 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:694 msgid Blue msgstr Kék -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:753 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:752 msgid Cyan msgstr Türkiz -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:784 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:783 msgid Magenta msgstr Lila -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:816 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:815 msgid Yellow msgstr Sárga -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:849 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:848 msgid Black msgstr Fekete -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:924 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:923 msgid Spectrum msgstr Spektrum -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:950 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:949 msgid Palette msgstr Paletta -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:955 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:954 msgid New from File... msgstr Ãj, fájlból... -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:956 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:1001 -#:
[repo.or.cz] wmaker-crm.git branch next updated: wmaker-0.95.5-255-g87f4f1d4
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 87f4f1d4631dd9e09d118df57ca349a26e2a7f40 (commit) via 2bb68e6cc5664b8784400a2a803abe1dcae63ff2 (commit) from c1f44a459ac37a5d5d9be7553292239aec918fef (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/87f4f1d4631dd9e09d118df57ca349a26e2a7f40 commit 87f4f1d4631dd9e09d118df57ca349a26e2a7f40 Author: BALATON Zoltan bala...@eik.bme.hu Date: Tue Feb 18 00:46:54 2014 +0100 Updated Hungarian translation Signed-off-by: BALATON Zoltan bala...@eik.bme.hu diff --git a/WINGs/po/hu.po b/WINGs/po/hu.po index 8d875beb..753edc44 100644 --- a/WINGs/po/hu.po +++ b/WINGs/po/hu.po @@ -7,8 +7,8 @@ msgid msgstr Project-Id-Version: Window Maker 0.95.5n Report-Msgid-Bugs-To: n -POT-Creation-Date: 2014-02-16 18:47+0100n -PO-Revision-Date: 2014-02-17 18:00+0100n +POT-Creation-Date: 2014-02-18 00:14+0100n +PO-Revision-Date: 2014-02-18 00:25+0100n Last-Translator: BALATON Zoltán bala...@eik.bme.hun Language-Team: Hungariann Language: n @@ -16,16 +16,16 @@ msgstr Content-Type: text/plain; charset=UTF-8n Content-Transfer-Encoding: 8bitn -#: ../../../wmaker-crm/WINGs/error.c:68 -msgid fatal error: +#: ../../../wmaker-crm/WINGs/error.c:117 +msgid fatal: msgstr végzetes hiba: -#: ../../../wmaker-crm/WINGs/error.c:71 +#: ../../../wmaker-crm/WINGs/error.c:124 msgid error: msgstr hiba: -#: ../../../wmaker-crm/WINGs/error.c:74 -msgid warning: +#: ../../../wmaker-crm/WINGs/error.c:131 +msgid warn: msgstr figyelmeztetés: #: ../../../wmaker-crm/WINGs/findfile.c:58 @@ -133,9 +133,7 @@ msgid missing ; in PropList dictionary entry msgstr hiányzó ; a PropList szótár elemben #: ../../../wmaker-crm/WINGs/proplist.c:885 -msgid -was expecting a string, data, array or dictionary. If it's a string, try -enclosing it with . +msgid was expecting a string, data, array or dictionary. If it's a string, try enclosing it with . msgstr karakterlánc, adat, tömb vagy szótár típusra számítottam. Ha karakterláncot adtál meg, próbáld idézőjelbe tenni! #: ../../../wmaker-crm/WINGs/proplist.c:888 @@ -233,198 +231,197 @@ msgstr szürke msgid dark gray msgstr sötétszürke -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:384 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:383 msgid Colors msgstr Színek -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:559 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2625 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:558 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2624 msgid Brightness msgstr Világosság -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:561 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:635 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:666 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:697 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:755 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:786 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:818 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:851 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:1989 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2627 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2661 -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2695 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:560 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:634 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:665 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:696 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:754 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:785 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:817 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:850 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:1988 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2626 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2660 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:2694 msgid Color Panel: Could not allocate memory msgstr Szín panel: nem sikerült a memória foglalás -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:633 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:632 msgid Red msgstr Piros -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:664 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:663 msgid Green msgstr Zöld -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:695 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:694 msgid Blue msgstr Kék -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:753 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:752 msgid Cyan msgstr Türkiz -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:784 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:783 msgid Magenta msgstr Lila -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:816 +#: ../../../wmaker-crm/WINGs/wcolorpanel.c:815 msgid Yellow msgstr Sárga -#: ../../../wmaker-crm/WINGs/wcolorpanel.c:849 +#:
[PATCH] Added ppm return error code
This patch is adding some more error code return value for ppm module. --- wrlib/load_ppm.c | 46 +- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/wrlib/load_ppm.c b/wrlib/load_ppm.c index b45d0f0..e8e1ab3 100644 --- a/wrlib/load_ppm.c +++ b/wrlib/load_ppm.c @@ -112,12 +112,16 @@ static RImage *load_graymap(FILE * file, int w, int h, int max, int raw) unsigned char *ptr; int x, y; - image = RCreateImage(w, h, 0); - if (!image) + if (raw != '2' raw != '5') { + RErrorCode = RERR_BADFORMAT; return NULL; + } - if (raw != '2' raw != '5') - return image; + image = RCreateImage(w, h, 0); + if (!image) { + RErrorCode = RERR_NOMEMORY; + return NULL; + } if (max 256) { ptr = image-data; @@ -129,6 +133,7 @@ static RImage *load_graymap(FILE * file, int w, int h, int max, int raw) if (val max || val 0) { RErrorCode = RERR_BADIMAGEFILE; + RReleaseImage(image); return NULL; } @@ -142,12 +147,16 @@ static RImage *load_graymap(FILE * file, int w, int h, int max, int raw) if (raw == '5') { char *buf; buf = malloc(w + 1); - if (!buf) + if (!buf) { + RErrorCode = RERR_NOMEMORY; + RReleaseImage(image); return NULL; + } for (y = 0; y h; y++) { if (!fread(buf, w, 1, file)) { free(buf); RErrorCode = RERR_BADIMAGEFILE; + RReleaseImage(image); return NULL; } @@ -171,12 +180,16 @@ static RImage *load_pixmap(FILE * file, int w, int h, int max, int raw) unsigned char *ptr; int i = 0; - image = RCreateImage(w, h, 0); - if (!image) + if (raw != '3' raw != '6') { + RErrorCode = RERR_BADFORMAT; return NULL; + } - if (raw != '3' raw != '6') - return image; + image = RCreateImage(w, h, 0); + if (!image) { + RErrorCode = RERR_NOMEMORY; + return NULL; + } ptr = image-data; if (max 256) { @@ -189,6 +202,7 @@ static RImage *load_pixmap(FILE * file, int w, int h, int max, int raw) if (val max || val 0) { RErrorCode = RERR_BADIMAGEFILE; + RReleaseImage(image); return NULL; } @@ -202,6 +216,7 @@ static RImage *load_pixmap(FILE * file, int w, int h, int max, int raw) while (i w * h) { if (fread(buf, 1, 3, file) != 3) { RErrorCode = RERR_BADIMAGEFILE; + RReleaseImage(image); return NULL; } @@ -222,12 +237,16 @@ static RImage *load_bitmap(FILE * file, int w, int h, int max, int raw) int val; unsigned char *ptr; - image = RCreateImage(w, h, 0); - if (!image) + if (raw != '1' raw != '4') { + RErrorCode = RERR_BADFORMAT; return NULL; + } - if (raw != '1' raw != '4') - return image; + image = RCreateImage(w, h, 0); + if (!image) { + RErrorCode = RERR_NOMEMORY; + return NULL; + } ptr = image-data; if (raw == '1') { @@ -237,6 +256,7 @@ static RImage *load_bitmap(FILE * file, int w, int h, int max, int raw) if (val max || val 0) { RErrorCode = RERR_BADIMAGEFILE; + RReleaseImage(image); return NULL; } -- 1.8.3.2 0001-Added-ppm-return-error-code.patch Description: Binary data