diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 1a6861ff16..d89ca8b534 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -601,7 +601,7 @@ static int parse_viewporttextstyle(struct skin_element *element, *line = (struct line_desc)LINE_DESC_DEFINIT; unsigned colour; - static const char *vp_options[] = { "invert", "color", "colour", + static const char * const vp_options[] = { "invert", "color", "colour", "clear", "gradient", NULL}; int vp_op = string_option(mode, vp_options, false); @@ -1401,7 +1401,7 @@ static int parse_skinvar( struct skin_element *element, return 0; case SKIN_TOKEN_VAR_SET: { - static const char *sv_options[] = {"touch", "set", "inc", "dec", NULL}; + static const char * const sv_options[] = {"touch", "set", "inc", "dec", NULL}; struct skin_var_changer *data = skin_buffer_alloc(sizeof(*data)); if (!data) @@ -1705,7 +1705,7 @@ static int parse_touchregion(struct skin_element *element, if (region->action == ACTION_NONE) return WPS_ERROR_INVALID_PARAM; } - static const char *pm_options[] = {"allow_while_locked", "reverse_bar", + static const char * const pm_options[] = {"allow_while_locked", "reverse_bar", "repeat_press", "long_press", NULL}; int pm_op; diff --git a/apps/misc.c b/apps/misc.c index d5e8bb5d98..63aa3589b2 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -1395,7 +1395,7 @@ int split_string(char *str, const char split_char, char *vector[], const int vec /* returns match index from option list * returns -1 if option was not found * option list is array of char pointers with the final item set to null - * ex - const char *option[] = { "op_a", "op_b", "op_c", NULL} + * ex - const char * const option[] = { "op_a", "op_b", "op_c", NULL} */ int string_option(const char *option, const char *const oplist[], bool ignore_case) { diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index 5b3658a1cb..9ff9c72f80 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c @@ -98,7 +98,7 @@ static void fix_path_part(char* path, int offset, int count) } #ifdef USE_JPEG_COVER -static const char * extensions[] = { "jpeg", "jpg", "bmp" }; +static const char * const extensions[] = { "jpeg", "jpg", "bmp" }; static const unsigned char extension_lens[] = { 4, 3, 3 }; /* Try checking for several file extensions, return true if a file is found and * leaving the path modified to include the matching extension. diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index a54b762566..db8d892b7c 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -189,7 +189,7 @@ static short balance_mem[BAL_MEM_SIZE]; #define AGC_MODE_SIZE 5 #define AGC_SAFETY_MODE 0 -static const char* agc_preset_str[] = +static const char* const agc_preset_str[] = { "Off", "S", "L", "D", "M", "V" }; /* "Off", "Safety (clip)", diff --git a/apps/shortcuts.c b/apps/shortcuts.c index 754bd83b80..2b032f1fd4 100644 --- a/apps/shortcuts.c +++ b/apps/shortcuts.c @@ -312,7 +312,7 @@ static int readline_cb(int n, char *buf, void *parameters) } else if (sc && settings_parseline(buf, &name, &value)) { - static const char *nm_options[] = {"type", "name", "data", + static const char * const nm_options[] = {"type", "name", "data", "icon", "talkclip", NULL}; int nm_op = string_option(name, nm_options, false); diff --git a/apps/tagcache.c b/apps/tagcache.c index b6d15e7a1f..436d85812b 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -137,7 +137,7 @@ static int tempbuf_handle; (1LU << tag_virt_canonicalartist)) /* String presentation of the tags defined in tagcache.h. Must be in correct order! */ -static const char *tags_str[] = { "artist", "album", "genre", "title", +static const char * const tags_str[] = { "artist", "album", "genre", "title", "filename", "composer", "comment", "albumartist", "grouping", "year", "discnumber", "tracknumber", "canonicalartist", "bitrate", "length", "playcount", "rating", "playtime", "lastplayed", "commitid", "mtime", @@ -151,7 +151,7 @@ static const char *tags_str[] = { "artist", "album", "genre", "title", "tag_virt_entryage", "tag_virt_autoscore" }; /* more debug strings */ -static const char *tag_type_str[] = { +static const char * const tag_type_str[] = { [clause_none] = "clause_none", [clause_is] = "clause_is", [clause_is_not] = "clause_is_not", [clause_gt] = "clause_gt", [clause_gteq] = "clause_gteq", [clause_lt] = "clause_lt", diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index bfc38b20dc..4487952162 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c @@ -940,8 +940,8 @@ bool dbg_hw_info_emi(void) bool dbg_hw_info_audio(void) { - static const char *hp_sel[2] = {"DAC", "Line1"}; - static const char *mux_sel[4] = {"Mic", "Line1", "HP", "Line2"}; + static const char * const hp_sel[2] = {"DAC", "Line1"}; + static const char * const mux_sel[4] = {"Mic", "Line1", "HP", "Line2"}; lcd_setfont(FONT_SYSFIXED); while(1) @@ -1171,7 +1171,7 @@ bool dbg_hw_info_button(void) } else if(MAP[i].periph == IMX233_BUTTON_LRADC) { - static const char *op_name[] = + static const char * const op_name[] = { [IMX233_BUTTON_EQ] = "eq", [IMX233_BUTTON_GT] = "gt", diff --git a/firmware/target/arm/s5l8700/debug-s5l8700.c b/firmware/target/arm/s5l8700/debug-s5l8700.c index ecb15df5d0..c42eac0438 100644 --- a/firmware/target/arm/s5l8700/debug-s5l8700.c +++ b/firmware/target/arm/s5l8700/debug-s5l8700.c @@ -112,7 +112,7 @@ bool dbg_hw_info(void) _DEBUG_PRINTF("PMU:"); for(i=0;i<7;i++) { - char *device[] = {"(unknown)", + static const char * const device[] = {"(unknown)", "(CLICKWHEEL)", "(LCD)", "(AUDIO)", @@ -139,7 +139,7 @@ bool dbg_hw_info(void) char line_cfg[4]; int abr_stat; uint32_t abr_cnt; - char *abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; + static const char * const abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; uartc_port_get_line_info(&ser_port, &tx_stat, &rx_stat, &tx_speed, &rx_speed, line_cfg); diff --git a/firmware/target/arm/s5l8702/debug-s5l8702.c b/firmware/target/arm/s5l8702/debug-s5l8702.c index 68b16f39f7..26b8e557a0 100644 --- a/firmware/target/arm/s5l8702/debug-s5l8702.c +++ b/firmware/target/arm/s5l8702/debug-s5l8702.c @@ -104,7 +104,7 @@ bool dbg_hw_info(void) _DEBUG_PRINTF("PMU:"); for(i=0;i<7;i++) { - char *device[] = {"unknown", + static const char *const device[] = {"unknown", "unknown", "LCD", "AUDIO", @@ -157,7 +157,7 @@ bool dbg_hw_info(void) char line_cfg[4]; int abr_stat; uint32_t abr_cnt; - char *abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; + static const char * const abrstatus[] = {"Idle", "Launched", "Counting", "Abnormal"}; uartc_port_get_line_info(&ser_port, &tx_stat, &rx_stat, &tx_speed, &rx_speed, line_cfg); diff --git a/firmware/target/hosted/ibasso/pcm-ibasso.c b/firmware/target/hosted/ibasso/pcm-ibasso.c index 5c68ded3e1..889386b7c6 100644 --- a/firmware/target/hosted/ibasso/pcm-ibasso.c +++ b/firmware/target/hosted/ibasso/pcm-ibasso.c @@ -123,7 +123,7 @@ static void* pcm_thread_run(void* nothing) /* https://github.com/tinyalsa/tinyalsa/blob/master/tinypcminfo.c */ -static const char* format_lookup[] = +static const char* const format_lookup[] = { /*[0] =*/ "S8", "U8", diff --git a/firmware/target/hosted/ibasso/sysfs-ibasso.c b/firmware/target/hosted/ibasso/sysfs-ibasso.c index 8f62e3fec2..e3a0f911af 100644 --- a/firmware/target/hosted/ibasso/sysfs-ibasso.c +++ b/firmware/target/hosted/ibasso/sysfs-ibasso.c @@ -32,7 +32,7 @@ #include "sysfs-ibasso.h" -static const char* SYSFS_PATHS[] = +static const char* const SYSFS_PATHS[] = { /* SYSFS_DX50_CODEC_VOLUME */ "/dev/codec_volume", diff --git a/firmware/target/hosted/usb-hiby.c b/firmware/target/hosted/usb-hiby.c index b82fa5c4ce..050c86e446 100644 --- a/firmware/target/hosted/usb-hiby.c +++ b/firmware/target/hosted/usb-hiby.c @@ -63,8 +63,8 @@ void usb_enable(bool on) */ int disk_mount_all(void) { - const char *dev[] = {"/dev/mmcblk0p1", "/dev/mmcblk0"}; - const char *fs[] = {"vfat", "exfat"}; + const char * const dev[] = {"/dev/mmcblk0p1", "/dev/mmcblk0"}; + const char * const fs[] = {"vfat", "exfat"}; sysfs_set_string("/sys/class/android_usb/android0/f_mass_storage/lun/file", ""); diff --git a/lib/rbcodec/dsp/tdspeed.c b/lib/rbcodec/dsp/tdspeed.c index 21585eb78e..64cbaf5e12 100644 --- a/lib/rbcodec/dsp/tdspeed.c +++ b/lib/rbcodec/dsp/tdspeed.c @@ -41,7 +41,6 @@ #define MAX_INPUTCOUNT 512 /* Max input count so dst doesn't overflow */ #define FIXED_BUFCOUNT 3072 /* 48KHz factor 3.0 */ #define FIXED_OUTBUFCOUNT 4096 -#define NBUFFERS 4 enum tdspeed_ops { @@ -65,9 +64,9 @@ static struct tdspeed_state_s int32_t *ovl_buff[2]; /* overlap buffer (L+R) */ } tdspeed_state; -static int32_t *buffers[NBUFFERS] = { NULL, NULL, NULL, NULL }; +static int32_t *buffers[TDSPEED_NBUFFERS] = { NULL, NULL, NULL, NULL }; -static const int buffer_sizes[NBUFFERS] = +static const int buffer_sizes[TDSPEED_NBUFFERS] = { FIXED_BUFCOUNT * sizeof(int32_t), FIXED_BUFCOUNT * sizeof(int32_t), @@ -552,7 +551,7 @@ static intptr_t tdspeed_configure(struct dsp_proc_entry *this, break; case DSP_PROC_INIT: - if (!tdspeed_alloc_buffers(buffers, buffer_sizes, NBUFFERS)) + if (!tdspeed_alloc_buffers(buffers, buffer_sizes, TDSPEED_NBUFFERS)) return -1; /* fail the init */ st->this = this; @@ -564,7 +563,7 @@ static intptr_t tdspeed_configure(struct dsp_proc_entry *this, st->this = NULL; st->factor = PITCH_SPEED_100; dsp_outbuf.remcount = 0; - tdspeed_free_buffers(buffers, NBUFFERS); + tdspeed_free_buffers(buffers, TDSPEED_NBUFFERS); break; case DSP_PROC_NEW_FORMAT: diff --git a/lib/rbcodec/dsp/tdspeed.h b/lib/rbcodec/dsp/tdspeed.h index 2949c1bee9..84920ac7c2 100644 --- a/lib/rbcodec/dsp/tdspeed.h +++ b/lib/rbcodec/dsp/tdspeed.h @@ -34,6 +34,7 @@ #define STRETCH_MAX (250L * PITCH_SPEED_PRECISION) /* 250% */ #define STRETCH_MIN (35L * PITCH_SPEED_PRECISION) /* 35% */ +#define TDSPEED_NBUFFERS 4 void dsp_timestretch_enable(bool enable); void dsp_set_timestretch(int32_t percent);