rsys

Basic data structures and low-level features
git clone git://git.meso-star.fr/rsys.git
Log | Files | Refs | README | LICENSE

commit 9fc5ea8eef98f7ab333c0b28668ec24681ad2adf
parent cd1a44ab3b299dca30de68e4e2c6cdd81a75c1bf
Author: vaplv <vaplv@free.fr>
Date:   Fri, 25 Apr 2025 15:31:01 +0200

Remove obsolete image API functions

They were deprecated in 2017 (commit e1f2092). It's time to clean house.

Diffstat:
Msrc/image.c | 90-------------------------------------------------------------------------------
Msrc/image.h | 17-----------------
2 files changed, 0 insertions(+), 107 deletions(-)

diff --git a/src/image.c b/src/image.c @@ -374,93 +374,3 @@ exit: error: goto exit; } - -/******************************************************************************* - * Deprecated functions - ******************************************************************************/ -static res_T -deprecated_image_ppm_write_stream - (FILE* fp, - const int width, - const int height, - const int Bpp, - const unsigned char* buffer) -{ - int i; - res_T res = RES_OK; - - if(!width || !height || !Bpp || !buffer || !fp) { - res = RES_BAD_ARG; - goto error; - } - - i = fprintf(fp, "P3\n\n%i %i\n%i\n", width, height, 255); - if(i < 0) { - res = RES_IO_ERR; - goto error; - } - - if(Bpp) { - const long pitch = width * Bpp; - int x, y; - for(y = 0; y < height; ++y) { - const unsigned char* row = buffer + y * pitch; - for(x = 0; x < width; ++x) { - const unsigned char* pixel = row + x * Bpp; - i = fprintf(fp, "%u %u %u\n", - pixel[0], - Bpp > 1 ? pixel[1] : pixel[0], - Bpp > 2 ? pixel[2] : pixel[0]); - if(i < 0) { - res = RES_IO_ERR; - goto error; - } - } - fprintf(fp, "\n"); - } - } - -exit: - return res; -error: - goto exit; -} - -res_T -image_ppm_write - (const char* path, - const int width, - const int height, - const int Bpp, - const unsigned char* buffer) -{ - FILE* fp = NULL; - res_T res = RES_OK; - - fp = fopen(path, "w"); - if(NULL == fp) { - res = RES_IO_ERR; - goto error; - } - - res = deprecated_image_ppm_write_stream(fp, width, height, Bpp, buffer); - if(res != RES_OK) goto error; - -exit: - if(fp) fclose(fp); - return res; -error: - goto exit; -} - -res_T -image_ppm_write_stream - (FILE* fp, - const int width, - const int height, - const int Bpp, - const unsigned char* buffer) -{ - return deprecated_image_ppm_write_stream(fp, width, height, Bpp, buffer); -} - diff --git a/src/image.h b/src/image.h @@ -88,23 +88,6 @@ image_write_ppm_stream const int binary, FILE* stream); -DEPRECATED RSYS_API res_T -image_ppm_write - (const char* path, - const int width, - const int height, - const int bytes_per_pixel, - const unsigned char* buffer); - -DEPRECATED RSYS_API res_T -image_ppm_write_stream - (FILE* stream, - const int width, - const int height, - const int bytes_per_pixel, - const unsigned char* buffer); - END_DECLS #endif /* IMAGE_H */ -