comparison src/libgfx.c @ 1301:e03f20d0f785

Constify.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 19 Aug 2017 04:25:02 +0300
parents fd442faa705f
children 38614c07c2e2
comparison
equal deleted inserted replaced
1300:fd442faa705f 1301:e03f20d0f785
131 131
132 return TRUE; 132 return TRUE;
133 } 133 }
134 134
135 135
136 int dmWriteImageData(DMImage *img, void *cbdata, int (*writeRowCB)(void *, Uint8 *, size_t), const DMImageConvSpec *spec) 136 int dmWriteImageData(DMImage *img, void *cbdata, int (*writeRowCB)(void *, const Uint8 *, const size_t), const DMImageConvSpec *spec)
137 { 137 {
138 int x, y, yscale, xscale, res = 0, rowSize, rowWidth; 138 int x, y, yscale, xscale, res = 0, rowSize, rowWidth;
139 Uint8 *row = NULL; 139 Uint8 *row = NULL;
140 140
141 // Allocate memory for row buffer 141 // Allocate memory for row buffer
327 fclose(fp); 327 fclose(fp);
328 return res; 328 return res;
329 } 329 }
330 330
331 331
332 static int dmWritePPMRow(void *cbdata, Uint8 *row, size_t len) 332 static int dmWritePPMRow(void *cbdata, const Uint8 *row, const size_t len)
333 { 333 {
334 if (fwrite(row, sizeof(Uint8), len, (FILE *) cbdata) == len) 334 if (fwrite(row, sizeof(Uint8), len, (FILE *) cbdata) == len)
335 return DMERR_OK; 335 return DMERR_OK;
336 else 336 else
337 return DMERR_FWRITE; 337 return DMERR_FWRITE;
374 return res; 374 return res;
375 } 375 }
376 376
377 377
378 #ifdef DM_USE_LIBPNG 378 #ifdef DM_USE_LIBPNG
379 static int dmWritePNGRow(void *cbdata, Uint8 *row, size_t len) 379 static int dmWritePNGRow(void *cbdata, const Uint8 *row, const size_t len)
380 { 380 {
381 png_structp png_ptr = cbdata; 381 png_structp png_ptr = cbdata;
382 (void) len; 382 (void) len;
383 383
384 if (setjmp(png_jmpbuf(png_ptr))) 384 if (setjmp(png_jmpbuf(png_ptr)))
747 } DMPCXData; 747 } DMPCXData;
748 748
749 749
750 // Returns one byte from row buffer (of length len) at offset soffs, 750 // Returns one byte from row buffer (of length len) at offset soffs,
751 // OR zero if the offset is outside buffer. 751 // OR zero if the offset is outside buffer.
752 static inline Uint8 dmPCXGetByte(Uint8 *row, const size_t len, const size_t soffs) 752 static inline Uint8 dmPCXGetByte(const Uint8 *row, const size_t len, const size_t soffs)
753 { 753 {
754 return (soffs < len) ? row[soffs] : 0; 754 return (soffs < len) ? row[soffs] : 0;
755 } 755 }
756 756
757 static BOOL dmPCXFlush(DMPCXData *pcx) 757 static BOOL dmPCXFlush(DMPCXData *pcx)
791 } 791 }
792 return DMERR_OK; 792 return DMERR_OK;
793 } 793 }
794 794
795 795
796 static int dmWritePCXRow(void *cbdata, Uint8 *row, size_t len) 796 static int dmWritePCXRow(void *cbdata, const Uint8 *row, const size_t len)
797 { 797 {
798 DMPCXData *pcx = (DMPCXData *) cbdata; 798 DMPCXData *pcx = (DMPCXData *) cbdata;
799 int err; 799 int err;
800 size_t soffs = 0; 800 size_t soffs = 0;
801 801