Commit graph

32776 commits

Author SHA1 Message Date
Thomas Jarosch
b43fcbdab2 mktime(): Remove redundant assignment of 'result'
Checked with upstream lynx source code and the
second calculation line is the upstream one, too.
(In fact I diffed the whole function to check for changes)

cppcheck reported:
[rockbox/firmware/libc/mktime.c:43] -> [rockbox/firmware/libc/mktime.c:44]: (performance) Variable 'result' is reassigned a value before the old one has been used.

Change-Id: Ia04c5f55da7d86cd74cff4fce675a9c85ddce3e2
2015-01-04 17:37:35 +01:00
Thomas Jarosch
404ebb8b0b hosted target: Fix uninitialized variable in dirinfo.attribute
cppcheck reported:
[rockbox/firmware/target/hosted/filesystem-app.c:509]: (error) Uninitialized struct member: ret.attribute
[rockbox/firmware/target/hosted/filesystem-app.c:517]: (error) Uninitialized struct member: ret.attribute

Change-Id: Ie8cab727faa8110a6fe3926dbcf852e8b9e96ca7
2015-01-04 13:52:29 +01:00
Thomas Jarosch
89ab3c2761 Fix uninitialized variable (should fix libusb retry handling)
Reported by cppcheck

Change-Id: I5ac7b73f2e3eaee3d5427d118944613e572f684d
2015-01-04 13:35:47 +01:00
Thomas Jarosch
8f1fbd1dc8 Remove unneeded std::string .c_str() call
cppcheck reported:
[utils/zenutils/source/update_patch/main.cpp:105]: (performance) Passing the result of c_str() to a function that takes std::string as argument no. 1 is slow and redundant.

Change-Id: Ied9de135e693af22e1fdc3aa3b67d14b7d2c21e6
2015-01-04 12:33:09 +01:00
Franklin Wei
d0fffd6c6d Fix a tiny whitespace error in CREDITS
Change-Id: I5273d5a70c504b976ced63f731bf39b35454f6ea
Reviewed-on: http://gerrit.rockbox.org/1117
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2015-01-04 05:23:37 +01:00
Thomas Jarosch
a5ec3f4f91 Add buflib tests to .gitignore
Change-Id: Iabb499a77ec4d3459fe610d9bb7e4f23db01f885
2015-01-03 18:21:59 +01:00
Thomas Jarosch
c5933f4a81 Add and adapt buflib shrink tests
Change-Id: I8aad86226c9c9b2c04727a3703941615638b3a49
2015-01-03 18:17:11 +01:00
Thomas Jarosch
77aa94bdac Add buflib test for maximum allocation
Change-Id: I9076b81d2fd2609ab3e9c8c5a087f8a387480f46
2015-01-03 18:17:11 +01:00
Thomas Jarosch
5f824e21e0 Add and adapt buflib move tests
Change-Id: I57929f8f6a18cf9570f7358d48ad33f285b9ab0f
2015-01-03 18:17:11 +01:00
Thomas Jarosch
7d5f133007 Bring abroad second buflib test
Interfaces with core_alloc_* instead of buflib directly.

Provide UT_core_allocator_init() with
a fixed buffer size for predictable results.

Change-Id: I26a7b3101f7782063547940bded52d8202638394
2015-01-03 18:17:11 +01:00
Thomas Jarosch
e7d94323bc Enable printing of buflib allocations
Change-Id: Ie446177931032d585f69e0651f05ff88ebc6e8ba
2015-01-03 18:17:11 +01:00
Thomas Jarosch
e138016256 Initial import of simple buflib unit test
Taken from kugel's out-of-tree version:
https://github.com/kugel-/buflib

Needs some API adaptions. More test will follow.

Note: The expected output needs an update since
the in-tree version of buflib does buffer alignment
and also progressed a bit. Still the tests are a very good start.

Added Rockbox copyright header during import were needed.

