Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: pamaury on August 10, 2009, 11:15:46 AM

Title: [SOLVED] logfdump buggy ?
Post by: pamaury on August 10, 2009, 11:15:46 AM
Hello,
I think the logfdump function is buggy. More precisely, it fails to correctly display multiline.
When printing a long line on my Sansa e200, it stops after the first MAX_LOGF_ENTRY characters instead of correctly displaying the whole line.

I suspect the bug is due to those lines:
Code: [Select]
memcpy(ptr, logfbuffer[tindex], MAX_LOGF_ENTRY);
ptr += MAX_LOGF_ENTRY;

Indeed, by copying MAX_LOGF_ENTRY characters, it also copy the 0 at the end of each line (added by strlcpy if _logf) so the output stops at the end of first part of the whole line.

I think is must be changed to:
Code: [Select]
memcpy(ptr, logfbuffer[tindex], MAX_LOGF_ENTRY-1);
ptr += MAX_LOGF_ENTRY-1;
Then the output of logfdump is correct.

Am I correct ?
Title: Re: logfdump buggy ?
Post by: funman on August 14, 2009, 06:53:52 PM
In case someone wants to know, yes it was correct, and pamaury : thanks for the patches you wrote and which were committed!