ref: af77f8d82fbf474eb4b51fc847ca6c38a367412b
parent: 32d4b4758a14b15544ba1870aa251914b80774eb
author: Mark Harris <mark.hsj@gmail.com>
date: Thu May 3 19:51:35 EDT 2018
opusdec: Use literal format strings Allows for automatic checking of arguments.
--- a/src/opusdec.c
+++ b/src/opusdec.c
@@ -251,17 +251,13 @@
if (pic.format==OP_PIC_FORMAT_URL) {
fprintf(stderr, "|%s\n", pic.data);
} else {
- /*We use separate strings for each of these to simplify i18n in
- the future someday.*/
- static const char *PIC_FORMAT_STR[4] = {
- "|<%u bytes of image data>\n",
- "|<%u bytes of JPEG data>\n",
- "|<%u bytes of PNG data>\n",
- "|<%u bytes of GIF data>\n"
+ static const char *pic_format_str[4] = {
+ "image", "JPEG", "PNG", "GIF"
};
int format_idx;
format_idx = pic.format < 1 || pic.format >= 4 ? 0 : pic.format;
- fprintf(stderr, PIC_FORMAT_STR[format_idx], pic.data_length);
+ fprintf(stderr, "|<%u bytes of %s data>\n", pic.data_length,
+ pic_format_str[format_idx]);
}
opus_picture_tag_clear(&pic);
}