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
132132
133133 /********************************************************/
134134 /* copy a string and truncate it. */
135−ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
135+ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s)
136136 {
137137 char *q, *q_end;
138138 int c;
@@ -152,9 +152,9 @@ ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) · 13 unmodified lines
152152 }
153153
154154 /* strcat and truncate. */
155−ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
155+ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s)
156156 {
157− int len;
157+ size_t len;
158158 len = strlen(buf);
159159 if (len < buf_size)
160160 pstrcpy(buf + len, buf_size - len, s);
tcc.h+2−2
@@ -1120,8 +1120,8 @@ ST_DATA int tcc_ext; · 1119 unmodified lines
11201120 ST_DATA struct TCCState *tcc_state;
11211121
11221122 /* public functions currently used by the tcc main function */
1123−ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
1124−ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
1123+ST_FUNC char *pstrcpy(char *buf, size_t buf_size, const char *s);
1124+ST_FUNC char *pstrcat(char *buf, size_t buf_size, const char *s);
11251125 ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
11261126 PUB_FUNC char *tcc_basename(const char *name);
11271127 PUB_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