Change-Id: Ib39ec4301285f1dd53059b7bed0c0d6646297dc5
2015-01-03 18:15:07 +01:00
Thomas Jarosch
eb9c845db5 Fix up some DEBUGF statements
The last big filesystem code refactoring
broke a lot of debug statements.

firmware/test/fat/ doesn't build anymore,
but that's more or less unrelated.

Change-Id: I4c9e1289eeabe1b59d436b176f1d35a02176614f
2015-01-03 16:01:39 +01:00
Thomas Jarosch
98280bb203 Multiple variables for 'my' need to be in parenthesis
perl -wc reported:

Parentheses missing around "my" list at sims.pl line 9.
Useless use of a variable in void context at sims.pl line 9.
Useless use of a variable in void context at sims.pl line 9.
Useless use of a variable in void context at sims.pl line 9.
Useless use of a variable in void context at sims.pl line 9.
Name "main::doonly" used only once: possible typo at sims.pl line 9.

-> now it's happy.

Change-Id: I3b3685d6918ddb77e47c58bade931897075c6e04
2015-01-03 15:25:09 +01:00
Thomas Jarosch
dd75bb756d Don't build sims twice
Some of those builds are already in the 'builds' list.

Change-Id: I6985702d50ff00e166463384d78f823f6fad9873
2015-01-03 15:20:27 +01:00
Thomas Jarosch
5f603d36a1 Fix syntax error (missing semicolon)
Reported by TheSeven on IRC.

Change-Id: Ie4bb331f9db050a90d99732e46c23f6402c7c320
2015-01-03 15:02:23 +01:00
Thomas Jarosch
bce72e6f2c buflib: Switch from term "cookie" to "metadata"
The documentation of buflib first mentions metadata
and then changes to "cookie" without explaining it.

Fix it by sticking to metadata.

Change-Id: I0b36b18f4f2590132901c10326481975f8b9b9da
2015-01-02 19:26:03 +01:00
Thomas Jarosch
66df5f3891 Improve core_alloc() / buflib_alloc() documentation
Document the fact that buffers are movable by default.
Care must be taken to not pass them to functions that yield().

Also clarify other things:
- Passing NULL as "ops" to buflib_alloc_ex() causes
  buffers to be movable by default (but not shrinkable).

- If you want shrinkable buffers during compaction,
  you have to provide a shrink callback.

- To disable buffer movement, you have to pass NULL
  for the move_callback inside the callback structure.

- The concept of default callbacks was removed
  long ago, remove the only reference of it.

Change-Id: I3bf0ea6b08b507d80a19f3c2c835aca32b3f7800
2015-01-02 18:51:15 +01:00
Thomas Jarosch
7265375087 Shortcuts: Add move callback for buflib allocations
If we don't provide a callback to buflib_alloc(),
the buffer is always movable (to reduce fragmentation).

We were passing around buffers to multiple functions
that call yield() and might trigger buflib compaction.

-> add locking while we are working on the buffers.

Also added source code comments that explain
why we added the locking in that particular section.

Change-Id: Ie32867b0b735ddb2905fd4bd51342f61035f836f
2015-01-02 01:11:54 +01:00
Thomas Jarosch
9076b433d1 PictureFlow: Add move callback for buflib allocations
If we don't provide a callback to buflib_alloc(),
the buffer is always movable (to reduce fragmentation).

Since we pass our buffer to functions that call yield(),
this could lead to memory corruption on buflib compaction.

Change-Id: Id1fad1822479d692551c55cb8bc87cea7b78f759
2015-01-01 23:49:41 +01:00
Franklin Wei
b0277e4b6d XWorld: fix some typos in keymaps.h
Happy New Year!

Change-Id: I228e4b9af9561eb70f75ebb57e333c78065873df
Reviewed-on: http://gerrit.rockbox.org/1093
Reviewed-by: Thomas Jarosch <tomj@simonv.com>
Tested: Thomas Jarosch <tomj@simonv.com>
2015-01-01 17:28:22 +01:00
Thomas Jarosch
812406f430 Limit "struct dircache_runinfo" to file scope
Change-Id: Ib3edef9a4568605a36bdacde174dfa6bca2d26fa
2015-01-01 13:51:08 +01:00
Thomas Jarosch
09f7bb82ca Add missing newline in debug output
Change-Id: Ifd67dbcc80db328391464ec93316c48f914bc590
2014-12-30 00:17:38 +01:00
Thomas Jarosch
da5a36d6d2 Document 'union buflib_data'
Change-Id: Ia98fa8e7887338d6c0b7a5795a0ae5c7a13014ba
2014-12-29 23:49:12 +01:00
Franklin Wei
193c5df75d XWorld: cleanup
- Comment keymaps.h
 - Tie XWORLD_DEBUG into ROCKBOX_HAS_LOGF to ease debugging
 - Fix up the manual a little bit

Change-Id: I12cfb58001199036cd67dbaa27f164e6790a199d
Reviewed-on: http://gerrit.rockbox.org/1084
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2014-12-28 02:48:42 +01:00
Thomas Jarosch
e7c282fed7 More standard conforming codec_realloc()
- Leave original ptr untouched if allocation fails
  (bail out early)
- Behave like malloc() in case ptr is NULL

Change-Id: Ib854ca19bd0e069999b7780d2d9a533ece705add
2014-12-27 17:33:24 +01:00
Thomas Jarosch
d68262eede Two more typo fixes
Change-Id: Id3ec7c1da356cb7c617a1d9ad57c9e0ae9fa6611
2014-12-27 02:00:15 +01:00
Thomas Jarosch
91f1393f75 Fix typos in documentation
Change-Id: I3c7e204bcf67bf0004314fe4b2aec98cae145273
2014-12-27 01:38:11 +01:00
Benjamin Brown
ce94c3ed86 Fix for DX50 xworld keymaps.h
Change-Id: I6bf564cf009d935ebb1d7fb77ccb2eab8c87d2c7
Reviewed-on: http://gerrit.rockbox.org/1083
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-24 12:00:00 +01:00
Benjamin Brown
339bea4b6e Fixes more red for xworlds keymaps
A temporary fix for keymaps.h, the logic needs rewritten

Change-Id: Ic8c81a5f01620ffc409cf6220b2916c0ec428dbe
Reviewed-on: http://gerrit.rockbox.org/1082
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-24 11:45:20 +01:00
Benjamin Brown
7de7c22a68 Xworld - Fixes warnings for cowond2, hifimanhm60x, ibassodx50, and
ondavx747.  Also fixes errors for ondavx777.

Change-Id: I1a5daa844759316df4dec7b869425ea9a174814b
Reviewed-on: http://gerrit.rockbox.org/1081
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2014-12-24 09:27:11 +01:00
Benjamin Brown
78cd5c1e24 Fixes xworld keymaps for ondavx747, hifimanhm60x, and cowond2
Change-Id: I62d7702d2e6541777f5553e27e166470004cd06d
Reviewed-on: http://gerrit.rockbox.org/1080
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2014-12-24 03:15:27 +01:00
Franklin Wei
37817268ab fix xworld building with 24-bit lcd
also fix a couple unused vars

Change-Id: Ib05d2e22dd7477bc9bd193232bd3de8a0816beb2
Reviewed-on: http://gerrit.rockbox.org/1079
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2014-12-24 03:12:03 +01:00
Michael Giacomelli
1bc3964f96 Fix compilation error.
Change-Id: Ic565444bf1df955703dfe91adaf3094e8ab9b990
2014-12-24 00:05:31 +01:00
Franklin Wei
33cb13dee5 Xworld - Another World interpreter for Rockbox
Co-conspirators: Franklin Wei, Benjamin Brown

--------------------------------------------------------------------
This work is based on:
- Fabien Sanglard's "Fabother World" based on
- Piotr Padkowski's newRaw interpreter which was based on
- Gregory Montoir's reverse engineering of
- Eric Chahi's assembly code

