@matheusbsbs / matheus-bagliano / commits / b073211534
Fork 0

ident.c: Use size_t (instead of int) to store sizes

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luiz Fernando N. Capitulino committed Apr 15, 2007 at 15:51 UTC b0732115342d190d8c547ceaf5bf7a3534e3be5d
1 file changed +7 -7
ident.c
+7 -7
@@ -9,10 +9,10 @@
9
10 static char git_default_date[50];
11
12 -static void copy_gecos(const struct passwd *w, char *name, int sz)
12 +static void copy_gecos(const struct passwd *w, char *name, size_t sz)
13 {
14 char *src, *dst;
15 - int len, nlen;
15 + size_t len, nlen;
16
17 nlen = strlen(w->pw_name);
18
@@ -49,7 +49,7 @@ static void copy_email(const struct passwd *pw)
49 * Make up a fake email address
50 * (name + '@' + hostname [+ '.' + domainname])
51 */
52 - int len = strlen(pw->pw_name);
52 + size_t len = strlen(pw->pw_name);
53 if (len > sizeof(git_default_email)/2)
54 die("Your sysadmin must hate you!");
55 memcpy(git_default_email, pw->pw_name, len);
@@ -95,9 +95,9 @@ static void setup_ident(void)
95 datestamp(git_default_date, sizeof(git_default_date));
96 }
97
98 -static int add_raw(char *buf, int size, int offset, const char *str)
98 +static int add_raw(char *buf, size_t size, int offset, const char *str)
99 {
100 - int len = strlen(str);
100 + size_t len = strlen(str);
101 if (offset + len > size)
102 return size;
103 memcpy(buf + offset, str, len);
@@ -131,9 +131,9 @@ static int crud(unsigned char c)
131 * Copy over a string to the destination, but avoid special
132 * characters ('\n', '<' and '>') and remove crud at the end
133 */
134 -static int copy(char *buf, int size, int offset, const char *src)
134 +static int copy(char *buf, size_t size, int offset, const char *src)
135 {
136 - int i, len;
136 + size_t i, len;
137 unsigned char c;
138
139 /* Remove crud from the beginning.. */