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 gfxprim.git.
The branch, master has been updated via 1b13c9d73865b69c4c52c27a5328fd7aea68b805 (commit) from 4337959cd59402d875d9e155659602c1c549676b (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/gfxprim.git/commit/1b13c9d73865b69c4c52c27a5328fd7aea68b...
commit 1b13c9d73865b69c4c52c27a5328fd7aea68b805 Author: Cyril Hrubis metan@ucw.cz Date: Fri Aug 10 18:25:32 2012 +0200
loaders: Now GP_RetCode free + fixes.
diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 5434e65..758804b 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -238,7 +238,7 @@ static int rotate(GP_Context **c, const char *params) } if (res == NULL) - return GP_ENOMEM; + return ENOMEM; GP_ContextFree(*c); *c = res; @@ -408,7 +408,7 @@ static int blur(GP_Context **c, const char *params) float sigma_y = 0;
if (param_parse(params, blur_params, "blur", param_err, &sigma, &sigma_x, &sigma_y)) - return GP_EINVAL; + return EINVAL;
if (sigma > 0) { sigma_x = sigma; @@ -983,7 +983,7 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char progress_prefix = "Saving Image";
if (!strcmp(fmt, "ppm")) - ret = GP_SavePPM(name, bitmap, "b"); + ret = GP_SavePPM(name, bitmap, "b", progress_callback); else if (!strcmp(fmt, "jpg")) ret = GP_SaveJPG(bitmap, name, progress_callback); else if (!strcmp(fmt, "png")) diff --git a/include/SDL/GP_SDL_Context.h b/include/SDL/GP_SDL_Context.h index 3963824..af53f54 100644 --- a/include/SDL/GP_SDL_Context.h +++ b/include/SDL/GP_SDL_Context.h @@ -27,6 +27,7 @@ #define GP_SDL_CONTEXT_H
#include "GP.h" +#include "core/GP_RetCode.h"
GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf);
diff --git a/include/SDL/GP_SDL_VideoInit.h b/include/SDL/GP_SDL_VideoInit.h index fbb388d..99927b6 100644 --- a/include/SDL/GP_SDL_VideoInit.h +++ b/include/SDL/GP_SDL_VideoInit.h @@ -27,6 +27,7 @@ #define GP_SDL_VIDEOINIT_H
#include "GP.h" +#include "core/GP_RetCode.h"
GP_RetCode GP_SDL_VideoInit(GP_Context *context, int width, int height, int argc, char **argv); diff --git a/include/loaders/GP_Loaders.h b/include/loaders/GP_Loaders.h index 286e372..ab0f4ef 100644 --- a/include/loaders/GP_Loaders.h +++ b/include/loaders/GP_Loaders.h @@ -34,7 +34,6 @@
#include "core/GP_Context.h" #include "core/GP_ProgressCallback.h" -#include "core/GP_RetCode.h"
#include "GP_PBM.h" #include "GP_PGM.h" diff --git a/include/loaders/GP_PGM.h b/include/loaders/GP_PGM.h index 54fd546..f949cde 100644 --- a/include/loaders/GP_PGM.h +++ b/include/loaders/GP_PGM.h @@ -19,18 +19,19 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_PGM_H -#define GP_PGM_H +#ifndef LOADERS_GP_PGM_H +#define LOADERS_GP_PGM_H
#include "core/GP_Context.h" -#include "core/GP_RetCode.h"
-GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res); +GP_Context *GP_LoadPGM(const char *src_path, + GP_ProgressCallback *callback);
-GP_RetCode GP_SavePGM(const char *res_path, GP_Context *src); +int GP_SavePGM(const char *res_path, GP_Context *src, + GP_ProgressCallback *callback);
-#endif /* GP_PGM_H */ +#endif /* LOADERS_GP_PGM_H */ diff --git a/include/loaders/GP_PPM.h b/include/loaders/GP_PPM.h index b7d71d7..4ac1bf1 100644 --- a/include/loaders/GP_PPM.h +++ b/include/loaders/GP_PPM.h @@ -16,21 +16,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_PPM_H -#define GP_PPM_H +#ifndef LOADERS_GP_PPM_H +#define LOADERS_GP_PPM_H
#include "core/GP_Context.h" -#include "core/GP_RetCode.h" +#include "core/GP_ProgressCallback.h"
-GP_RetCode GP_LoadPPM(const char *src_path, GP_Context **res); +GP_Context *GP_LoadPPM(const char *src_path, GP_ProgressCallback *callback);
/* * The fmt may be either "a" for ASCII or "b" for BINARY. */ -GP_RetCode GP_SavePPM(const char *res_path, GP_Context *src, char *fmt); +int GP_SavePPM(const char *res_path, GP_Context *src, char *fmt, + GP_ProgressCallback *callback);
-#endif /* GP_PPM_H */ +#endif /* LOADERS_GP_PPM_H */ diff --git a/libs/loaders/GP_Loaders.c b/libs/loaders/GP_Loaders.c index 3d19e1a..5700aa4 100644 --- a/libs/loaders/GP_Loaders.c +++ b/libs/loaders/GP_Loaders.c @@ -37,7 +37,6 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) { int len, saved_errno; - GP_Context *res = NULL; if (access(src_path, R_OK)) { @@ -96,19 +95,16 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback) break; case 'g': case 'G': - //TODO: Fix this!!! if (src_path[len - 3] == 'p' || src_path[len - 3] == 'P') { - GP_LoadPGM(src_path, &res); - return res; + return GP_LoadPGM(src_path, callback); } break; case 'p': case 'P': if (src_path[len - 3] == 'p' || src_path[len - 3] == 'P') { - GP_LoadPPM(src_path, &res); - return res; + return GP_LoadPPM(src_path, callback); } break; } diff --git a/libs/loaders/GP_PGM.c b/libs/loaders/GP_PGM.c index 1e0d10f..9ae8c64 100644 --- a/libs/loaders/GP_PGM.c +++ b/libs/loaders/GP_PGM.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -71,17 +71,22 @@ static void try_read_comments(FILE *f) ungetc(c1, f); }
-GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res) +GP_Context *GP_LoadPGM(const char *src_path, GP_ProgressCallback *callback) { - FILE *f = fopen(src_path, "r"); + FILE *f; + GP_Context *ret; uint32_t w, h, gray; GP_PixelType type; char h1, h2; + int err = EIO; + + f = fopen(src_path, "r");
if (f == NULL) { + err = errno; GP_DEBUG(1, "Failed to open file '%s': %s", src_path, strerror(errno)); - return GP_EBADFILE; + goto err0; }
h1 = fgetc(f); @@ -91,12 +96,14 @@ GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res) GP_DEBUG(1, "Invalid PGM header '%c%c' (0x%2x 0x%2x)", isprint(h1) ? h1 : ' ', isprint(h2) ? h2 : ' ', h1, h2); + err = EINVAL; goto err1; }
try_read_comments(f);
if (fscanf(f, "%"PRIu32, &w) < 1) { + err = errno; GP_DEBUG(1, "Failed to read PGM header width"); goto err1; } @@ -104,6 +111,7 @@ GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res) try_read_comments(f); if (fscanf(f, "%"PRIu32, &h) < 1) { + err = errno; GP_DEBUG(1, "Failed to read PGM header height"); goto err1; } @@ -111,6 +119,7 @@ GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res) try_read_comments(f); if (fscanf(f, "%"PRIu32, &gray) < 1) { + err = errno; GP_DEBUG(1, "Failed to read PGM header gray"); goto err1; } @@ -129,46 +138,55 @@ GP_RetCode GP_LoadPGM(const char *src_path, GP_Context **res) type = GP_PIXEL_G8; break; default: + GP_DEBUG(1, "Invalid number of grays %u", gray); + err = EINVAL; goto err1; }
- *res = GP_ContextAlloc(w, h, type); + ret = GP_ContextAlloc(w, h, type);
- if (res == NULL) + if (ret == NULL) { + err = ENOMEM; goto err1; + }
+ //TODO: errno here switch (gray) { case 1: - if (GP_PXMLoad1bpp(f, *res)) + if (GP_PXMLoad1bpp(f, ret)) goto err2; break; case 3: - if (GP_PXMLoad2bpp(f, *res)) + if (GP_PXMLoad2bpp(f, ret)) goto err2; break; case 15: - if (GP_PXMLoad4bpp(f, *res)) + if (GP_PXMLoad4bpp(f, ret)) goto err2; break; case 255: - if (GP_PXMLoad8bpp(f, *res)) + if (GP_PXMLoad8bpp(f, ret)) goto err2; break; }
fclose(f); - return GP_ESUCCESS; + return ret; err2: - free(*res); + GP_ContextFree(ret); err1: fclose(f); - return GP_EBADFILE; +err0: + errno = err; + return NULL; }
-GP_RetCode GP_SavePGM(const char *res_path, GP_Context *src) +int GP_SavePGM(const char *res_path, GP_Context *src, + GP_ProgressCallback *callback) { FILE *f; uint32_t gray; + int err = EIO;
switch (src->pixel_type) { case GP_PIXEL_G1: @@ -184,44 +202,56 @@ GP_RetCode GP_SavePGM(const char *res_path, GP_Context *src) gray = 255; break; default: - return GP_ENOIMPL; + GP_DEBUG(1, "Invalid pixel type '%s'", + GP_PixelTypeName(src->pixel_type)); + errno = EINVAL; + return 1; } f = fopen(res_path, "w");
if (f == NULL) { + err = errno; GP_DEBUG(1, "Failed to open file '%s': %s", res_path, strerror(errno)); - return GP_EBADFILE; + goto err0; }
if (fprintf(f, "P2n%u %un%un# Generated by gfxprimn", (unsigned int) src->w, (unsigned int) src->h, gray) < 3) - goto err; + goto err1;
+ //TODO: errno switch (gray) { case 1: if (GP_PXMSave1bpp(f, src)) - goto err; + goto err1; break; case 3: if (GP_PXMSave2bpp(f, src)) - goto err; + goto err1; break; //TODO case 255: if (GP_PXMSave8bpp(f, src)) - goto err; + goto err1; break; default: - return GP_ENOIMPL; + err = ENOSYS; + goto err1; }
- if (fclose(f)) - return GP_EBADFILE; + if (fclose(f)) { + err = errno; + GP_DEBUG(1, "Failed to close file '%s': %s", + res_path, strerror(errno)); + goto err0; + }
- return GP_ESUCCESS; -err: + return 0; +err1: fclose(f); - return GP_EBADFILE; +err0: + errno = err; + return 1; } diff --git a/libs/loaders/GP_PPM.c b/libs/loaders/GP_PPM.c index 13a0fa3..04dc472 100644 --- a/libs/loaders/GP_PPM.c +++ b/libs/loaders/GP_PPM.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -64,51 +64,61 @@ int load_binary_ppm(FILE *f, uint32_t depth __attribute__((unused)), return 0; }
-GP_RetCode GP_LoadPPM(const char *src_path, GP_Context **res) +GP_Context *GP_LoadPPM(const char *src_path, GP_ProgressCallback *callback) { uint32_t w, h, depth; char fmt; FILE *f; + GP_Context *ret; + int err;
f = GP_ReadPNM(src_path, &fmt, &w, &h, &depth);
- if (f == NULL) - return GP_EBADFILE; + if (f == NULL) { + err = errno; + goto err0; + }
if (fmt != '3' && fmt != '6') { GP_DEBUG(1, "Asked to load PPM but header is 'P%c'", fmt); + err = EINVAL; goto err1; }
if (depth != 255) { GP_DEBUG(1, "Unsupported depth %"PRIu32, depth); + err = ENOSYS; goto err1; }
- *res = GP_ContextAlloc(w, h, GP_PIXEL_RGB888); + ret = GP_ContextAlloc(w, h, GP_PIXEL_RGB888);
- if (res == NULL) + if (ret == NULL) { + err = ENOMEM; goto err1; + }
switch (fmt) { case '3': //TODO - fclose(f); - free(res); - return GP_ENOIMPL; + err = ENOSYS; + goto err2; case '6': - if (load_binary_ppm(f, depth, *res)) + //TODO: errno + if (load_binary_ppm(f, depth, ret)) goto err2; break; }
fclose(f); - return GP_ESUCCESS; + return ret; err2: - free(*res); + GP_ContextFree(ret); err1: fclose(f); - return GP_EBADFILE; +err0: + errno = err; + return NULL; }
static int write_binary_ppm(FILE *f, GP_Context *src) @@ -130,18 +140,23 @@ static int write_binary_ppm(FILE *f, GP_Context *src) return 0; }
-GP_RetCode GP_SavePPM(const char *res_path, GP_Context *src, char *fmt) +int GP_SavePPM(const char *res_path, GP_Context *src, char *fmt, + GP_ProgressCallback *callback) { char hfmt; FILE *f; + int err;
- if (src->pixel_type != GP_PIXEL_RGB888) - return GP_ENOIMPL; + if (src->pixel_type != GP_PIXEL_RGB888) { + errno = EINVAL; + return 1; + }
switch (*fmt) { /* ASCII */ case 'a': - return GP_ENOIMPL; + errno = ENOSYS; + return 1; break; /* binary */ case 'b': @@ -150,22 +165,32 @@ GP_RetCode GP_SavePPM(const char *res_path, GP_Context *src, char *fmt) src->w, src->h, res_path); break; default: - return GP_ENOIMPL; + errno = EINVAL; + return 1; } f = GP_WritePNM(res_path, hfmt, src->w, src->h, 255); - + + if (f == NULL) + return 1; + if (write_binary_ppm(f, src)) { GP_DEBUG(1, "Failed to write buffer"); - fclose(f); - return GP_EBADFILE; + err = EIO; + goto err1; }
if (fclose(f) < 0) { + err = errno; GP_DEBUG(1, "Failed to close file '%s' : %s", res_path, strerror(errno)); - return GP_EBADFILE; + goto err0; }
- return GP_ESUCCESS; + return 0; +err1: + fclose(f); +err0: + errno = err; + return 1; } diff --git a/libs/loaders/GP_PXMCommon.c b/libs/loaders/GP_PXMCommon.c index 0add2f0..48bc361 100644 --- a/libs/loaders/GP_PXMCommon.c +++ b/libs/loaders/GP_PXMCommon.c @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -46,7 +46,7 @@ static int read_comment(FILE *f) } }
-GP_RetCode GP_PXMLoad1bpp(FILE *f, GP_Context *context) +int GP_PXMLoad1bpp(FILE *f, GP_Context *context) { uint8_t *pixel = context->pixels; uint32_t x, y; @@ -58,10 +58,10 @@ GP_RetCode GP_PXMLoad1bpp(FILE *f, GP_Context *context) while (run) { switch (fgetc(f)) { case EOF: - return GP_EBADFILE; + return EIO; case '#': if (read_comment(f)) - return GP_EBADFILE; + return EIO; break; case '0': *pixel &= ~(0x80>>(x%8)); @@ -86,10 +86,10 @@ GP_RetCode GP_PXMLoad1bpp(FILE *f, GP_Context *context) pixel++; }
- return GP_ESUCCESS; + return 0; }
-GP_RetCode GP_PXMLoad2bpp(FILE *f, GP_Context *context) +int GP_PXMLoad2bpp(FILE *f, GP_Context *context) { uint8_t *pixel = context->pixels; uint32_t x, y; @@ -101,10 +101,10 @@ GP_RetCode GP_PXMLoad2bpp(FILE *f, GP_Context *context) while (run) { switch (fgetc(f)) { case EOF: - return GP_EBADFILE; + return EIO; case '#': if (read_comment(f)) - return GP_EBADFILE; + return EIO; break; case '0': *pixel &= ~(0xc0>>(2*(x%4))); @@ -139,10 +139,10 @@ GP_RetCode GP_PXMLoad2bpp(FILE *f, GP_Context *context) pixel++; }
- return GP_ESUCCESS; + return 0; }
-GP_RetCode GP_PXMLoad4bpp(FILE *f, GP_Context *context) +int GP_PXMLoad4bpp(FILE *f, GP_Context *context) { uint8_t *pixel = context->pixels; uint32_t x, y; @@ -156,10 +156,10 @@ GP_RetCode GP_PXMLoad4bpp(FILE *f, GP_Context *context) while (run) { switch (fgetc(f)) { case EOF: - return GP_EBADFILE; + return EIO; case '#': if (read_comment(f)) - return GP_EBADFILE; + return EIO; break; case '1': ch = fgetc(f); @@ -185,10 +185,10 @@ GP_RetCode GP_PXMLoad4bpp(FILE *f, GP_Context *context) pixel++; }
- return GP_ESUCCESS; + return 0; }
-GP_RetCode GP_PXMLoad8bpp(FILE *f, GP_Context *context) +int GP_PXMLoad8bpp(FILE *f, GP_Context *context) { uint8_t *pixel = context->pixels; uint32_t x, y; @@ -202,10 +202,10 @@ GP_RetCode GP_PXMLoad8bpp(FILE *f, GP_Context *context) while (run) { switch (ch = fgetc(f)) { case EOF: - return GP_EBADFILE; + return EIO; case '#': if (read_comment(f)) - return GP_EBADFILE; + return EIO; break; case '1' ... '9': val = ch - '0'; @@ -218,7 +218,7 @@ GP_RetCode GP_PXMLoad8bpp(FILE *f, GP_Context *context) } if (val > 255) - return GP_EBADFILE; + return EIO; case '0': run = 0; @@ -233,12 +233,12 @@ GP_RetCode GP_PXMLoad8bpp(FILE *f, GP_Context *context) } }
- return GP_ESUCCESS; + return 0; }
#define BITMASK(byte, bit) (!!((byte)&(0x80>>(bit))))
-static GP_RetCode write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src) +static int write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src) { uint32_t x, max = src->bytes_per_row; int ret; @@ -250,7 +250,7 @@ static GP_RetCode write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src) if (x != 0) if (fprintf(f, " ") < 0) - return GP_EBADFILE; + return EIO; ret = fprintf(f, "%u %u %u %u %u %u %u %u", BITMASK(data[x], 0), @@ -262,26 +262,26 @@ static GP_RetCode write_line_1bpp(FILE *f, const uint8_t *data, GP_Context *src) BITMASK(data[x], 6), BITMASK(data[x], 7)); if (ret < 0) - return GP_EBADFILE; + return EIO; }
for (x = 0; x < (src->w % 8); x++) { ret = fprintf(f, " %u", BITMASK(data[max], x));
if (ret < 0) - return GP_EBADFILE; + return EIO; }
if (fprintf(f, "n") < 0) - return GP_EBADFILE; + return EIO;
- return GP_ESUCCESS; + return 0; }
-GP_RetCode GP_PXMSave1bpp(FILE *f, GP_Context *context) +int GP_PXMSave1bpp(FILE *f, GP_Context *context) { uint32_t y; - GP_RetCode ret; + int ret;
for (y = 0; y < context->h; y++) { ret = write_line_1bpp(f, context->pixels + context->bytes_per_row * y, @@ -291,12 +291,12 @@ GP_RetCode GP_PXMSave1bpp(FILE *f, GP_Context *context) return ret; }
- return GP_ESUCCESS; + return 0; }
#define MASK_2BPP(byte, pix) (0x03 & (byte>>((3 - pix)<<1)))
-static GP_RetCode write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src) +static int write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src) { uint32_t x, max = src->bytes_per_row; int ret; @@ -308,7 +308,7 @@ static GP_RetCode write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src) if (x != 0) if (fprintf(f, " ") < 0) - return GP_EBADFILE; + return EIO; ret = fprintf(f, "%u %u %u %u", MASK_2BPP(data[x], 0), @@ -316,26 +316,26 @@ static GP_RetCode write_line_2bpp(FILE *f, const uint8_t *data, GP_Context *src) MASK_2BPP(data[x], 2), MASK_2BPP(data[x], 3)); if (ret < 0) - return GP_EBADFILE; + return EIO; }
for (x = 0; x < (src->w % 4); x++) { ret = fprintf(f, " %u", MASK_2BPP(data[max], x));
if (ret < 0) - return GP_EBADFILE; + return EIO; }
if (fprintf(f, "n") < 0) - return GP_EBADFILE; + return EIO;
- return GP_ESUCCESS; + return EIO; }
-GP_RetCode GP_PXMSave2bpp(FILE *f, GP_Context *context) +int GP_PXMSave2bpp(FILE *f, GP_Context *context) { uint32_t y; - GP_RetCode ret; + int ret;
for (y = 0; y < context->h; y++) { ret = write_line_2bpp(f, context->pixels + context->bytes_per_row * y, @@ -345,10 +345,10 @@ GP_RetCode GP_PXMSave2bpp(FILE *f, GP_Context *context) return ret; }
- return GP_ESUCCESS; + return EIO; }
-static GP_RetCode write_line_8bpp(FILE *f, const uint8_t *data, GP_Context *src) +static int write_line_8bpp(FILE *f, const uint8_t *data, GP_Context *src) { uint32_t x; int ret; @@ -357,24 +357,24 @@ static GP_RetCode write_line_8bpp(FILE *f, const uint8_t *data, GP_Context *src) if (x != 0) if (fprintf(f, " ") < 0) - return GP_EBADFILE; + return EIO; ret = fprintf(f, "%u", data[x]); if (ret < 0) - return GP_EBADFILE; + return EIO; }
if (fprintf(f, "n") < 0) - return GP_EBADFILE; + return EIO;
- return GP_ESUCCESS; + return 0; }
-GP_RetCode GP_PXMSave8bpp(FILE *f, GP_Context *context) +int GP_PXMSave8bpp(FILE *f, GP_Context *context) { uint32_t y; - GP_RetCode ret; + int ret;
for (y = 0; y < context->h; y++) { ret = write_line_8bpp(f, context->pixels + context->bytes_per_row * y, @@ -384,5 +384,5 @@ GP_RetCode GP_PXMSave8bpp(FILE *f, GP_Context *context) return ret; }
- return GP_ESUCCESS; + return 0; } diff --git a/libs/loaders/GP_PXMCommon.h b/libs/loaders/GP_PXMCommon.h index 39e7d02..7ed531e 100644 --- a/libs/loaders/GP_PXMCommon.h +++ b/libs/loaders/GP_PXMCommon.h @@ -29,30 +29,29 @@
*/
-#ifndef GP_PXM_COMMON_H -#define GP_PXM_COMMON_H +#ifndef LOADERS_GP_PXM_COMMON_H +#define LOADERS_GP_PXM_COMMON_H
#include <stdio.h> #include "core/GP_Core.h" -#include "core/GP_RetCode.h"
/* * Save context to ascii file. * * The pixel type is not checked here as these are internal funcitons. */ -GP_RetCode GP_PXMSave1bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMSave2bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMSave4bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMSave8bpp(FILE *f, GP_Context *context); +int GP_PXMSave1bpp(FILE *f, GP_Context *context); +int GP_PXMSave2bpp(FILE *f, GP_Context *context); +int GP_PXMSave4bpp(FILE *f, GP_Context *context); +int GP_PXMSave8bpp(FILE *f, GP_Context *context);
/* * Load context from ascii file. */ -GP_RetCode GP_PXMLoad1bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMLoad2bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMLoad4bpp(FILE *f, GP_Context *context); -GP_RetCode GP_PXMLoad8bpp(FILE *f, GP_Context *context); +int GP_PXMLoad1bpp(FILE *f, GP_Context *context); +int GP_PXMLoad2bpp(FILE *f, GP_Context *context); +int GP_PXMLoad4bpp(FILE *f, GP_Context *context); +int GP_PXMLoad8bpp(FILE *f, GP_Context *context);
/* * Loads image header, returns pointer to FILE* on success, fills image @@ -65,4 +64,4 @@ FILE *GP_WriteHeaderPNM(const char *dst_path, char *fmt, uint32_t w, uint32_t h, uint32_t depth);
-#endif /* GP_PXM_COMMON_H */ +#endif /* LOADERS_GP_PXM_COMMON_H */
-----------------------------------------------------------------------
Summary of changes: demos/grinder/grinder.c | 6 +- include/SDL/GP_SDL_Context.h | 1 + include/SDL/GP_SDL_VideoInit.h | 1 + include/loaders/GP_Loaders.h | 1 - include/loaders/GP_PGM.h | 15 ++++--- include/loaders/GP_PPM.h | 15 ++++--- libs/loaders/GP_Loaders.c | 8 +--- libs/loaders/GP_PGM.c | 82 +++++++++++++++++++++++++------------ libs/loaders/GP_PPM.c | 71 ++++++++++++++++++++++---------- libs/loaders/GP_PXMCommon.c | 88 ++++++++++++++++++++-------------------- libs/loaders/GP_PXMCommon.h | 23 +++++----- 11 files changed, 182 insertions(+), 129 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.