--------------------------------------------------------------------
Progress:

* The plugin runs pretty nicely (with sound!) on most color targets
* Keymaps for color LCD targets are complete
* The manual entry is finished
* Grayscale/monochrome support is NOT PLANNED
  - the game looks horrible in grayscale! :p

--------------------------------------------------------------------
Notes:

* The original game strings were built-in to the executable, and
  were copyrighted and could not be used.
* This port ships with an alternate set of strings by default, but
  can load the "official" strings from a file at runtime.

--------------------------------------------------------------------
To be done (in descending order of importance):

* vertical stride compatibility                          <30% done>
* optimization                                           <10% done>

Change-Id: I3155b0d97c2ac470cb8a2040f40d4139ddcebfa5
Reviewed-on: http://gerrit.rockbox.org/1077
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2014-12-23 23:48:12 +01:00
Thomas Jarosch
b681e932a9 mikmod plugin: Remove bogus doubled return statement
Stick to the safer version of those two.

Tested mikmod still works with some nice Necros .s3m files.

Change-Id: I6774cdf3345a4c89b2f9cf3bb8d832963ca30c38
2014-12-22 22:33:28 +01:00
Thomas Jarosch
71c0516d52 zxbox: Add missing break; statement
No harm done, same values are assigned
in the "default" case.

cppcheck reported:
[rockbox/apps/plugins/zxbox/tapefile.c:674] -> [rockbox/apps/plugins/zxbox/tapefile.c:681]: (warning) Buffer 'seg_desc' is being written before its old content has been used. 'break;' missing?

Change-Id: I2bf044db9022c848c304f1ad88c012bd85ee61df
2014-12-22 21:50:47 +01:00
Thomas Jarosch
5d3aa1bce1 Fix red (pass pointer of 'item')
Change-Id: I2d04251519623b2531948615c35e61203f9a9940
2014-12-22 21:30:30 +01:00
Thomas Jarosch
06eeab0242 Always initialize "item"
Otherwise item.cfg_name and item.default_val
will contain garbage. It doesn't seem to have
an effect right now, but who knows what
a future refactoring might do.

cppcheck reported:
[rockbox/apps/settings.c:1268]: (error) Uninitialized variable: item

Change-Id: Ic4d0c302929613de8f291cd2d69cd39db8711107
2014-12-22 21:12:11 +01:00
Thomas Jarosch
9a5f7ce0f2 wavrecord plugin: Add harmless sanity check
cppcheck reported:
[rockbox/apps/plugins/wavrecord.c:3672]: (error) Array 'sampr[9][2]' index sampr[9][1] out of bounds.

Change-Id: Ib1e9c25842aa275b15d8d817018cc523269b1f42
2014-12-21 17:22:09 +01:00
Thomas Jarosch
29ffa832fe Remove useless assignment of 'len'
The variable 'len' is not used after this statement.
Probably a copy'n'paste leftover from the similar
looking block above.

cppcheck reported:
[rockbox/utils/zenutils/source/shared/cenc.cpp:212]: (style) Same expression on both sides of '-'.

Change-Id: Ia8357187ed39d3fab10d97df75a1146c4f733790
2014-12-20 15:52:35 +01:00
Amaury Pouly
515a07e51d sb1: fix buggy comparison
cppcheck reported:
[rockbox/utils/imxtools/sbtools/sb1.c:440]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.

Thanks to Thomas Jarosch

Change-Id: I0078232706d4014a1f2acea310a7a0d0edf7788b
2014-12-20 15:31:18 +01:00
Thomas Jarosch
61e322c840 mkzenboot: Fix double close of bootfd on error
cppcheck reported:
[rockbox/tools/mkzenboot.c:1176]: (error) Used file that is not opened.

