mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
Revert "[Feature] Skin engine Themes grab text from a file %ft(file, line) WIP"
This reverts commit 62b5dfd81d.
This was accidentally merged, and wasn't up-to-date anyway.
Change-Id: I4fcceb8dc4f86762701daab72498202cabd8295a
This commit is contained in:
parent
3b78daed14
commit
e6851a55ed
32 changed files with 50 additions and 144 deletions
|
|
@ -1316,73 +1316,6 @@ static int parse_progressbar_tag(struct skin_element* element,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_filetext(struct skin_element *element,
|
||||
struct wps_token *token,
|
||||
struct wps_data *wps_data)
|
||||
{
|
||||
(void)wps_data;
|
||||
const char* filename;
|
||||
char buf[MAX_PATH];
|
||||
int line = 0;
|
||||
int fd;
|
||||
|
||||
/* format: %ft(filename[,line]) */
|
||||
filename = get_param_text(element, 0);
|
||||
|
||||
if (element->params_count == 2)
|
||||
line = get_param(element, 1)->data.number;
|
||||
else if (element->params_count != 1)
|
||||
{
|
||||
DEBUGF("%s(file, line): %s Error: param count %d\n",
|
||||
__func__, filename, element->params_count);
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
path_append(buf, root_realpath(), filename, sizeof(buf));
|
||||
DEBUGF("%s %s[%d]\n", __func__, buf, line);
|
||||
|
||||
if ((fd = open_utf8(buf, O_RDONLY)) < 0)
|
||||
{
|
||||
DEBUGF("%s: Error Opening %s\n", __func__, buf);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
int rd = 0;
|
||||
while (line >= 0)
|
||||
{
|
||||
if ((rd = read_line(fd, buf, sizeof(buf))) < 0)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
break;
|
||||
}
|
||||
line--;
|
||||
}
|
||||
|
||||
if (rd <= 0) /* empty line? */
|
||||
{
|
||||
DEBUGF("%s: Error(%d) Reading %s\n", __func__, rd, filename);
|
||||
goto failure;
|
||||
}
|
||||
|
||||
buf[rd] = '\0';
|
||||
char * skinbuf = skin_buffer_alloc(rd+1);
|
||||
|
||||
if (!skinbuf)
|
||||
{
|
||||
DEBUGF("%s: Error No Buffer %s\n", __func__, filename);
|
||||
close(fd);
|
||||
return WPS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
strcpy(skinbuf, buf);
|
||||
close(fd);
|
||||
token->value.data = PTRTOSKINOFFSET(skin_buffer, skinbuf);
|
||||
token->type = SKIN_TOKEN_STRING;
|
||||
return 0;
|
||||
failure:
|
||||
element->type = COMMENT;
|
||||
token->type = SKIN_TOKEN_NO_TOKEN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_ALBUMART
|
||||
static int parse_albumart_load(struct skin_element* element,
|
||||
struct wps_token *token,
|
||||
|
|
@ -2445,9 +2378,6 @@ static int skin_element_callback(struct skin_element* element, void* data)
|
|||
case SKIN_TOKEN_FILE_DIRECTORY:
|
||||
token->value.i = get_param(element, 0)->data.number;
|
||||
break;
|
||||
case SKIN_TOKEN_FILE_TEXT:
|
||||
function = parse_filetext;
|
||||
break;
|
||||
#ifdef HAVE_BACKDROP_IMAGE
|
||||
case SKIN_TOKEN_VIEWPORT_FGCOLOUR:
|
||||
case SKIN_TOKEN_VIEWPORT_BGCOLOUR:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue