Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 1546:228e71d66089
Constify.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 12 May 2018 21:02:10 +0300 |
parents | 3b613fcbf3ff |
children | ba09aa661c72 |
comparison
equal
deleted
inserted
replaced
1545:3b613fcbf3ff | 1546:228e71d66089 |
---|---|
53 int format; // Format identifier | 53 int format; // Format identifier |
54 int subformat; // Subformat identifier | 54 int subformat; // Subformat identifier |
55 } DMConvFormat; | 55 } DMConvFormat; |
56 | 56 |
57 | 57 |
58 static DMConvFormat convFormatList[] = | 58 static const DMConvFormat convFormatList[] = |
59 { | 59 { |
60 { "ASCII text" , "asc" , DM_FMT_WR , FFMT_ASCII , 0 }, | 60 { "ASCII text" , "asc" , DM_FMT_WR , FFMT_ASCII , 0 }, |
61 { "ANSI colored text" , "ansi" , DM_FMT_WR , FFMT_ANSI , 0 }, | 61 { "ANSI colored text" , "ansi" , DM_FMT_WR , FFMT_ANSI , 0 }, |
62 { "PNG image" , "png" , DM_FMT_RDWR , FFMT_IMAGE , DM_IMGFMT_PNG }, | 62 { "PNG image" , "png" , DM_FMT_RDWR , FFMT_IMAGE , DM_IMGFMT_PNG }, |
63 { "PPM image" , "ppm" , DM_FMT_WR , FFMT_IMAGE , DM_IMGFMT_PPM }, | 63 { "PPM image" , "ppm" , DM_FMT_WR , FFMT_IMAGE , DM_IMGFMT_PPM }, |
220 "\n" | 220 "\n" |
221 ); | 221 ); |
222 } | 222 } |
223 | 223 |
224 | 224 |
225 int dmGetConvFormat(int format, int subformat) | 225 int dmGetConvFormat(const int format, const int subformat) |
226 { | 226 { |
227 int i; | 227 for (int i = 0; i < nconvFormatList; i++) |
228 for (i = 0; i < nconvFormatList; i++) | 228 { |
229 { | 229 const DMConvFormat *fmt = &convFormatList[i]; |
230 DMConvFormat *fmt = &convFormatList[i]; | |
231 if (fmt->format == format && | 230 if (fmt->format == format && |
232 fmt->subformat == subformat) | 231 fmt->subformat == subformat) |
233 return i; | 232 return i; |
234 } | 233 } |
235 return -1; | 234 return -1; |
265 if (fext == NULL) | 264 if (fext == NULL) |
266 return FALSE; | 265 return FALSE; |
267 | 266 |
268 for (i = 0; i < nconvFormatList; i++) | 267 for (i = 0; i < nconvFormatList; i++) |
269 { | 268 { |
270 DMConvFormat *fmt = &convFormatList[i]; | 269 const DMConvFormat *fmt = &convFormatList[i]; |
271 if (fmt->fext != NULL && | 270 if (fmt->fext != NULL && |
272 strcasecmp(fext, fmt->fext) == 0) | 271 strcasecmp(fext, fmt->fext) == 0) |
273 { | 272 { |
274 *format = fmt->format; | 273 *format = fmt->format; |
275 *subformat = fmt->subformat; | 274 *subformat = fmt->subformat; |