Change-Id: Ibbf7ab2910c7f43b547fef25c62e0b4d19ff9551
2014-12-20 15:18:46 +01:00
Thomas Jarosch
1eb1bc24f2 DX 50: Fix file descriptor leak on error
Unimportant change, still good style.

cppcheck reported:
[rockbox/firmware/target/hosted/android/dx50/button-dx50.c:92]: (error) Resource leak: fd
[rockbox/firmware/target/hosted/android/dx50/button-dx50.c:98]: (error) Resource leak: fd

Change-Id: Ic1831382219c44e7bef71cb2391646c9910d2369
2014-12-20 14:59:19 +01:00
Thomas Jarosch
575ec8902e mini2440: Fix bogus buffer access in LCD backlight driver
The backlight driver always writes a bogus value
from memory into the LCD brightness register.

Fix it up by adding bounds checks and
use a more sane default value.

While looking at the code, I noticed
that BACKLIGHT_CONTROL_SET probably ignores
the desired brightness level, too.

Note: Please test on real hardware, I don't own it.

cppcheck reported:
[rockbox/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c:53]: (error) Array 'log_brightness[13]' accessed at index 255, which is out of bounds.

Change-Id: Iaafa929a8adaa97b93ebcb66e1f6bd3bf0dad84e
2014-12-20 14:47:09 +01:00
Thomas Jarosch
d62e1b3c5f vibe 500: Fix ide_powered() always returning false
While the right GPIO location is accessed,
the result of the logical AND was tested wrong.

I don't have this hardware, but I can imagine
that bug caused ide_power_enable() to be called
more times than it needed to be.

cppcheck reported:
[rockbox/firmware/target/arm/pbell/vibe500/power-vibe500.c:101]: (style) Expression '(X & 0x8) == 0x1' is always false.

Change-Id: I98498f79d383c6f29869e170bfc94ba9a0d2ba7e
2014-12-20 14:03:23 +01:00
Thomas Jarosch
ef1497c3df Add missing va_end() call when the log is full
No need to go out of memory, too ;)

cppcheck reported:
[rockbox/firmware/logf.c:338]: (error) va_list 'ap' was opened but not closed by va_end().

Change-Id: I00e4c04d7e3d5d1415aa5066487ce1d9209e53aa
2014-12-20 13:48:43 +01:00
Thomas Jarosch
c54537a663 Prevent theoretical out-of-bounds access in STM_Load()
We should be safe since STM_Load() should
never be called if STM_Test() fails.
Still it's better safe than sorry.

cppcheck reported:
[rockbox/apps/plugins/mikmod/load_stm.c:302]: (error) Array 'STM_Version[3]' accessed at index 3, which is out of bounds.

Change-Id: I914935fd108c492d013de24d17dcb9c227af6cd8
2014-12-20 13:37:40 +01:00
Thomas Jarosch
f8d9e9cb6c m3u playlist parser: Check size limit before using buffer
This should only be a problem if the last line
is not terminated by \r or \n though.

cppcheck reported:
[rockbox/apps/playlist.c:234]: (style) Array index 'i' is used before limits check.

Change-Id: I8182b66272ba9c024984c81588bd2a6dbb8255b8
2014-12-20 13:14:19 +01:00
Thomas Jarosch
2caf8870af text_viewer plugin: Fix two out-of-bounds buffer accesses
Test code:
--------------
int main(void)
{
    static unsigned short extra_spaces[] = { 0, 0x3000 };
    return sizeof(extra_spaces);
}
--------------

-> returns four instead of two.

cppcheck reported:
[rockbox/apps/plugins/text_viewer/tv_text_processor.c:180]: (error) Array 'break_chars[27]' acces
sed at index 53, which is out of bounds.
[rockbox/apps/plugins/text_viewer/tv_text_processor.c:195]: (error) Array 'extra_spaces[2]' acces
sed at index 3, which is out of bounds.

Change-Id: I66c305cc5c99e59e7c8e0aa9c86cecbe293ff037
2014-12-20 12:55:20 +01:00