mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
libc: move strncpy to core
Change-Id: If005a0305cedbab85905536238d0f799f19213e1
This commit is contained in:
parent
4c60fe95fc
commit
5951f6e5e9
14 changed files with 14 additions and 4 deletions
|
|
@ -875,6 +875,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
gui_synclist_scroll_stop,
|
gui_synclist_scroll_stop,
|
||||||
add_event_ex,
|
add_event_ex,
|
||||||
remove_event_ex,
|
remove_event_ex,
|
||||||
|
strncpy,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int plugin_buffer_handle;
|
static int plugin_buffer_handle;
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@
|
||||||
|
|
||||||
#define splash(__ticks, __str) splashf(__ticks, __str)
|
#define splash(__ticks, __str) splashf(__ticks, __str)
|
||||||
|
|
||||||
char* strncpy(char *, const char *, size_t);
|
|
||||||
void* plugin_get_buffer(size_t *buffer_size);
|
void* plugin_get_buffer(size_t *buffer_size);
|
||||||
size_t plugin_reserve_buffer(size_t buffer_size);
|
size_t plugin_reserve_buffer(size_t buffer_size);
|
||||||
int plugin_open(const char *plugin, const char *parameter);
|
int plugin_open(const char *plugin, const char *parameter);
|
||||||
|
|
@ -1038,6 +1037,7 @@ struct plugin_api {
|
||||||
void *event_data,
|
void *event_data,
|
||||||
void *user_data),
|
void *user_data),
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
char* (*strncpy)(char * dst, const char * src, size_t count);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* plugin header */
|
/* plugin header */
|
||||||
|
|
|
||||||
|
|
@ -1119,7 +1119,7 @@ static void transcendFunc(char* func, double* tt, int* ttPower)
|
||||||
|
|
||||||
/* Save current function context */
|
/* Save current function context */
|
||||||
char original_func[3];
|
char original_func[3];
|
||||||
strncpy(original_func, func, 3);
|
rb->strncpy(original_func, func, 3);
|
||||||
|
|
||||||
transcendFunc("asin", &arcsin_input, &arcsin_power);
|
transcendFunc("asin", &arcsin_input, &arcsin_power);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ int my_close(int id);
|
||||||
#define strcmp(a,b) rb->strcmp((a),(b))
|
#define strcmp(a,b) rb->strcmp((a),(b))
|
||||||
#undef strncmp
|
#undef strncmp
|
||||||
#define strncmp(a,b,c) rb->strncmp((a),(b),(c))
|
#define strncmp(a,b,c) rb->strncmp((a),(b),(c))
|
||||||
|
#undef strncpy
|
||||||
|
#define strncpy(a,b,c) rb->strncpy((a),(b),(c))
|
||||||
#undef strchr
|
#undef strchr
|
||||||
#define strchr(a,b) rb->strchr((a),(b))
|
#define strchr(a,b) rb->strchr((a),(b))
|
||||||
#undef strrchr
|
#undef strrchr
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ highscore.c
|
||||||
simple_viewer.c
|
simple_viewer.c
|
||||||
display_text.c
|
display_text.c
|
||||||
printcell_helper.c
|
printcell_helper.c
|
||||||
strncpy.c
|
|
||||||
stdio_compat.c
|
stdio_compat.c
|
||||||
|
|
||||||
#if (LCD_DEPTH < 4)
|
#if (LCD_DEPTH < 4)
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ int splash_scroller(int timeout, const char* str);
|
||||||
#define strcmp rb->strcmp
|
#define strcmp rb->strcmp
|
||||||
#define strcpy rb->strcpy
|
#define strcpy rb->strcpy
|
||||||
#define strlen rb->strlen
|
#define strlen rb->strlen
|
||||||
|
#define strncpy rb->strncpy
|
||||||
#define strtol rb->strtol
|
#define strtol rb->strtol
|
||||||
#define strtoul rb->strtoul
|
#define strtoul rb->strtoul
|
||||||
#define strstr rb->strstr
|
#define strstr rb->strstr
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
#define strcat(a,b) rb->strcat(a,b)
|
#define strcat(a,b) rb->strcat(a,b)
|
||||||
#undef strncmp
|
#undef strncmp
|
||||||
#define strncmp(a,b,c) rb->strncmp(a,b,c)
|
#define strncmp(a,b,c) rb->strncmp(a,b,c)
|
||||||
|
#undef strncpy
|
||||||
|
#define strncpy(a,b,c) rb->strncpy(a,b,c)
|
||||||
#undef strcasecmp
|
#undef strcasecmp
|
||||||
#define strcasecmp(a,b) rb->strcasecmp(a,b)
|
#define strcasecmp(a,b) rb->strcasecmp(a,b)
|
||||||
#undef strstr
|
#undef strstr
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ double acos_wrapper(double x);
|
||||||
#define strcmp rb->strcmp
|
#define strcmp rb->strcmp
|
||||||
#define strcpy rb->strcpy
|
#define strcpy rb->strcpy
|
||||||
#define strlen rb->strlen
|
#define strlen rb->strlen
|
||||||
|
#define strncpy rb->strncpy
|
||||||
#define strtol rb->strtol
|
#define strtol rb->strtol
|
||||||
#define strtoq strtoq_wrapper
|
#define strtoq strtoq_wrapper
|
||||||
#define strtouq strtouq_wrapper
|
#define strtouq strtouq_wrapper
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@
|
||||||
#define strncat rb->strlcat /* hack */
|
#define strncat rb->strlcat /* hack */
|
||||||
#endif
|
#endif
|
||||||
#define strncmp rb->strncmp
|
#define strncmp rb->strncmp
|
||||||
|
#define strncpy rb->strncpy
|
||||||
#ifndef strncat
|
#ifndef strncat
|
||||||
#define strpbrk strpbrk_wrapper
|
#define strpbrk strpbrk_wrapper
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "duke3d.h"
|
||||||
#include "cvars.h"
|
#include "cvars.h"
|
||||||
#include "cvar_defs.h"
|
#include "cvar_defs.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ void engine_saveGameState(struct Engine* e, uint8_t slot, const char *desc) {
|
||||||
file_writeUint16BE(&f, CUR_VER);
|
file_writeUint16BE(&f, CUR_VER);
|
||||||
file_writeUint16BE(&f, 0);
|
file_writeUint16BE(&f, 0);
|
||||||
char hdrdesc[32];
|
char hdrdesc[32];
|
||||||
strncpy(hdrdesc, desc, sizeof(hdrdesc) - 1);
|
rb->strncpy(hdrdesc, desc, sizeof(hdrdesc) - 1);
|
||||||
file_write(&f, hdrdesc, sizeof(hdrdesc));
|
file_write(&f, hdrdesc, sizeof(hdrdesc));
|
||||||
/* contents */
|
/* contents */
|
||||||
struct Serializer s;
|
struct Serializer s;
|
||||||
|
|
|
||||||
|
|
@ -356,6 +356,7 @@ libc/strcmp.c
|
||||||
libc/strcpy.c
|
libc/strcpy.c
|
||||||
libc/strcspn.c
|
libc/strcspn.c
|
||||||
libc/strncmp.c
|
libc/strncmp.c
|
||||||
|
libc/strncpy.c
|
||||||
libc/strrchr.c
|
libc/strrchr.c
|
||||||
libc/strstr.c
|
libc/strstr.c
|
||||||
libc/mktime.c
|
libc/mktime.c
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ char *_EXFUN(strerror,(int));
|
||||||
size_t _EXFUN(strlen,(const char *));
|
size_t _EXFUN(strlen,(const char *));
|
||||||
char *_EXFUN(strncat,(char *, const char *, size_t));
|
char *_EXFUN(strncat,(char *, const char *, size_t));
|
||||||
int _EXFUN(strncmp,(const char *, const char *, size_t));
|
int _EXFUN(strncmp,(const char *, const char *, size_t));
|
||||||
|
char *_EXFUN(strncpy, (char *, const char *, size_t));
|
||||||
char *_EXFUN(strpbrk,(const char *, const char *));
|
char *_EXFUN(strpbrk,(const char *, const char *));
|
||||||
char *_EXFUN(strrchr,(const char *, int));
|
char *_EXFUN(strrchr,(const char *, int));
|
||||||
size_t _EXFUN(strspn,(const char *, const char *));
|
size_t _EXFUN(strspn,(const char *, const char *));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue