[Fix Yellow] remove DEBUGF from skin_parser.c cleanup spaces

move const to the proper side

Change-Id: Ide7c1878281eaee28d06426eee43041ad61acbc4
This commit is contained in:
William Wilgus 2024-12-03 01:30:14 -05:00
parent 68d4fd0e5b
commit 793c797447
8 changed files with 54 additions and 58 deletions

View file

@ -63,7 +63,7 @@ void dummy_process(enum screen_type screen, struct wps_data *data, bool preproce
{ (void)screen, (void)data, (void)preprocess; } /* dummy replaces conditionals */ { (void)screen, (void)data, (void)preprocess; } /* dummy replaces conditionals */
static const struct gui_skin_helper empty_skin_helper = {&dummy_process,NULL,false}; static const struct gui_skin_helper empty_skin_helper = {&dummy_process,NULL,false};
static const struct gui_skin_helper const * skin_helpers[SKINNABLE_SCREENS_COUNT] = static const struct gui_skin_helper * const skin_helpers[SKINNABLE_SCREENS_COUNT] =
{ {
#define SKH(proc, def, lob) &((struct gui_skin_helper){proc, def, lob}) #define SKH(proc, def, lob) &((struct gui_skin_helper){proc, def, lob})
&empty_skin_helper, &empty_skin_helper,

View file

@ -19,7 +19,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#ifndef _SKIN_ENGINE_H #ifndef _SKIN_ENGINE_H
#define _SKIN_ENGINE_H #define _SKIN_ENGINE_H
@ -68,7 +68,7 @@ void skin_backdrop_unload(int backdrop_id);
void skin_backdrop_set_buffer(int backdrop_id, struct skin_viewport *svp); void skin_backdrop_set_buffer(int backdrop_id, struct skin_viewport *svp);
/* do the button loop as often as required for the peak meters to update /* do the button loop as often as required for the peak meters to update
* with a good refresh rate. * with a good refresh rate.
* gwps is really gwps[NB_SCREENS]! don't wrap this in FOR_NB_SCREENS() * gwps is really gwps[NB_SCREENS]! don't wrap this in FOR_NB_SCREENS()
*/ */
int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout); int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout);

View file

@ -2162,10 +2162,6 @@ static bool skin_load_fonts(struct wps_data *data)
static int convert_viewport(struct wps_data *data, struct skin_element* element) static int convert_viewport(struct wps_data *data, struct skin_element* element)
{ {
if (element->tag)
DEBUGF("%s %s\n", __func__, element->tag->name);
else
DEBUGF("%s %s\n", __func__, "?");
struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(*skin_vp)); struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(*skin_vp));
struct screen *display = &screens[curr_screen]; struct screen *display = &screens[curr_screen];

View file

@ -75,7 +75,7 @@ enum themable_icons sb_get_icon(enum screen_type screen)
{ {
return sbs_has_title[screen] ? sbs_icon[screen] : Icon_NOICON + 2; return sbs_has_title[screen] ? sbs_icon[screen] : Icon_NOICON + 2;
} }
void sb_process(enum screen_type screen, struct wps_data *data, bool preprocess) void sb_process(enum screen_type screen, struct wps_data *data, bool preprocess)
{ {
if (preprocess) if (preprocess)
@ -116,7 +116,7 @@ void sb_set_info_vp(enum screen_type screen, OFFSETTYPE(char*) label)
{ {
infovp_label[screen] = label; infovp_label[screen] = label;
} }
struct viewport *sb_skin_get_info_vp(enum screen_type screen) struct viewport *sb_skin_get_info_vp(enum screen_type screen)
{ {
if (sbs_loaded[screen] == false) if (sbs_loaded[screen] == false)
@ -218,7 +218,7 @@ char* sb_create_from_settings(enum screen_type screen)
int bar_position = statusbar_position(screen); int bar_position = statusbar_position(screen);
ptr = buf; ptr = buf;
ptr[0] = '\0'; ptr[0] = '\0';
/* setup the inbuilt statusbar */ /* setup the inbuilt statusbar */
if (bar_position != STATUSBAR_OFF) if (bar_position != STATUSBAR_OFF)
{ {
@ -227,7 +227,7 @@ char* sb_create_from_settings(enum screen_type screen)
{ {
y = screens[screen].lcdheight - STATUSBAR_HEIGHT; y = screens[screen].lcdheight - STATUSBAR_HEIGHT;
} }
len = snprintf(ptr, remaining, "%%V(0,%d,-,%d,0)\n%%wi\n", len = snprintf(ptr, remaining, "%%V(0,%d,-,%d,0)\n%%wi\n",
y, height); y, height);
remaining -= len; remaining -= len;
ptr += len; ptr += len;
@ -239,7 +239,7 @@ char* sb_create_from_settings(enum screen_type screen)
else else
#endif #endif
ptr2 = global_settings.ui_vp_config; ptr2 = global_settings.ui_vp_config;
if (ptr2[0] && ptr2[0] != '-') /* from ui viewport setting */ if (ptr2[0] && ptr2[0] != '-') /* from ui viewport setting */
{ {
char *comma = ptr; char *comma = ptr;
@ -250,7 +250,7 @@ char* sb_create_from_settings(enum screen_type screen)
do { do {
param_count++; param_count++;
comma = strchr(comma+1, ','); comma = strchr(comma+1, ',');
} while (comma && param_count < 6); } while (comma && param_count < 6);
if (comma) if (comma)
{ {
@ -263,9 +263,9 @@ char* sb_create_from_settings(enum screen_type screen)
fg[i] = '\0'; comma++; i=0; fg[i] = '\0'; comma++; i=0;
while (*comma != ')') while (*comma != ')')
bg[i++] = *comma++; bg[i++] = *comma++;
bg[i] = '\0'; bg[i] = '\0';
len += snprintf(end, remaining-len, ") %%Vf(%s) %%Vb(%s)\n", fg, bg); len += snprintf(end, remaining-len, ") %%Vf(%s) %%Vb(%s)\n", fg, bg);
} }
} }
else else
{ {
@ -281,7 +281,7 @@ char* sb_create_from_settings(enum screen_type screen)
default: default:
height = screens[screen].lcdheight; height = screens[screen].lcdheight;
} }
len = snprintf(ptr, remaining, "%%ax%%Vi(-,0,%d,-,%d,1)\n", len = snprintf(ptr, remaining, "%%ax%%Vi(-,0,%d,-,%d,1)\n",
y, height); y, height);
} }
return buf; return buf;

View file

@ -28,7 +28,7 @@
#include "skin_parser.h" #include "skin_parser.h"
/**************************************************************************** /****************************************************************************
* *
* This code handles buffer allocation for the entire skin system. * This code handles buffer allocation for the entire skin system.
* This needs to work in 3 different situations: * This needs to work in 3 different situations:
* 1) as a stand alone library. ROCKBOX isnt defined, alloc using malloc() * 1) as a stand alone library. ROCKBOX isnt defined, alloc using malloc()
@ -39,8 +39,8 @@
* the start of our buffer * the start of our buffer
* 3) ROCKBOX "application/hosted" builds, alloc using the hosts malloc(). * 3) ROCKBOX "application/hosted" builds, alloc using the hosts malloc().
* We need to keep track of all allocations so they can be free()'d easily * We need to keep track of all allocations so they can be free()'d easily
* *
* *
****************************************************************************/ ****************************************************************************/

View file

@ -71,7 +71,7 @@ static void skip_whitespace(const char** document)
} }
#ifdef ROCKBOX #ifdef ROCKBOX
struct skin_element* skin_parse(const char* document, struct skin_element* skin_parse(const char* document,
skin_callback cb, void* cb_data) skin_callback cb, void* cb_data)
{ {
callback = cb; callback = cb;
@ -84,7 +84,7 @@ struct skin_element* skin_parse(const char* document)
struct skin_element* last = NULL; struct skin_element* last = NULL;
const char* cursor = document; /*Keeps track of location in the document*/ const char* cursor = document; /*Keeps track of location in the document*/
skin_line = 1; skin_line = 1;
skin_start = (char*)document; skin_start = (char*)document;
viewport_line = 0; viewport_line = 0;
@ -227,7 +227,7 @@ static struct skin_element* skin_parse_viewport(const char** document)
{ {
skip_comment(&cursor); skip_comment(&cursor);
skin_line++; skin_line++;
} }
if (check_viewport(cursor)) if (check_viewport(cursor))
break; break;
@ -263,7 +263,7 @@ static struct skin_element* skin_parse_viewport(const char** document)
{ {
skip_comment(&cursor); skip_comment(&cursor);
skin_line++; skin_line++;
} }
if (check_viewport(cursor)) if (check_viewport(cursor))
break; break;
@ -394,7 +394,7 @@ static struct skin_element* skin_parse_line_optional(const char** document,
/* Moving up the calling function's pointer */ /* Moving up the calling function's pointer */
*document = cursor; *document = cursor;
if(root) if(root)
{ {
children[0] = skin_buffer_to_offset(root); children[0] = skin_buffer_to_offset(root);
@ -540,7 +540,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
|| (tag_args[0] == '|' && *cursor != ARGLISTOPENSYM) || (tag_args[0] == '|' && *cursor != ARGLISTOPENSYM)
|| (qmark && *cursor != ARGLISTOPENSYM)) || (qmark && *cursor != ARGLISTOPENSYM))
{ {
#ifdef ROCKBOX #ifdef ROCKBOX
if (callback) if (callback)
{ {
@ -622,7 +622,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
if (*tag_args == '[') if (*tag_args == '[')
{ {
/* we need to guess which type of param it is. /* we need to guess which type of param it is.
* guess using this priority: * guess using this priority:
* default > decimal/integer > single tag/code > string * default > decimal/integer > single tag/code > string
*/ */
@ -644,7 +644,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
{ {
haspercent = haspercent || (cursor[j] == '%'); haspercent = haspercent || (cursor[j] == '%');
hasdecimal = hasdecimal || (cursor[j] == '.'); hasdecimal = hasdecimal || (cursor[j] == '.');
number = number && (isdigit(cursor[j]) || number = number && (isdigit(cursor[j]) ||
(cursor[j] == '.') || (cursor[j] == '.') ||
(cursor[j] == '-') || (cursor[j] == '-') ||
(cursor[j] == '%')); (cursor[j] == '%'));
@ -664,12 +664,12 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
{ {
type_code = 'p'; type_code = 'p';
} }
else if (number && else if (number &&
(strchr(temp_params, 'i') || strchr(temp_params, 'd'))) (strchr(temp_params, 'i') || strchr(temp_params, 'd')))
{ {
type_code = strchr(temp_params, 'i') ? 'i' : 'd'; type_code = strchr(temp_params, 'i') ? 'i' : 'd';
} }
else if (haspercent && else if (haspercent &&
(strchr(temp_params, 't') || strchr(temp_params, 'c'))) (strchr(temp_params, 't') || strchr(temp_params, 'c')))
{ {
type_code = strchr(temp_params, 't') ? 't' : 'c'; type_code = strchr(temp_params, 't') ? 't' : 'c';
@ -682,7 +682,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
{ {
skin_error(INSUFFICIENT_ARGS, cursor); skin_error(INSUFFICIENT_ARGS, cursor);
return 0; return 0;
} }
} }
else else
type_code = *tag_args; type_code = *tag_args;
@ -778,7 +778,7 @@ static int skin_parse_tag(struct skin_element* element, const char** document)
params[i].type = CODE; params[i].type = CODE;
params[i].data.code = skin_buffer_to_offset(child); params[i].data.code = skin_buffer_to_offset(child);
} }
skip_whitespace(&cursor); skip_whitespace(&cursor);
@ -884,7 +884,7 @@ static int skin_parse_text(struct skin_element* element, const char** document,
element->data = skin_buffer_to_offset(text); element->data = skin_buffer_to_offset(text);
if (element->data < 0) if (element->data < 0)
return 0; return 0;
for(dest = 0; dest < length; dest++) for(dest = 0; dest < length; dest++)
{ {
/* Advancing cursor if we've encountered an escaped character */ /* Advancing cursor if we've encountered an escaped character */
@ -895,7 +895,7 @@ static int skin_parse_text(struct skin_element* element, const char** document,
cursor++; cursor++;
} }
text[length] = '\0'; text[length] = '\0';
#ifdef ROCKBOX #ifdef ROCKBOX
if (callback) if (callback)
{ {
@ -918,7 +918,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
const char* bookmark; const char* bookmark;
int children = 1; int children = 1;
int i; int i;
#ifdef ROCKBOX #ifdef ROCKBOX
bool feature_available = true; bool feature_available = true;
const char *false_branch = NULL; const char *false_branch = NULL;
@ -953,7 +953,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
} }
} }
#endif #endif
/* Counting the children */ /* Counting the children */
if(*(cursor++) != ENUMLISTOPENSYM) if(*(cursor++) != ENUMLISTOPENSYM)
{ {
@ -991,7 +991,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
} }
} }
#ifdef ROCKBOX #ifdef ROCKBOX
if (*cursor == ENUMLISTCLOSESYM && if (*cursor == ENUMLISTCLOSESYM &&
false_branch == NULL && !feature_available) false_branch == NULL && !feature_available)
{ {
false_branch = cursor+1; false_branch = cursor+1;
@ -1009,11 +1009,11 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
cursor = bookmark; cursor = bookmark;
#endif #endif
/* Parsing the children */ /* Parsing the children */
/* Feature tags could end up having 0 children which breaks /* Feature tags could end up having 0 children which breaks
* the render in dangerous ways. Minor hack, but insert an empty * the render in dangerous ways. Minor hack, but insert an empty
* child. (e.g %?xx<foo> when xx isnt available ) */ * child. (e.g %?xx<foo> when xx isnt available ) */
if (children == 0) if (children == 0)
{ {
const char* emptyline= ""; const char* emptyline= "";
@ -1025,7 +1025,7 @@ static int skin_parse_conditional(struct skin_element* element, const char** doc
children_array[0] = skin_buffer_to_offset(skin_parse_code_as_arg(&emptyline)); children_array[0] = skin_buffer_to_offset(skin_parse_code_as_arg(&emptyline));
} }
else else
{ {
children_array = skin_alloc_children(children); children_array = skin_alloc_children(children);
if (!children_array) if (!children_array)
return 0; return 0;
@ -1085,9 +1085,9 @@ static int skin_parse_comment(struct skin_element* element, const char** documen
element->type = COMMENT; element->type = COMMENT;
element->line = skin_line; element->line = skin_line;
#ifdef ROCKBOX #ifdef ROCKBOX
element->data = INVALID_OFFSET; element->data = INVALID_OFFSET;
#else #else
element->data = text = skin_alloc_string(length); element->data = text = skin_alloc_string(length);
if (!element->data) if (!element->data)
return 0; return 0;

View file

@ -48,7 +48,7 @@ typedef long skinoffset_t;
((pointer) ? ((void*)pointer-(void*)base) : -1) ((pointer) ? ((void*)pointer-(void*)base) : -1)
/* Use this macro when declaring a variable to self-document the code. /* Use this macro when declaring a variable to self-document the code.
* type is the actual type being pointed to (i.e OFFSETTYPE(char*) foo ) * type is the actual type being pointed to (i.e OFFSETTYPE(char*) foo )
* *
* WARNING: Don't use the PTRTOSKINOFFSET() around a function call as it wont * WARNING: Don't use the PTRTOSKINOFFSET() around a function call as it wont
* do what you expect. * do what you expect.
*/ */
@ -114,7 +114,7 @@ struct skin_tag_parameter
int number; int number;
OFFSETTYPE(char*) text; OFFSETTYPE(char*) text;
OFFSETTYPE(struct skin_element*) code; OFFSETTYPE(struct skin_element*) code;
} data; } data;
}; };
/* Defines an element of a SKIN file, /* Defines an element of a SKIN file,
@ -164,7 +164,7 @@ typedef int (*skin_callback)(struct skin_element* element, void* data);
/* Parses a WPS document and returns a list of skin_element /* Parses a WPS document and returns a list of skin_element
structures. */ structures. */
#ifdef ROCKBOX #ifdef ROCKBOX
struct skin_element* skin_parse(const char* document, struct skin_element* skin_parse(const char* document,
skin_callback callback, void* callback_data); skin_callback callback, void* callback_data);
#else #else
struct skin_element* skin_parse(const char* document); struct skin_element* skin_parse(const char* document);

View file

@ -50,7 +50,7 @@ extern "C"
SKIN_REFRESH_PEAK_METER) SKIN_REFRESH_PEAK_METER)
enum skin_token_type { enum skin_token_type {
SKIN_TOKEN_NO_TOKEN, SKIN_TOKEN_NO_TOKEN,
SKIN_TOKEN_UNKNOWN, SKIN_TOKEN_UNKNOWN,
@ -66,12 +66,12 @@ enum skin_token_type {
SKIN_TOKEN_ALIGN_RIGHT, SKIN_TOKEN_ALIGN_RIGHT,
SKIN_TOKEN_ALIGN_RIGHT_RTL, SKIN_TOKEN_ALIGN_RIGHT_RTL,
SKIN_TOKEN_ALIGN_LANGDIRECTION, SKIN_TOKEN_ALIGN_LANGDIRECTION,
/* Sublines */ /* Sublines */
SKIN_TOKEN_SUBLINE_TIMEOUT, SKIN_TOKEN_SUBLINE_TIMEOUT,
SKIN_TOKEN_SUBLINE_SCROLL, SKIN_TOKEN_SUBLINE_SCROLL,
/* Conditional */ /* Conditional */
SKIN_TOKEN_LOGICAL_IF, SKIN_TOKEN_LOGICAL_IF,
SKIN_TOKEN_LOGICAL_AND, SKIN_TOKEN_LOGICAL_AND,
@ -164,7 +164,7 @@ enum skin_token_type {
SKIN_TOKEN_IMAGE_DISPLAY, SKIN_TOKEN_IMAGE_DISPLAY,
SKIN_TOKEN_IMAGE_DISPLAY_LISTICON, SKIN_TOKEN_IMAGE_DISPLAY_LISTICON,
SKIN_TOKEN_IMAGE_DISPLAY_9SEGMENT, SKIN_TOKEN_IMAGE_DISPLAY_9SEGMENT,
/* Albumart */ /* Albumart */
SKIN_TOKEN_ALBUMART_LOAD, SKIN_TOKEN_ALBUMART_LOAD,
SKIN_TOKEN_ALBUMART_DISPLAY, SKIN_TOKEN_ALBUMART_DISPLAY,
@ -227,15 +227,15 @@ enum skin_token_type {
SKIN_TOKEN_LIST_ITEM_ICON, SKIN_TOKEN_LIST_ITEM_ICON,
SKIN_TOKEN_LIST_NEEDS_SCROLLBAR, SKIN_TOKEN_LIST_NEEDS_SCROLLBAR,
SKIN_TOKEN_LIST_SCROLLBAR, SKIN_TOKEN_LIST_SCROLLBAR,
SKIN_TOKEN_LOAD_FONT, SKIN_TOKEN_LOAD_FONT,
/* buttons */ /* buttons */
SKIN_TOKEN_BUTTON_VOLUME, SKIN_TOKEN_BUTTON_VOLUME,
SKIN_TOKEN_LASTTOUCH, SKIN_TOKEN_LASTTOUCH,
SKIN_TOKEN_TOUCHREGION, SKIN_TOKEN_TOUCHREGION,
SKIN_TOKEN_HAVE_TOUCH, SKIN_TOKEN_HAVE_TOUCH,
/* Virtual LED */ /* Virtual LED */
SKIN_TOKEN_VLED_HDD, SKIN_TOKEN_VLED_HDD,
/* Volume level */ /* Volume level */
@ -260,7 +260,7 @@ enum skin_token_type {
SKIN_TOKEN_SETTINGBAR, SKIN_TOKEN_SETTINGBAR,
SKIN_TOKEN_CURRENT_SCREEN, SKIN_TOKEN_CURRENT_SCREEN,
SKIN_TOKEN_LANG_IS_RTL, SKIN_TOKEN_LANG_IS_RTL,
/* Recording Tokens */ /* Recording Tokens */
SKIN_TOKEN_HAVE_RECORDING, SKIN_TOKEN_HAVE_RECORDING,
SKIN_TOKEN_IS_RECORDING, SKIN_TOKEN_IS_RECORDING,
@ -271,8 +271,8 @@ enum skin_token_type {
SKIN_TOKEN_REC_SECONDS, SKIN_TOKEN_REC_SECONDS,
SKIN_TOKEN_REC_MINUTES, SKIN_TOKEN_REC_MINUTES,
SKIN_TOKEN_REC_HOURS, SKIN_TOKEN_REC_HOURS,
/* Radio Tokens */ /* Radio Tokens */
SKIN_TOKEN_HAVE_TUNER, SKIN_TOKEN_HAVE_TUNER,
SKIN_TOKEN_TUNER_TUNED, SKIN_TOKEN_TUNER_TUNED,
@ -312,7 +312,7 @@ enum skin_token_type {
* characters for parameters are: * characters for parameters are:
* I - Required integer * I - Required integer
* i - Nullable integer * i - Nullable integer
* D - Required decimal * D - Required decimal
* d - Nullable decimal * d - Nullable decimal
* Decimals are stored as (whole*10)+part * Decimals are stored as (whole*10)+part
* P - Required percentage * P - Required percentage
@ -335,13 +335,13 @@ enum skin_token_type {
* one integer must be specified, one integer can be * one integer must be specified, one integer can be
* specified or set to default with '-', and the user can * specified or set to default with '-', and the user can
* stop providing parameters at any time after that. * stop providing parameters at any time after that.
* To specify multiple instances of the same type, put a * To specify multiple instances of the same type, put a
* number before the character. For instance, the string... * number before the character. For instance, the string...
* 2s * 2s
* will specify two strings. A ? at the beginning of the * will specify two strings. A ? at the beginning of the
* string will specify that you may choose to omit all arguments * string will specify that you may choose to omit all arguments
* *
* You may also group param types in [] which will tell the parser to * You may also group param types in [] which will tell the parser to
* accept any *one* of those types for that param. i.e [IT] will * accept any *one* of those types for that param. i.e [IT] will
* accept either an integer or tag type. [ITs] will also accept a string or - * accept either an integer or tag type. [ITs] will also accept a string or -
* *