History

use size_t instead of int when work with strings

Sergey Sushilin committed 6 years ago

Commit 14fc6b61 parent df72b8d2 files · +5 −5Browse files

Unified · Split

2 files
  1. libtcc.c +3 −3
  2. tcc.h +2 −2
libtcc.c+3−3
@@ -132,7 +132,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) · 131 unmodified lines
132 132
133/********************************************************/133/********************************************************/
134/* copy a string and truncate it. */134/* copy a string and truncate it. */
135ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)135ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s)
136{136{
137 char *q, *q_end;137 char *q, *q_end;
138 int c;138 int c;
@@ -152,9 +152,9 @@ ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) · 13 unmodified lines
152}152}
153 153
154/* strcat and truncate. */154/* strcat and truncate. */
155ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)155ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s)
156{156{
157 int len;157 size_t len;
158 len = strlen(buf);158 len = strlen(buf);
159 if (len < buf_size)159 if (len < buf_size)
160 pstrcpy(buf + len, buf_size - len, s);160 pstrcpy(buf + len, buf_size - len, s);
tcc.h+2−2
@@ -1120,8 +1120,8 @@ ST_DATA int tcc_ext; · 1119 unmodified lines
1120ST_DATA struct TCCState *tcc_state;1120ST_DATA struct TCCState *tcc_state;
1121 1121
1122/* public functions currently used by the tcc main function */1122/* public functions currently used by the tcc main function */
1123ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);1123ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s);
1124ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);1124ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s);
1125ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);1125ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
1126PUB_FUNC char *tcc_basename(const char *name);1126PUB_FUNC char *tcc_basename(const char *name);
1127PUB_FUNC char *tcc_fileextension (const char *name);1127PUB_FUNC char *tcc_fileextension (const char *name);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t