mirror of
https://github.com/frida/tinycc
synced 2025-01-26 05:02:02 +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. */
|
/* 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;
|
char *q, *q_end;
|
||||||
int c;
|
int c;
|
||||||
@ -152,9 +152,9 @@ ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* strcat and truncate. */
|
/* 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);
|
len = strlen(buf);
|
||||||
if (len < buf_size)
|
if (len < buf_size)
|
||||||
pstrcpy(buf + len, buf_size - len, s);
|
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;
|
ST_DATA struct TCCState *tcc_state;
|
||||||
|
|
||||||
/* public functions currently used by the tcc main function */
|
/* public functions currently used by the tcc main function */
|
||||||
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);
|
||||||
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);
|
||||||
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
|
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
|
||||||
PUB_FUNC char *tcc_basename(const char *name);
|
PUB_FUNC char *tcc_basename(const char *name);
|
||||||
PUB_FUNC char *tcc_fileextension (const char *name);
|
PUB_FUNC char *tcc_fileextension (const char *name);
|
||||||
|
Loading…
Reference in New Issue
Block a user