Admittedly I can not really think of a reason this would occur
in normal use but if it does it'll result in a crash so
better safe than sorry
Change-Id: I593652bb658475bbd9a18026243c02524f5e7ccb
I observed a crash on buflib>move_block
after dumping ram I noticed that the buffer for filetypes was being corrupted
tree_get_entry_at returns a entry from the buflib 'tree entry' buffer
filetree.c->ft_load writes data to this buffer before checking if it has
reached the last entry resulting in buffer overflow that overwrites the
next entry in the buffer ['filetypes']
Patch checks that the index passed to tree_get_entry_at() is in range
otherwise it returns NULL
Added checks + panic in other functions using tree_get_entry_at()
Fixed tree_lock_cache() calls in playlist and filetree
Change-Id: Ibf9e65652b4e00445e8e509629aebbcddffcfd4d
FS#13151 - Deleting item from shortcut menu corrupts the menu's display
The function that writes shortcut.txt didn't write existing
name, icon or talkclip items
Change-Id: I4418700c82f91522b2dd8a975548d7bd91f150d3
Now: writes all three supplying default values if the items don't exist
output_dyn_value now requires the count for number of units
Binary scale now shows Kibibytes instead of kilobytes (g#1742)
Fixes output for negative values as well
Change-Id: I8aa896860e97d2453fa35069e2dfe1caac60109f
Forgot static for recording_step_levels()
There is no need to re-calculate split_time or split_bytes each loop
you can't change them within recording screen -- these become constants
We don't need longs to store the conversion of minutes to seconds
or MB to bytes these are now shorts and the conversion takes place within
rec_timesplit_seconds() and rec_sizesplit_bytes() respectively
Change-Id: Ie1514085e92e00e67eb1942c0f4f8820714587e9
Limit buf2 to enough characters(16) to display signed int & label
consolidate gain/volume settings
Change-Id: I9ef6aa1e16ea2a17acc311a9b7e1c0556f58eff7
dsoundfile.c used memcpy for overlapping memory regions switched to memmove
Suppress the 160+ warnings for cast-function-type
This plugin would require major work to fix these warnings
Change-Id: I309d914839c1e70126a05b387863fd21613497a9
This is a seemingly random bug that only affects (as far as I can tell)
arm devices it isn't actually random as code changes cause it to
appear/disappear based on alignment
Change-Id: I4cbc4370677959319f8589fe454e854c45623468
When loading a file, Lua may call the reader function again after it
returned end of input
https://www.lua.org/bugs.html#5.1.5-2
Change-Id: Ic2f4d727705a0b8f48ce792f6a9f7af25a503037
pixel-painter was depending on the old readline code that
returned nil for empty lines however empty lines should
have returned an empty string
Change-Id: Ic06ce920a7ab38e1fb8f7197d637e74ed9e35653
added a few more levels and increased difficulty based on level
Rliimage allows us to use circles in boomshine
Optimized some of the code to exceed the speed of the original
Change-Id: I68eb74f8b68fcdc8a9d022cd172374744425f15d
String constants were already expanded in the first macro
pcm functions were looking for stack position #1 when they needed stack pos #2
Change-Id: I7b4fb90953ab2395b77cbd550fdd257fafca6aae
The auto generated utf8/16 encode/decode functions did not work.
Upon implementing them correctly I found that lua handles the utf-8
form properly but I could not get utf-16 to work without crashing
maybe someone can come along later and implement utf-16 safe string
functions but for now utf-16 is removed.
Change-Id: I97a044e200dc27f683a45487cd93fce667c670c4
The way to call the pcm functions has changed
rb.pcm("option", var)
rb.pcm_set_frequency(freq) = becomes rb.pcm("pcmsetfrequency", freq)
added pcm.lua to the includes for conversion to old functions
if your script is broken by this change you simply add
`require("pcm")` to the top for the old functionality
added rb.pcm("calculatepeaks")
Change-Id: I092057b0c0b5575e567862661f122da1ca2680e8
Did not mean to wipe out these function when I consolidated audio
Made the regex for audio_ and playlist_ exact matches instead of fuzzy
Change-Id: I7537d1b494afb114c8b6333ea177b1e482f6b672
Adds %F -- %Y-%m-%d
Fixes possible buffer overflow when writing final \0
Frees a bit of code on NON-RTC targets
Change-Id: I1c2600a68ee88c6c99f411ae6646861578683f90
Rocklua was using the full fscanf implementation
to simply read %ld for the file:read("*n") function
wasting 1k on unneeded/unused functionality
Instead, I've implemented a filetol function to duplicate it
without the extra overhead using strtol which as an added bonus
ERANGE errors now resolve to LONG_MIN and LONGMAX instead of
integer overflow
filetol()
reads long int from an open file, skips preceding
whitespaces returns -1 if error, 1 on success.
*num set to LONG_MAX or LONG_MIN on overflow.
If number of digits is > than LUAI_MAXNUMBER2STR
filepointer will continue till the next non digit
but buffer will stop being filled with characters.
Preceding zero is ignored.
Change-Id: Ia42d0f73c63a894625bca4581e9b7e1cc7387fd2
Some of the lcd functions had support for multiple screens but this wasn't
very safe since the screen number wasn't bounded within the screens[] array
This adds support for all the lcd functions along with checking that screen#
is bounded properly, adds around 600 bytes to devices with a remote screen
devices without a remote screen lock to SCREEN_MAIN
Change-Id: I618bbc7b3919c7b0ff375fb2d71949d7cab43c87
rli_marshal and rli_copy allow the use of a custom lua function
instead of the built-ins, this custom function can signal to stop
before the whole image is iterated.
Originally it was checking for a return of 0
which was additional overhead for the built-in functions
(which never stop early) as well.
Now custom_transform sets the x & y deltas to 0 to indicate early
exit removing an extra 'if' per cycle and return from all of the
rli_transform functions
The lcd_xxx_bitmap functions all require x, y, w, h, screen these calls
have been consolidated into a single function get_bmp_bounds()
Change-Id: I88de3149c58d1bfb40e9d1a91341fb86cbd63b51
While luaL_addstring() works perfectly fine for the
final buffer once Lual_pushresult() is called
kbd_input doesn't display a previous input properly
since the buffer hasn't been finalized yet
Change-Id: Ic50acaa8b7b17077dec8750dd2b6382624e8a549
Removes unneeded functions from kbd_input
Consolidates message filling function for gui_syncyesno_run & do_menu
Change-Id: If3c3cea3cbf37a8dc52983c0db174de6d54b35f8
The way to call the playlist functions has changed
rb.playlist("option", var)
rb.playlist_add(filename) = becomes rb.playlist("add", filename)
added playlist.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("playlist")`
to the top for the old functionality
added rb.playlist_tracks(dir, filename) to playlist.lua
this will allow you to add all tracks in a playlist.m3u8
to a lua table
Change-Id: I87fcc56be365d8495d214f069331b6ddbfbef1db
audio_play was removed from the rocklib I assume due to inconsistent
behavior I've readded it with a check for audio paused which instead
uses rewind/ff and then resumes audio
the way to call the audio functions has changed as well
rb.audio("option", var)
so rb.audio_play(0, 0) becomes rb.audio("play", 0, 0)
audio_audio_flush_and_reload_tracks becomes
rb.audio("flushandreloadtracks")
all functions except audio("getfilepos") return the previous (or still current)
status
added audio.lua to the includes for conversion to old functions
if your script is broken by this change you simply add `require("audio")`
to the top for the old functionality
Change-Id: I364adf0c85d9c12b98cde29c26fbe5ee05b9d331
Both of these functions modified the string in the lua stack
per lua manual:
'When a C function receives a string argument from Lua,
there are only two rules that it must observe: Not to pop the string
from the stack while accessing it and never to modify the string'
strip_extension will still work with old parameters
and is thus backwards compatible
strip_extension("filename")
create_numbered_filename has changed slightly and IS NOT backwards compatible
create_numbered_filename(path, prefix, suffix, [number])
(number defaults to -1)
Change-Id: I34cf7e2f6f691f33d5ac2b2e995855a171fb99b3
allows rocklib_img to be excluded if needed
stops rocklib_aux from generating redundant prototypes for
lcd_mono_bitmap[_part]
Change-Id: Ie208ad71ab5f9a7deb026dc01a5b0a0631a0d29c
change offending bool return to int
warning: cast between incompatible function types from
'_Bool (*)(void)' to 'int (*)(void)' [-Wcast-function-type]
forgot to remove -- typedef int (*menu_function)(void);
Change-Id: Ie4c8d3ddb0fb7843c4ec584203350d658d6bee3e
rocklib_aux is auto generated from plugin.h
there are a few functions that get added automatically that
are unusable without their companion functions or duplicate
functionality already supplied by lua
Duplicated functionality:
rb->rand, rb->srand
-- see math.rand math.srand
rb->remove, rb->rename
-- see os.remove, os.rename
Unusable:
rb->open_utf8
-- this should be added to the lua file open routines (if at all)
rb->codec_run_proc, rb->codec_close
-- without rb->codec_load_file these are pointless
rb->timer_set_period, timer_unregister
-- even with timer_register implemented lua is not
-- reentrant and crashes the state when timer fires
Shouldn't be used!:
rb->strlcpy, rb->strlcat, rb->strcpy, rb->strcat
-- lua reuses strings by hashed values you break this contract if
-- you change strings behind its back plus lua provides a way to
-- do these functions safely within the strings api
Change-Id: I2f65704a90930378cbbceb254e52f61e8074471e
int is an incompatible type for targets that have 32bit fb_data
need to use FB_SCALARPACK for them
Change-Id: Ib3b5ff19c54d8d1bb76af33d0538a17a71301514
removes tslf allocations from do_menu and gui_syncyesno_run in favor of
lua_newuserdata
removes some luaL_opt functions in favor of equivalent lua_to functions
moves some definitions to the rocklib.h file
Change-Id: Iaacc3249b8f1af2c220ce59dead0050c66cb3b04
- increase decoder thread stack size just enough (2KiB) to
avoid stack overflows when seeking in opus files
- only do so on devices with at least 8MiB of RAM
Change-Id: I7e7182ae866338b4aad6ed7e32391ddd667121bd