mirror of
https://github.com/frida/tinycc
synced 2025-01-11 14:19:19 +03:00
use size_t instead of int when work with strings
This commit is contained in:
parent
df72b8d487
commit
14fc6b6dcb
6
libtcc.c
6
libtcc.c
@ -132,7 +132,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
|
||||
/********************************************************/
|
||||
/* copy a string and truncate it. */
|
||||
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
||||
ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s)
|
||||
{
|
||||
char *q, *q_end;
|
||||
int c;
|
||||
@ -152,9 +152,9 @@ ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
||||
}
|
||||
|
||||
/* strcat and truncate. */
|
||||
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
|
||||
ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s)
|
||||
{
|
||||
int len;
|
||||
size_t len;
|
||||
len = strlen(buf);
|
||||
if (len < buf_size)
|
||||
pstrcpy(buf + len, buf_size - len, s);
|
||||
|
4
tcc.h
4
tcc.h
@ -1120,8 +1120,8 @@ ST_DATA int tcc_ext;
|
||||
ST_DATA struct TCCState *tcc_state;
|
||||
|
||||
/* public functions currently used by the tcc main function */
|
||||
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
|
||||
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
|
||||
ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s);
|
||||
ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s);
|
||||
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
|
||||
PUB_FUNC char *tcc_basename(const char *name);
|
||||
PUB_FUNC char *tcc_fileextension (const char *name);
|
||||
|
Loading…
Reference in New Issue
Block a user