Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
adb506df14
commit
50a6ca39ad
|
@ -25,7 +25,6 @@
|
|||
#include "lcd.h"
|
||||
#include "action.h"
|
||||
#include "kernel.h"
|
||||
#include "sprintf.h"
|
||||
#include <string.h>
|
||||
#include "settings.h"
|
||||
#include "power.h"
|
||||
|
|
|
@ -15,9 +15,10 @@ SRC += $(call preprocess, $(APPSDIR)/SOURCES)
|
|||
# to genlang and thus (translated) phrases can be used based on those names.
|
||||
# button.h is included for the HAS_BUTTON_HOLD define.
|
||||
#
|
||||
# Kludge: depends on ctype.o only to depend on config-*.h ...
|
||||
# Kludge: depends on config.o which only depends on config-*.h to have config.h
|
||||
# changes trigger a genlang re-run
|
||||
#
|
||||
features $(BUILDDIR)/apps/features $(BUILDDIR)/apps/genlang-features: $(APPSDIR)/features.txt $(BUILDDIR)/firmware/common/ctype.o
|
||||
features $(BUILDDIR)/apps/features $(BUILDDIR)/apps/genlang-features: $(APPSDIR)/features.txt $(BUILDDIR)/firmware/common/config.o
|
||||
$(SILENT)mkdir -p $(BUILDDIR)/apps
|
||||
$(SILENT)mkdir -p $(BUILDDIR)/lang
|
||||
$(call PRINTS,PP $(<F))
|
||||
|
|
|
@ -342,7 +342,7 @@ static char* create_bookmark()
|
|||
/* new optional bookmark token descriptors should be inserted
|
||||
just before the "%s;%s" in this line... */
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
">%d;%d;%ld;%d;%ld;%d;%d;%d;%d;%s;%s",
|
||||
">%d;%d;%ld;%d;%ld;%d;%d;%ld;%ld;%s;%s",
|
||||
#else
|
||||
">%d;%d;%ld;%d;%ld;%d;%d;%s;%s",
|
||||
#endif
|
||||
|
@ -360,8 +360,8 @@ static char* create_bookmark()
|
|||
global_settings.playlist_shuffle,
|
||||
/* ...and their values should go here */
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
sound_get_pitch(),
|
||||
dsp_get_timestretch(),
|
||||
(long)sound_get_pitch(),
|
||||
(long)dsp_get_timestretch(),
|
||||
#endif
|
||||
/* more mandatory tokens */
|
||||
playlist_get_name(NULL, global_temp_buffer,
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "kernel.h"
|
||||
#include "tree.h"
|
||||
#include "debug.h"
|
||||
#include "sprintf.h"
|
||||
#include "settings.h"
|
||||
#include "codecs.h"
|
||||
#include "audio.h"
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <timefuncs.h>
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include "string-extra.h"
|
||||
#include "debug.h"
|
||||
#include "button.h"
|
||||
#include "dir.h"
|
||||
#include "file.h"
|
||||
#include "kernel.h"
|
||||
#include "sprintf.h"
|
||||
#include "screens.h"
|
||||
#include "misc.h"
|
||||
#include "mas.h"
|
||||
|
|
|
@ -31,8 +31,10 @@
|
|||
#define MEM 2
|
||||
#endif
|
||||
|
||||
#include <_ansi.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include "strlcpy.h"
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "metadata.h"
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <limits.h>
|
||||
#include "codeclib.h"
|
||||
#include "inttypes.h"
|
||||
#include "math.h"
|
||||
|
|
|
@ -46,7 +46,6 @@ avoided by writing the decoded data one sample at a time.
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
|
|||
#ifndef ROCKBOX
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "inttypes.h"
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include "inttypes.h"
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -22,9 +22,10 @@
|
|||
#ifndef __CODECLIB_H__
|
||||
#define __CODECLIB_H__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "codecs.h"
|
||||
#include <sys/types.h>
|
||||
#include "mdct.h"
|
||||
#include "fft.h"
|
||||
|
||||
|
@ -44,6 +45,7 @@ extern unsigned char* filebuf; /* The rest of the MP3 buffer
|
|||
#define calloc(x,y) codec_calloc(x,y)
|
||||
#define realloc(x,y) codec_realloc(x,y)
|
||||
#define free(x) codec_free(x)
|
||||
#undef alloca
|
||||
#define alloca(x) __builtin_alloca(x)
|
||||
|
||||
void* codec_malloc(size_t size);
|
||||
|
@ -59,7 +61,11 @@ void *memmove(void *s1, const void *s2, size_t n);
|
|||
size_t strlen(const char *s);
|
||||
char *strcpy(char *dest, const char *src);
|
||||
char *strcat(char *dest, const char *src);
|
||||
int strcmp(const char *, const char *);
|
||||
|
||||
/* on some platforms strcmp() seems to be a tricky define which
|
||||
* breaks if we write down strcmp's prototype */
|
||||
#undef strcmp
|
||||
int strcmp(const char *s1, const char *s2);
|
||||
|
||||
void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@
|
|||
#endif
|
||||
|
||||
#if defined(ROCKBOX) && defined(SIMULATOR) || !defined(ROCKBOX)
|
||||
int printf(char*, ...);
|
||||
int printf(const char* fmt, ...);
|
||||
#define PRINT_MSG(fmt, args...) printf(fmt, ## args)
|
||||
#define ERROR_MSG(fmt, args...) printf(fmt, ## args)
|
||||
#else
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#ifndef _TLSF_H_
|
||||
#define _TLSF_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h> /* defines size_t */
|
||||
|
||||
extern size_t init_memory_pool(size_t, void *);
|
||||
extern size_t get_used_size(void *);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
|
|
@ -185,7 +185,7 @@ typedef float float32_t;
|
|||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
# include "inttypes.h"
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
# include <sys/stat.h>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# (one for codec, one for mpegplayer)
|
||||
# so a little trickery is necessary
|
||||
|
||||
MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad
|
||||
MADFLAGS = $(CODECFLAGS) -UDEBUG -DNDEBUG -O2 -I$(APPSDIR)/codecs/libmad -DHAVE_LIMITS_H
|
||||
MPEGMADFLAGS = $(MADFLAGS) -DMPEGPLAYER
|
||||
|
||||
# libmad
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#ifndef CODEC_LIBPCM_ADPCM_SEEK_H
|
||||
#define CODEC_LIBPCM_ADPCM_SEEK_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
struct adpcm_data {
|
||||
int16_t pcmdata[2];
|
||||
|
|
|
@ -63,7 +63,7 @@ static const int index_tables[4][16] ICONST_ATTR = {
|
|||
};
|
||||
|
||||
static int32_t pcmdata[2];
|
||||
static int8_t index[2];
|
||||
static int8_t indices[2];
|
||||
|
||||
static int adpcm_data_size;
|
||||
static uint8_t step_mask;
|
||||
|
@ -107,7 +107,7 @@ void set_decode_parameters(int channels, int32_t *init_pcmdata, int8_t *init_ind
|
|||
for (ch = 0; ch < channels; ch++)
|
||||
{
|
||||
pcmdata[ch] = init_pcmdata[ch];
|
||||
index[ch] = init_index[ch];
|
||||
indices[ch] = init_index[ch];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
|
|||
{
|
||||
int check_bit = 1 << step_shift;
|
||||
int32_t delta = 0;
|
||||
int16_t step = step_table[index[ch]];
|
||||
int16_t step = step_table[indices[ch]];
|
||||
|
||||
do {
|
||||
if (nibble & check_bit)
|
||||
|
@ -136,8 +136,8 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
|
|||
else
|
||||
pcmdata[ch] += delta;
|
||||
|
||||
index[ch] += use_index_table[nibble & step_mask];
|
||||
CLIP(index[ch], 0, 88);
|
||||
indices[ch] += use_index_table[nibble & step_mask];
|
||||
CLIP(indices[ch], 0, 88);
|
||||
|
||||
CLIP(pcmdata[ch], -32768, 32767);
|
||||
|
||||
|
@ -150,7 +150,7 @@ int16_t create_pcmdata(int ch, uint8_t nibble)
|
|||
int16_t create_pcmdata_size4(int ch, uint8_t nibble)
|
||||
{
|
||||
int32_t delta;
|
||||
int16_t step = step_table[index[ch]];
|
||||
int16_t step = step_table[indices[ch]];
|
||||
|
||||
delta = (step >> 3);
|
||||
if (nibble & 4) delta += step;
|
||||
|
@ -162,8 +162,8 @@ int16_t create_pcmdata_size4(int ch, uint8_t nibble)
|
|||
else
|
||||
pcmdata[ch] += delta;
|
||||
|
||||
index[ch] += use_index_table[nibble & 0x07];
|
||||
CLIP(index[ch], 0, 88);
|
||||
indices[ch] += use_index_table[nibble & 0x07];
|
||||
CLIP(indices[ch], 0, 88);
|
||||
|
||||
CLIP(pcmdata[ch], -32768, 32767);
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#ifndef CODEC_LIBPCM_IMA_ADPCM_COMMON_H
|
||||
#define CODEC_LIBPCM_IMA_ADPCM_COMMON_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
#ifndef CODEC_LIBPCM_PCM_COMMON_H
|
||||
#define CODEC_LIBPCM_PCM_COMMON_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
|
||||
/* decoded pcm sample depth (sample 28bit + sign 1bit) */
|
||||
#define PCM_OUTPUT_DEPTH 29
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#ifdef TEST
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include "inttypes.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
int filesize(int fd)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define _ARM_ASSEM_
|
||||
#endif
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#ifdef ROCKBOX_BIG_ENDIAN
|
||||
#define BIG_ENDIAN 1
|
||||
#define LITTLE_ENDIAN 0
|
||||
|
@ -16,6 +17,7 @@
|
|||
#define LITTLE_ENDIAN 1
|
||||
#define BIG_ENDIAN 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ICODE_ATTR_TREMOR_MDCT
|
||||
#define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
#include "common/ctype.c"
|
||||
#ifndef SIMULATOR
|
||||
#include "libc/ctype.c"
|
||||
#endif
|
||||
|
|
|
@ -141,7 +141,7 @@ void init_words (WavpackStream *wps)
|
|||
CLEAR (wps->w);
|
||||
}
|
||||
|
||||
static int mylog2 (unsigned int32_t avalue);
|
||||
static int mylog2 (uint32_t avalue);
|
||||
|
||||
// Read the median log2 values from the specifed metadata structure, convert
|
||||
// them back to 32-bit unsigned values and store them. If length is not
|
||||
|
@ -553,7 +553,7 @@ void send_words (int32_t *buffer, int nsamples, uint32_t flags,
|
|||
if (sign)
|
||||
value = ~value;
|
||||
|
||||
if ((unsigned int32_t) value < GET_MED (0)) {
|
||||
if ((uint32_t) value < GET_MED (0)) {
|
||||
ones_count = low = 0;
|
||||
high = GET_MED (0) - 1;
|
||||
DEC_MED0 ();
|
||||
|
@ -709,7 +709,7 @@ void flush_word (struct words_data *w, Bitstream *bs)
|
|||
// This function returns the log2 for the specified 32-bit unsigned value.
|
||||
// The maximum value allowed is about 0xff800000 and returns 8447.
|
||||
|
||||
static int mylog2 (unsigned int32_t avalue)
|
||||
static int mylog2 (uint32_t avalue)
|
||||
{
|
||||
int dbits;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "audio.h"
|
||||
#include "kernel.h"
|
||||
#include "logf.h"
|
||||
#include "sprintf.h"
|
||||
#include "misc.h"
|
||||
#include "screens.h"
|
||||
#include "list.h"
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "menu.h"
|
||||
#include "debug_menu.h"
|
||||
#include "kernel.h"
|
||||
#include "sprintf.h"
|
||||
#include "structec.h"
|
||||
#include "action.h"
|
||||
#include "debug.h"
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <sprintf.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "screens.h"
|
||||
#include "plugin.h"
|
||||
#include "rolo.h"
|
||||
#include "sprintf.h"
|
||||
#include "splash.h"
|
||||
#include "cuesheet.h"
|
||||
#include "filetree.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "string.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#include "sprintf.h"
|
||||
#include "settings.h"
|
||||
#include "debug.h"
|
||||
#include "lang.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "button.h"
|
||||
#include "sprintf.h"
|
||||
#include "string.h"
|
||||
#include "settings.h"
|
||||
#include "kernel.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "button.h"
|
||||
#include "sprintf.h"
|
||||
#include "string.h"
|
||||
#include "settings.h"
|
||||
#include "kernel.h"
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "config.h"
|
||||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "button.h"
|
||||
#include "sprintf.h"
|
||||
#include "string.h"
|
||||
#include "settings.h"
|
||||
#include "kernel.h"
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include "config.h"
|
||||
#include "option_select.h"
|
||||
#include "sprintf.h"
|
||||
#include "kernel.h"
|
||||
#include "lang.h"
|
||||
#include "talk.h"
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h> /* for ABS() */
|
||||
#include <stdlib.h> /* for abs() */
|
||||
#include "config.h"
|
||||
#include "sprintf.h"
|
||||
#include "action.h"
|
||||
#include "dsp.h"
|
||||
#include "sound.h"
|
||||
|
@ -248,10 +247,10 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
|
|||
/* Pitch:XXX.X% */
|
||||
if(global_settings.pitch_mode_semitone)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s: %s%ld.%02ld", str(LANG_PITCH),
|
||||
snprintf(buf, sizeof(buf), "%s: %s%d.%02d", str(LANG_PITCH),
|
||||
semitone >= 0 ? "+" : "-",
|
||||
ABS(semitone / PITCH_SPEED_PRECISION),
|
||||
ABS((semitone % PITCH_SPEED_PRECISION) /
|
||||
abs(semitone / PITCH_SPEED_PRECISION),
|
||||
abs((semitone % PITCH_SPEED_PRECISION) /
|
||||
(PITCH_SPEED_PRECISION / 100))
|
||||
);
|
||||
}
|
||||
|
@ -290,10 +289,10 @@ static void pitchscreen_draw(struct screen *display, int max_lines,
|
|||
{
|
||||
if(global_settings.pitch_mode_semitone)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s%ld.%02ld",
|
||||
snprintf(buf, sizeof(buf), "%s%d.%02d",
|
||||
semitone >= 0 ? "+" : "-",
|
||||
ABS(semitone / PITCH_SPEED_PRECISION),
|
||||
ABS((semitone % PITCH_SPEED_PRECISION) /
|
||||
abs(semitone / PITCH_SPEED_PRECISION),
|
||||
abs((semitone % PITCH_SPEED_PRECISION) /
|
||||
(PITCH_SPEED_PRECISION / 100))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "string-extra.h"
|
||||
#include "settings.h"
|
||||
#include "skin_buffer.h"
|
||||
#include "wps_internals.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
****************************************************************************/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include "misc.h"
|
||||
#include "font.h"
|
||||
#include "system.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
****************************************************************************/
|
||||
#include "font.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include <stdlib.h>
|
||||
#include "action.h"
|
||||
#include "system.h"
|
||||
|
@ -247,7 +247,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
{
|
||||
*intval = limit * elapsed / length + 1;
|
||||
}
|
||||
snprintf(buf, buf_size, "%d", 100 * elapsed / length);
|
||||
snprintf(buf, buf_size, "%lu", 100 * elapsed / length);
|
||||
return buf;
|
||||
|
||||
|
||||
|
@ -269,7 +269,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
if ((id3->frequency % 1000) < 100)
|
||||
snprintf(buf, buf_size, "%ld", id3->frequency / 1000);
|
||||
else
|
||||
snprintf(buf, buf_size, "%ld.%d",
|
||||
snprintf(buf, buf_size, "%ld.%lu",
|
||||
id3->frequency / 1000,
|
||||
(id3->frequency % 1000) / 100);
|
||||
return buf;
|
||||
|
@ -302,12 +302,12 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
|
|||
case WPS_TOKEN_DATABASE_RATING:
|
||||
if (intval)
|
||||
*intval = id3->rating + 1;
|
||||
snprintf(buf, buf_size, "%ld", id3->rating);
|
||||
snprintf(buf, buf_size, "%d", id3->rating);
|
||||
return buf;
|
||||
case WPS_TOKEN_DATABASE_AUTOSCORE:
|
||||
if (intval)
|
||||
*intval = id3->score + 1;
|
||||
snprintf(buf, buf_size, "%ld", id3->score);
|
||||
snprintf(buf, buf_size, "%d", id3->score);
|
||||
return buf;
|
||||
#endif
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
break;)
|
||||
}
|
||||
}
|
||||
snprintf(buf, buf_size, "%d.%1d", samprk/1000,samprk%1000);
|
||||
snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000);
|
||||
#else /* HWCODEC */
|
||||
|
||||
static const char * const freq_strings[] =
|
||||
|
@ -1164,7 +1164,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
|||
#endif
|
||||
*intval = global_settings.mp3_enc_config.bitrate+1;
|
||||
}
|
||||
snprintf(buf, buf_size, "%d", global_settings.mp3_enc_config.bitrate+1);
|
||||
snprintf(buf, buf_size, "%lu", global_settings.mp3_enc_config.bitrate+1);
|
||||
return buf;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "font.h"
|
||||
#include "kernel.h"
|
||||
#include "string.h" /* for memcmp oO*/
|
||||
#include "sprintf.h"
|
||||
#include "sound.h"
|
||||
#include "settings.h"
|
||||
#include "viewport.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "usb_core.h"
|
||||
#ifdef USB_ENABLE_HID
|
||||
#include "usb_keymaps.h"
|
||||
#include "sprintf.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "settings.h"
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
/* all below isn't needed for pc tools (i.e. checkwps/wps editor)
|
||||
* only viewport_parse_viewport() is */
|
||||
#ifndef __PCTOOL__
|
||||
#include "sprintf.h"
|
||||
#include "string.h"
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "action.h"
|
||||
#include "kernel.h"
|
||||
#include "filetypes.h"
|
||||
#include "sprintf.h"
|
||||
#include "settings.h"
|
||||
#include "skin_engine/skin_engine.h"
|
||||
#include "mp3_playback.h"
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "status.h"
|
||||
#include "debug_menu.h"
|
||||
#include "version.h"
|
||||
#include "sprintf.h"
|
||||
#include "font.h"
|
||||
#include "language.h"
|
||||
#include "wps.h"
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "icons.h"
|
||||
#include "font.h"
|
||||
#include "lang.h"
|
||||
#include "sprintf.h"
|
||||
#include "talk.h"
|
||||
#include "misc.h"
|
||||
#include "sound.h"
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "scrollbar.h"
|
||||
#endif
|
||||
#include "lang.h"
|
||||
#include "sprintf.h"
|
||||
#include "talk.h"
|
||||
#include "misc.h"
|
||||
#include "sound.h"
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "usb.h"
|
||||
#include "splash.h"
|
||||
#include "talk.h"
|
||||
#include "sprintf.h"
|
||||
#include "powermgmt.h"
|
||||
#if CONFIG_CODEC == SWCODEC
|
||||
#include "playback.h"
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "string.h"
|
||||
#include "sprintf.h"
|
||||
#include "lang.h"
|
||||
#include "action.h"
|
||||
#include "settings.h"
|
||||
|
@ -201,7 +201,7 @@ static void draw_timedate(struct viewport *vp, struct screen *display)
|
|||
}
|
||||
|
||||
|
||||
static struct viewport clock[NB_SCREENS], menu[NB_SCREENS];
|
||||
static struct viewport clock_vps[NB_SCREENS], menu[NB_SCREENS];
|
||||
static bool menu_was_pressed;
|
||||
static int time_menu_callback(int action,
|
||||
const struct menu_item_ex *this_item)
|
||||
|
@ -233,7 +233,7 @@ static int time_menu_callback(int action,
|
|||
{
|
||||
last_redraw = current_tick;
|
||||
FOR_NB_SCREENS(i)
|
||||
draw_timedate(&clock[i], &screens[i]);
|
||||
draw_timedate(&clock_vps[i], &screens[i]);
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
@ -257,30 +257,30 @@ int time_screen(void* ignored)
|
|||
|
||||
FOR_NB_SCREENS(i)
|
||||
{
|
||||
viewport_set_defaults(&clock[i], i);
|
||||
viewport_set_defaults(&clock_vps[i], i);
|
||||
#ifdef HAVE_BUTTONBAR
|
||||
if (global_settings.buttonbar)
|
||||
{
|
||||
clock[i].height -= BUTTONBAR_HEIGHT;
|
||||
clock_vps[i].height -= BUTTONBAR_HEIGHT;
|
||||
}
|
||||
#endif
|
||||
nb_lines = viewport_get_nb_lines(&clock[i]);
|
||||
nb_lines = viewport_get_nb_lines(&clock_vps[i]);
|
||||
|
||||
menu[i] = clock[i];
|
||||
menu[i] = clock_vps[i];
|
||||
/* force time to be drawn centered */
|
||||
clock[i].flags |= VP_FLAG_ALIGN_CENTER;
|
||||
clock_vps[i].flags |= VP_FLAG_ALIGN_CENTER;
|
||||
|
||||
font_h = font_get(clock[i].font)->height;
|
||||
font_h = font_get(clock_vps[i].font)->height;
|
||||
nb_lines -= 2; /* at least 2 lines for menu */
|
||||
if (nb_lines > 4)
|
||||
nb_lines = 4;
|
||||
if (nb_lines >= 2)
|
||||
clock[i].height = nb_lines*font_h;
|
||||
else /* disable the clock drawing */
|
||||
clock[i].height = 0;
|
||||
menu[i].y += clock[i].height;
|
||||
menu[i].height -= clock[i].height;
|
||||
draw_timedate(&clock[i], &screens[i]);
|
||||
clock_vps[i].height = nb_lines*font_h;
|
||||
else /* disable the clock_vps drawing */
|
||||
clock_vps[i].height = 0;
|
||||
menu[i].y += clock_vps[i].height;
|
||||
menu[i].height -= clock_vps[i].height;
|
||||
draw_timedate(&clock_vps[i], &screens[i]);
|
||||
}
|
||||
|
||||
ret = do_menu(&time_menu, NULL, menu, false);
|
||||
|
|
|
@ -19,10 +19,9 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include "string-extra.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "logf.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <inttypes.h>
|
||||
#include "metadata.h"
|
||||
|
||||
#ifdef ROCKBOX_BIG_ENDIAN
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <ctype.h>
|
||||
#include <ctype.h>
|
||||
#include "string-extra.h"
|
||||
#include "config.h"
|
||||
#include "file.h"
|
||||
#include "logf.h"
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "string-extra.h"
|
||||
#include "system.h"
|
||||
#include "metadata.h"
|
||||
#include "metadata_common.h"
|
||||
|
|
10
apps/misc.c
10
apps/misc.c
|
@ -20,17 +20,15 @@
|
|||
****************************************************************************/
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <errno.h>
|
||||
#include "string-extra.h"
|
||||
#include "config.h"
|
||||
#include "misc.h"
|
||||
#include "lcd.h"
|
||||
#include "file.h"
|
||||
#ifdef __PCTOOL__
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#else
|
||||
#include "sprintf.h"
|
||||
#ifndef __PCTOOL__
|
||||
#include "lang.h"
|
||||
#include "dir.h"
|
||||
#include "lcd-remote.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "debug.h"
|
||||
#include "sprintf.h"
|
||||
#include "lcd.h"
|
||||
#include "dir.h"
|
||||
#include "file.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include "version.h"
|
||||
#include "sprintf.h"
|
||||
#include <string.h>
|
||||
#include "settings.h"
|
||||
#include "statusbar.h"
|
||||
|
|
|
@ -68,15 +68,14 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include "string-extra.h"
|
||||
#include "playlist.h"
|
||||
#include "ata_idle_notify.h"
|
||||
#include "file.h"
|
||||
#include "action.h"
|
||||
#include "dir.h"
|
||||
#include "sprintf.h"
|
||||
#include "debug.h"
|
||||
#include "audio.h"
|
||||
#include "lcd.h"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include "action.h"
|
||||
#include "dir.h"
|
||||
#include "file.h"
|
||||
|
@ -36,7 +36,6 @@
|
|||
#include "playlist.h"
|
||||
#include "settings.h"
|
||||
#include "splash.h"
|
||||
#include "sprintf.h"
|
||||
#include "tree.h"
|
||||
#include "yesno.h"
|
||||
#include "filetypes.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
* multi-screen support, rewrote a lot of code
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <sprintf.h>
|
||||
#include "playlist.h"
|
||||
#include "audio.h"
|
||||
#include "screens.h"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "plugin.h"
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <sprintf.h>
|
||||
#include <stdlib.h>
|
||||
#include "debug.h"
|
||||
#include "i2c.h"
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
|
||||
char* strncpy(char *, const char *, size_t);
|
||||
void* plugin_get_buffer(size_t *buffer_size);
|
||||
|
@ -111,6 +113,11 @@ void* plugin_get_buffer(size_t *buffer_size);
|
|||
#include "usbstack/usb_hid_usage_tables.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* on some platforms strcmp() seems to be a tricky define which
|
||||
* breaks if we write down strcmp's prototype */
|
||||
#undef strcmp
|
||||
|
||||
#ifdef PLUGIN
|
||||
|
||||
#if defined(DEBUG) || defined(SIMULATOR)
|
||||
|
@ -529,7 +536,7 @@ struct plugin_api {
|
|||
/* strings and memory */
|
||||
int (*snprintf)(char *buf, size_t size, const char *fmt, ...)
|
||||
ATTRIBUTE_PRINTF(3, 4);
|
||||
int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap);
|
||||
int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap);
|
||||
char* (*strcpy)(char *dst, const char *src);
|
||||
size_t (*strlcpy)(char *dst, const char *src, size_t length);
|
||||
size_t (*strlen)(const char *str);
|
||||
|
|
|
@ -102,6 +102,9 @@ PLUGIN_HEADER
|
|||
#define X_5_POS (X_4_POS + REC_WIDTH) /* x5 = 110, column 111 left blank */
|
||||
|
||||
#define SIGN(x) ((x)<0?-1:1)
|
||||
#ifndef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
/* variable button definitions */
|
||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "d_think.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "sscanf.h"
|
||||
#include <stdio.h> /* sscanf */
|
||||
#include "rockmacros.h"
|
||||
|
||||
#define TRUE 1
|
||||
|
|
|
@ -13,7 +13,7 @@ DOOMBUILDDIR := $(BUILDDIR)/apps/plugins/doom
|
|||
ROCKS += $(DOOMBUILDDIR)/doom.rock
|
||||
|
||||
DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES)
|
||||
DOOM_SRC += $(ROOTDIR)/firmware/common/sscanf.c
|
||||
DOOM_SRC += $(ROOTDIR)/firmware/libc/sscanf.c
|
||||
DOOM_OBJ := $(call c2obj, $(DOOM_SRC))
|
||||
|
||||
# add source files to OTHER_SRC to get automatic dependencies
|
||||
|
|
|
@ -33,9 +33,13 @@ extern bool doomexit;
|
|||
int printf(const char *fmt, ...);
|
||||
int fileexists(const char * fname);
|
||||
char *my_strtok( char * s, const char * delim );
|
||||
#undef alloca
|
||||
#define alloca __builtin_alloca
|
||||
#define fdprintf(...) rb->fdprintf(__VA_ARGS__)
|
||||
#undef fdprintf
|
||||
#define fdprintf(...) rb->fdprintf(__VA_ARGS__)
|
||||
#undef vsnprintf
|
||||
#define vsnprintf(...) rb->vsnprintf(__VA_ARGS__)
|
||||
#undef read_line
|
||||
#define read_line(a,b,c) rb->read_line((a),(b),(c))
|
||||
|
||||
#ifdef SIMULATOR
|
||||
|
@ -52,19 +56,33 @@ int my_close(int id);
|
|||
#define filesize(a) rb->filesize((a))
|
||||
#define read(a,b,c) rb->read((a),(b),(c))
|
||||
#define write(a,b,c) rb->write((a),(b),(c))
|
||||
#undef strtok
|
||||
#define strtok(a,b) my_strtok((a),(b))
|
||||
#undef strcat
|
||||
#define strcat(a,b) rb->strcat((a),(b))
|
||||
#undef memset
|
||||
#define memset(a,b,c) rb->memset((a),(b),(c))
|
||||
#undef memmove
|
||||
#define memmove(a,b,c) rb->memmove((a),(b),(c))
|
||||
#undef memcmp
|
||||
#define memcmp(a,b,c) rb->memcmp((a),(b),(c))
|
||||
#undef memchr
|
||||
#define memchr(a,b,c) rb->memchr((a),(b),(c))
|
||||
#undef strcpy
|
||||
#define strcpy(a,b) rb->strcpy((a),(b))
|
||||
#undef strlen
|
||||
#define strlen(a) rb->strlen((a))
|
||||
#undef strcmp
|
||||
#define strcmp(a,b) rb->strcmp((a),(b))
|
||||
#undef strncmp
|
||||
#define strncmp(a,b,c) rb->strncmp((a),(b),(c))
|
||||
#undef strchr
|
||||
#define strchr(a,b) rb->strchr((a),(b))
|
||||
#undef strrchr
|
||||
#define strrchr(a,b) rb->strrchr((a),(b))
|
||||
#undef strcasecmp
|
||||
#define strcasecmp(a,b) rb->strcasecmp((a),(b))
|
||||
#undef strncasecmp
|
||||
#define strncasecmp(a,b,c) rb->strncasecmp((a),(b),(c))
|
||||
#define srand(a) rb->srand((a))
|
||||
#define rand() rb->rand()
|
||||
|
|
|
@ -285,14 +285,14 @@ void os_beep(int volume)
|
|||
static unsigned char unget_buf;
|
||||
static int unget_file;
|
||||
|
||||
int ungetc(int c, int f)
|
||||
int frotz_ungetc(int c, int f)
|
||||
{
|
||||
unget_file = f;
|
||||
unget_buf = c;
|
||||
return c;
|
||||
}
|
||||
|
||||
int fgetc(int f)
|
||||
int frotz_fgetc(int f)
|
||||
{
|
||||
unsigned char cb;
|
||||
if (unget_file == f)
|
||||
|
@ -305,7 +305,7 @@ int fgetc(int f)
|
|||
return cb;
|
||||
}
|
||||
|
||||
int fputc(int c, int f)
|
||||
int frotz_fputc(int c, int f)
|
||||
{
|
||||
unsigned char cb = c;
|
||||
if (rb->write(f, &cb, 1) != 1)
|
||||
|
|
|
@ -37,9 +37,12 @@
|
|||
/*
|
||||
* we need functions for character io
|
||||
*/
|
||||
extern int ungetc(int c, int f);
|
||||
extern int fgetc(int f);
|
||||
extern int fputc(int c, int f);
|
||||
extern int frotz_ungetc(int c, int f);
|
||||
#define ungetc frotz_ungetc
|
||||
extern int frotz_fgetc(int f);
|
||||
#define fgetc frotz_fgetc
|
||||
extern int frotz_fputc(int c, int f);
|
||||
#define fputc frotz_fputc
|
||||
|
||||
/*
|
||||
* this is used instead of os_read_key for more prompts and the like
|
||||
|
|
|
@ -1359,7 +1359,7 @@ int load_image(char *filename, struct image_info *info,
|
|||
|
||||
} else {
|
||||
if (!running_slideshow) {
|
||||
rb->snprintf(print, sizeof(print), "loading %lu bytes", image_size);
|
||||
rb->snprintf(print, sizeof(print), "loading %zu bytes", image_size);
|
||||
rb->lcd_puts(0, 1, print);
|
||||
rb->lcd_update();
|
||||
}
|
||||
|
|
|
@ -81,6 +81,10 @@ PLUGIN_HEADER
|
|||
#define DBG(format, arg...) {}
|
||||
#endif
|
||||
|
||||
#ifndef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
#if CONFIG_KEYPAD == IRIVER_H100_PAD
|
||||
|
||||
#define QUIT BUTTON_OFF
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdlib.h> /* for abs() */
|
||||
#include "buflib.h"
|
||||
|
||||
/* The main goal of this design is fast fetching of the pointer for a handle.
|
||||
* For that reason, the handles are stored in a table at the end of the buffer
|
||||
* with a fixed address, so that returning the pointer for a handle is a simple
|
||||
|
@ -311,7 +311,7 @@ buflib_free(struct buflib_context *ctx, int handle_num)
|
|||
while (next_block < freed_block)
|
||||
{
|
||||
block = next_block;
|
||||
next_block += ABS(block->val);
|
||||
next_block += abs(block->val);
|
||||
}
|
||||
/* If next_block == block, the above loop didn't go anywhere. If it did,
|
||||
* and the block before this one is empty, we can combine them.
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#ifndef _LIB_JHASH_H_
|
||||
#define _LIB_JHASH_H_
|
||||
#include <inttypes.h> /* defines uint32_t etc */
|
||||
#include <sys/types.h>
|
||||
#include <plugin.h>
|
||||
#include <string.h> /* size_t */
|
||||
#include "plugin.h"
|
||||
|
||||
/*
|
||||
hashw() -- hash an array of uint32_t into a 32-bit value
|
||||
|
|
|
@ -39,6 +39,7 @@ QUICKREF
|
|||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include "plugin.h"
|
||||
|
||||
/*SUPPRESS 560*/
|
||||
/*SUPPRESS 530*/
|
||||
|
|
|
@ -20,7 +20,7 @@ const short __spm[13] =
|
|||
(31+28+31+30+31+30+31+31+30+31+30+31),
|
||||
};
|
||||
|
||||
int __isleap(int year) {
|
||||
static inline int isleap(int year) {
|
||||
/* every fourth year is a leap year except for century years that are
|
||||
* not divisible by 400. */
|
||||
/* return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); */
|
||||
|
@ -36,7 +36,7 @@ struct tm *gmtime(const time_t *timep) {
|
|||
work=*timep/(SPD);
|
||||
r.tm_wday=(4+work)%7;
|
||||
for (i=1970; ; ++i) {
|
||||
register time_t k=__isleap(i)?366:365;
|
||||
register time_t k=isleap(i)?366:365;
|
||||
if (work>=k)
|
||||
work-=k;
|
||||
else
|
||||
|
@ -46,7 +46,7 @@ struct tm *gmtime(const time_t *timep) {
|
|||
r.tm_yday=work;
|
||||
|
||||
r.tm_mday=1;
|
||||
if (__isleap(i) && (work>58)) {
|
||||
if (isleap(i) && (work>58)) {
|
||||
if (work==59) r.tm_mday=2; /* 29.2. */
|
||||
work-=1;
|
||||
}
|
||||
|
|
|
@ -450,6 +450,8 @@ static int midimain(const void * filename)
|
|||
enum plugin_status plugin_start(const void* parameter)
|
||||
{
|
||||
int retval;
|
||||
PLUGINLIB_EXIT_INIT;
|
||||
|
||||
PLUGIN_IRAM_INIT(rb)
|
||||
|
||||
if (parameter == NULL)
|
||||
|
|
|
@ -163,8 +163,3 @@ int printf(const char *fmt, ...)
|
|||
return 1;
|
||||
}
|
||||
|
||||
void exit(int code)
|
||||
{
|
||||
code = code; /* Stub function, kill warning for now */
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#define FRACTSIZE 12
|
||||
|
||||
#include "lib/pluginlib_exit.h"
|
||||
|
||||
#define BUF_SIZE 16384 /* 64 kB output buffers */
|
||||
#define NBUF 2
|
||||
|
||||
|
@ -145,7 +147,6 @@ int readFourBytes(int file);
|
|||
int readVarData(int file);
|
||||
int eof(int fd);
|
||||
unsigned char * readData(int file, int len);
|
||||
void exit(int code);
|
||||
|
||||
#define malloc(n) my_malloc(n)
|
||||
void * my_malloc(int size);
|
||||
|
|
|
@ -855,7 +855,7 @@ bool disk_buf_init(void)
|
|||
disk_buf.pos_last = 0;
|
||||
disk_buf.low_wm = DISK_BUF_LOW_WATERMARK;
|
||||
|
||||
disk_buf.start = mpeg_malloc_all(&disk_buf.size, MPEG_ALLOC_DISKBUF);
|
||||
disk_buf.start = mpeg_malloc_all((size_t*)&disk_buf.size, MPEG_ALLOC_DISKBUF);
|
||||
if (disk_buf.start == NULL)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
PLUGIN_HEADER
|
||||
|
||||
static bool abort;
|
||||
static bool cancel;
|
||||
static int fd;
|
||||
static int dirs_count;
|
||||
static int lasttick;
|
||||
|
@ -70,7 +70,7 @@ void traversedir(char* location, char* name)
|
|||
if (dir) {
|
||||
entry = rb->readdir(dir);
|
||||
while (entry) {
|
||||
if (abort)
|
||||
if (cancel)
|
||||
break;
|
||||
/* Skip .. and . */
|
||||
if (entry->d_name[0] == '.')
|
||||
|
@ -113,7 +113,7 @@ void traversedir(char* location, char* name)
|
|||
lasttick = *rb->current_tick;
|
||||
if (rb->action_userabort(TIMEOUT_NOBLOCK))
|
||||
{
|
||||
abort = true;
|
||||
cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ bool custom_dir(void)
|
|||
void generate(void)
|
||||
{
|
||||
dirs_count = 0;
|
||||
abort = false;
|
||||
cancel = false;
|
||||
fd = rb->open(RFA_FILE,O_CREAT|O_WRONLY, 0666);
|
||||
rb->write(fd,&dirs_count,sizeof(int));
|
||||
if (fd < 0)
|
||||
|
@ -621,7 +621,7 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
{
|
||||
(void)parameter;
|
||||
|
||||
abort = false;
|
||||
cancel = false;
|
||||
|
||||
return main_menu();
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ static void build_slot_path(char *buf, size_t bufsiz, size_t slot_id) {
|
|||
munge_name(name_buf, strlen(name_buf));
|
||||
|
||||
/* glom the whole mess together */
|
||||
snprintf(buf, bufsiz, "%s/%s-%ld.rbs", STATE_DIR, name_buf, slot_id + 1);
|
||||
snprintf(buf, bufsiz, "%s/%s-%zud.rbs", STATE_DIR, name_buf, slot_id + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -253,17 +253,17 @@ static void slot_info(char *info_buf, size_t info_bufsiz, size_t slot_id) {
|
|||
if (read(fd, buf, 20) > 0)
|
||||
{
|
||||
buf[20] = '\0';
|
||||
snprintf(info_buf, info_bufsiz, "%ld. %s", slot_id + 1, buf);
|
||||
snprintf(info_buf, info_bufsiz, "%zud. %s", slot_id + 1, buf);
|
||||
}
|
||||
else
|
||||
snprintf(info_buf, info_bufsiz, "%ld. ERROR", slot_id + 1);
|
||||
snprintf(info_buf, info_bufsiz, "%zud. ERROR", slot_id + 1);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* if we couldn't open the file, then the slot is empty */
|
||||
snprintf(info_buf, info_bufsiz, "%ld. %s", slot_id + 1, "<Empty>");
|
||||
snprintf(info_buf, info_bufsiz, "%zu. %s", slot_id + 1, "<Empty>");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ ROCKBOY_SRCDIR = $(APPSDIR)/plugins/rockboy
|
|||
ROCKBOY_OBJDIR = $(BUILDDIR)/apps/plugins/rockboy
|
||||
|
||||
ROCKBOY_SRC := $(call preprocess, $(ROCKBOY_SRCDIR)/SOURCES)
|
||||
ROCKBOY_SRC += $(ROOTDIR)/firmware/common/sscanf.c
|
||||
ROCKBOY_SRC += $(ROOTDIR)/firmware/libc/sscanf.c
|
||||
ROCKBOY_OBJ := $(call c2obj, $(ROCKBOY_SRC))
|
||||
|
||||
OTHER_SRC += $(ROCKBOY_SRC)
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "defs.h"
|
||||
#include "mem.h"
|
||||
#include "rtc-gb.h"
|
||||
#include "sscanf.h"
|
||||
|
||||
struct rtc rtc;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include "plugin.h"
|
||||
#include "ctype.h"
|
||||
#include <ctype.h>
|
||||
|
||||
PLUGIN_HEADER
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ typedef struct sc_file_s
|
|||
|
||||
|
||||
extern void *memory_buf;
|
||||
extern long memory_bufsize;
|
||||
extern size_t memory_bufsize;
|
||||
|
||||
|
||||
extern sc_file_t sc_file;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
/* Memory (will be used for entries) */
|
||||
void *memory_buf;
|
||||
long memory_bufsize; /* Size of memory_buf in bytes */
|
||||
size_t memory_bufsize; /* Size of memory_buf in bytes */
|
||||
|
||||
|
||||
/* The file we're processing */
|
||||
|
|
|
@ -24,7 +24,7 @@ PLUGIN_HEADER
|
|||
|
||||
static int files, dirs, musicfiles, largestdir;
|
||||
static int lasttick;
|
||||
static bool abort;
|
||||
static bool cancel;
|
||||
|
||||
#if CONFIG_KEYPAD == PLAYER_PAD
|
||||
#define STATS_STOP BUTTON_STOP
|
||||
|
@ -173,7 +173,7 @@ void traversedir(char* location, char* name)
|
|||
if (dir) {
|
||||
entry = rb->readdir(dir);
|
||||
while (entry) {
|
||||
if (abort)
|
||||
if (cancel)
|
||||
break;
|
||||
/* Skip .. and . */
|
||||
if (rb->strcmp(entry->d_name, ".") && rb->strcmp(entry->d_name, ".."))
|
||||
|
@ -206,7 +206,7 @@ void traversedir(char* location, char* name)
|
|||
|| button == STATS_STOP_REMOTE
|
||||
#endif
|
||||
) {
|
||||
abort = true;
|
||||
cancel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -229,14 +229,14 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
dirs = 0;
|
||||
musicfiles = 0;
|
||||
largestdir = 0;
|
||||
abort = false;
|
||||
cancel = false;
|
||||
|
||||
rb->splash(HZ, "Counting...");
|
||||
update_screen();
|
||||
lasttick = *rb->current_tick;
|
||||
|
||||
traversedir("", "");
|
||||
if (abort) {
|
||||
if (cancel) {
|
||||
rb->splash(HZ, "Aborted");
|
||||
return PLUGIN_OK;
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@ static int32_t temp_buffer [TEMP_SAMPLES] IDATA_ATTR;
|
|||
static int wav2wv(const char *infile)
|
||||
{
|
||||
int in_fd, out_fd, num_chans, error = false, last_buttons;
|
||||
unsigned int32_t total_bytes_read = 0, total_bytes_written = 0;
|
||||
unsigned int32_t total_samples, samples_remaining;
|
||||
uint32_t total_bytes_read = 0, total_bytes_written = 0;
|
||||
uint32_t total_samples, samples_remaining;
|
||||
int32_t *input_buffer = (int32_t *) audiobuf;
|
||||
unsigned char *output_buffer = (unsigned char *)(audiobuf + 0x100000);
|
||||
char outfile[MAX_PATH];
|
||||
|
@ -180,7 +180,7 @@ static int wav2wv(const char *infile)
|
|||
wvupdate (start_tick, native_header.SampleRate, total_samples, 0, 0, 0);
|
||||
|
||||
for (samples_remaining = total_samples; samples_remaining;) {
|
||||
unsigned int32_t samples_count, samples_to_pack, bytes_count;
|
||||
uint32_t samples_count, samples_to_pack, bytes_count;
|
||||
int cnt, buttons;
|
||||
int32_t value, *lp;
|
||||
signed char *cp;
|
||||
|
@ -204,7 +204,7 @@ static int wav2wv(const char *infile)
|
|||
cp = (signed char *) input_buffer;
|
||||
|
||||
while (samples_to_pack) {
|
||||
unsigned int32_t samples_this_pass = TEMP_SAMPLES / num_chans;
|
||||
uint32_t samples_this_pass = TEMP_SAMPLES / num_chans;
|
||||
|
||||
if (samples_this_pass > samples_to_pack)
|
||||
samples_this_pass = samples_to_pack;
|
||||
|
|
|
@ -7,9 +7,12 @@ extern off_t my_ftell(int);
|
|||
extern void *my_malloc(size_t size);
|
||||
|
||||
|
||||
#undef getc
|
||||
#define getc my_getc
|
||||
#define malloc my_malloc
|
||||
#define ftell my_ftell
|
||||
#undef putc
|
||||
#define putc my_putc
|
||||
#undef ftell
|
||||
#define ftell my_ftell
|
||||
#define malloc my_malloc
|
||||
|
||||
#endif /* HELPERS_H */
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* size_t */
|
||||
#include "zxmisc.h"
|
||||
#include "helpers.h"
|
||||
#include "spperif.h"
|
||||
#include "z80.h"
|
||||
|
||||
|
@ -29,9 +30,8 @@
|
|||
|
||||
#include "spconf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
/* include this at last to avoid clashes with stdio functions */
|
||||
#include "helpers.h"
|
||||
|
||||
#define COMPRESS_SAVE 1
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "zxmisc.h"
|
||||
#include "spconf_p.h"
|
||||
#include "interf.h"
|
||||
|
@ -26,11 +30,7 @@
|
|||
#include "snapshot.h" /* for SN_Z80 and SN_SNA */
|
||||
#include "tapefile.h" /* for TAP_TAP and TAP_TZX */
|
||||
#include "zxconfig.h"
|
||||
#include "stdio.h"
|
||||
#include "string.h"
|
||||
#include "sys/types.h"
|
||||
#include "helpers.h"
|
||||
#include "ctype.h"
|
||||
|
||||
|
||||
extern const char *spcf_keynames_ascii[];
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define MAXLINELEN 256
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include "inttypes.h"
|
||||
#include "zxconfig.h"
|
||||
#include "helpers.h"
|
||||
#define max(x, y) ((x) > (y) ? (x) : (y))
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef ZXMISC_H
|
||||
#define ZXMISC_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h> /* size_t */
|
||||
|
||||
extern char *get_base_name(char *fname);
|
||||
extern int check_ext(const char *filename, const char *ext);
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "sprintf.h"
|
||||
#include "string-extra.h"
|
||||
#include "system.h"
|
||||
#include "albumart.h"
|
||||
#include "metadata.h"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "lcd.h"
|
||||
#include "font.h"
|
||||
#include "kernel.h"
|
||||
#include "sprintf.h"
|
||||
#include "rtc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
|
|
|
@ -856,7 +856,7 @@ static const struct idct_entry idct_tbl[] = {
|
|||
/* JPEG decoder implementation */
|
||||
|
||||
#ifdef JPEG_FROM_MEM
|
||||
INLINE unsigned char *getc(struct jpeg* p_jpeg)
|
||||
INLINE unsigned char *jpeg_getc(struct jpeg* p_jpeg)
|
||||
{
|
||||
if (LIKELY(p_jpeg->len))
|
||||
{
|
||||
|
@ -880,7 +880,7 @@ INLINE bool skip_bytes(struct jpeg* p_jpeg, int count)
|
|||
}
|
||||
}
|
||||
|
||||
INLINE void putc(struct jpeg* p_jpeg)
|
||||
INLINE void jpeg_putc(struct jpeg* p_jpeg)
|
||||
{
|
||||
p_jpeg->len++;
|
||||
p_jpeg->data--;
|
||||
|
@ -892,7 +892,7 @@ INLINE void fill_buf(struct jpeg* p_jpeg)
|
|||
p_jpeg->buf_index = 0;
|
||||
}
|
||||
|
||||
static unsigned char *getc(struct jpeg* p_jpeg)
|
||||
static unsigned char *jpeg_getc(struct jpeg* p_jpeg)
|
||||
{
|
||||
if (UNLIKELY(p_jpeg->buf_left < 1))
|
||||
fill_buf(p_jpeg);
|
||||
|
@ -917,7 +917,7 @@ static bool skip_bytes(struct jpeg* p_jpeg, int count)
|
|||
return p_jpeg->buf_left >= 0 || skip_bytes_seek(p_jpeg);
|
||||
}
|
||||
|
||||
static void putc(struct jpeg* p_jpeg)
|
||||
static void jpeg_putc(struct jpeg* p_jpeg)
|
||||
{
|
||||
p_jpeg->buf_left++;
|
||||
p_jpeg->buf_index--;
|
||||
|
@ -933,14 +933,14 @@ do {\
|
|||
#define e_getc(jpeg, code) \
|
||||
({ \
|
||||
unsigned char *c; \
|
||||
if (UNLIKELY(!(c = getc(jpeg)))) \
|
||||
if (UNLIKELY(!(c = jpeg_getc(jpeg)))) \
|
||||
return (code); \
|
||||
*c; \
|
||||
})
|
||||
|
||||
#define d_getc(jpeg, def) \
|
||||
({ \
|
||||
unsigned char *cp = getc(jpeg); \
|
||||
unsigned char *cp = jpeg_getc(jpeg); \
|
||||
unsigned char c = LIKELY(cp) ? *cp : (def); \
|
||||
c; \
|
||||
})
|
||||
|
@ -958,7 +958,7 @@ static int process_markers(struct jpeg* p_jpeg)
|
|||
if (c != 0xFF) /* no marker? */
|
||||
{
|
||||
JDEBUGF("Non-marker data\n");
|
||||
putc(p_jpeg);
|
||||
jpeg_putc(p_jpeg);
|
||||
break; /* exit marker processing */
|
||||
}
|
||||
|
||||
|
@ -969,7 +969,7 @@ static int process_markers(struct jpeg* p_jpeg)
|
|||
case 0xFF: /* Fill byte */
|
||||
ret |= FILL_FF;
|
||||
case 0x00: /* Zero stuffed byte - entropy data */
|
||||
putc(p_jpeg);
|
||||
jpeg_putc(p_jpeg);
|
||||
continue;
|
||||
|
||||
case 0xC0: /* SOF Huff - Baseline DCT */
|
||||
|
@ -1669,7 +1669,7 @@ static void search_restart(struct jpeg *p_jpeg)
|
|||
return;
|
||||
}
|
||||
else
|
||||
putc(p_jpeg);
|
||||
jpeg_putc(p_jpeg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
****************************************************************************/
|
||||
#include "kernel.h"
|
||||
#include "system.h"
|
||||
#include <string.h>
|
||||
#include "string-extra.h"
|
||||
#include "font.h"
|
||||
#include "screens.h"
|
||||
#include "talk.h"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "storage.h"
|
||||
#include "lcd.h"
|
||||
#include "scrollbar.h"
|
||||
#include "sprintf.h"
|
||||
#include "button.h"
|
||||
#include "system.h"
|
||||
#include "font.h"
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include "sprintf.h"
|
||||
#include "mas.h"
|
||||
#include "settings.h"
|
||||
#include "button.h"
|
||||
|
@ -35,7 +34,7 @@
|
|||
#include "file.h"
|
||||
#include "general.h"
|
||||
#include "errno.h"
|
||||
#include "string.h"
|
||||
#include "string-extra.h"
|
||||
#include "system.h"
|
||||
#include "radio.h"
|
||||
#include "menu.h"
|
||||
|
|
|
@ -1762,7 +1762,7 @@ bool recording_screen(bool no_source)
|
|||
draw attention */
|
||||
/* Don't use language string unless agreed upon to make this
|
||||
method permanent - could do something in the statusbar */
|
||||
snprintf(buf, sizeof(buf), "Warning: %08X",
|
||||
snprintf(buf, sizeof(buf), "Warning: %08lX",
|
||||
pcm_rec_get_warnings());
|
||||
}
|
||||
else
|
||||
|
@ -1771,7 +1771,7 @@ bool recording_screen(bool no_source)
|
|||
(global_settings.rec_split_method))
|
||||
{
|
||||
dmb = dsize/1024/1024;
|
||||
snprintf(buf, sizeof(buf), "%s %dMB",
|
||||
snprintf(buf, sizeof(buf), "%s %luMB",
|
||||
str(LANG_SPLIT_SIZE), dmb);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <system.h>
|
||||
#include <inttypes.h>
|
||||
#include "strlcpy.h"
|
||||
#include "strcasecmp.h"
|
||||
#include "system.h"
|
||||
#include "metadata.h"
|
||||
#include "debug.h"
|
||||
#include "replaygain.h"
|
||||
|
@ -244,7 +245,7 @@ long parse_replaygain_int(bool album, long gain, long peak,
|
|||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
len = snprintf(buffer, length, "%d.%02d dB", gain / 512,
|
||||
len = snprintf(buffer, length, "%ld.%02d dB", gain / 512,
|
||||
((abs(gain) & 0x01ff) * 100 + 256) / 512);
|
||||
len++;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include "string-extra.h"
|
||||
#include "config.h"
|
||||
#include "appevents.h"
|
||||
#include "menu.h"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue