mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
[Bugfix] theme %ss will overflow buffer, update %ft manual entry
%ss did not check for the size of the resulting string before copying it to the buffer %ft has a search text mode Change-Id: I1321681c249251aafe0e39bcc510b9e81f0cd0d3
This commit is contained in:
parent
50515de940
commit
dfd01709c5
2 changed files with 16 additions and 7 deletions
|
@ -823,7 +823,11 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
byte_len = end_byte - start_byte;
|
byte_len = end_byte - start_byte;
|
||||||
|
|
||||||
if (token_val != buf)
|
if (token_val != buf)
|
||||||
|
{
|
||||||
|
if (byte_len >= buf_size) /* the resulting string exceeds buf */
|
||||||
|
return &token_val[start_byte]; /* just return the string */
|
||||||
memcpy(buf, &token_val[start_byte], byte_len);
|
memcpy(buf, &token_val[start_byte], byte_len);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
buf = &buf[start_byte];
|
buf = &buf[start_byte];
|
||||||
|
|
||||||
|
|
|
@ -758,18 +758,23 @@ a horizontal progressbar which doesn't fill and draws the image
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\begin{tagmap}
|
\begin{tagmap}
|
||||||
\config{\%ft(filename [,line]} & Get a line of text from a file.\\
|
\config{\%ft(filename [,line|search text]} & Get a line of text from a file.\\
|
||||||
\end{tagmap}
|
\end{tagmap}
|
||||||
Use this tag to check for the existence of a file or read a line of text from a file.
|
Use this tag to check for the existence of a file, read a line or search for a line in a file.
|
||||||
Checking if a file exists can be done with \%?(ft(filename)<Found|NotFound>
|
Checking if a file exists can be done with \%?ft(filename)<Found|NotFound>\newline
|
||||||
similarly you can also check if a specific line exists with \%?(ft(filename, n)<Found|NotFound>
|
Check if a specific line exists with \%?ft(filename, n)<Found|NotFound> where n is the desired line.\newline
|
||||||
where n is the desired line.
|
Search (ignoring case) of the beginning of each line with \%?ft(filename,search text)<Found|NotFound>\newline
|
||||||
Note: empty files or files that do not exist are ignored by the skin engine otherwise
|
Note: empty files or files that do not exist are treated by the skin engine as a comment and ignored.\newline
|
||||||
|
lines must end with CR or LF but may not exceed 320 characters including search text \newline
|
||||||
|
Maximum 1023 lines will be accessible to the theme.
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[filename] -- filename Note: files can only be found in \fname{/.rockbox} directory or one of its children.
|
\item[filename] -- filename Note: files can only be found in \fname{/.rockbox} directory or one of its children.
|
||||||
eg. \%ft(wps/file.txt) would refer to \fname{/.rockbox/wps/file.txt}
|
eg. \%ft(wps/file.txt) would refer to \fname{/.rockbox/wps/file.txt}
|
||||||
\item[line] -- OPTIONAL, which line to grab, defaults to the first line.
|
\item[line] -- OPTIONAL, which line to grab, defaults to the first line.
|
||||||
Note: lines must end with CR or LF but may not exceed 320 characters
|
\item[search text] -- OPTIONAL, instead of a line number find (ignoring case) a line that begins with search text.
|
||||||
|
Note: If found this search text will be removed and the rest of the string returned to the end of line.\newline
|
||||||
|
Quotes and spaces should not be included unless you want to search for a string containing them.\newline
|
||||||
|
ie. \%ft(filename,text) is not the same as \%ft(filename,'text') and \%ft(filename,text) is not the same as \%ft(filename, text)
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\begin{tagmap}
|
\begin{tagmap}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue