comparison src/accept.c @ 14:a8f3424347dc

replaced number 0 with character \0 where appropriate
author meillo@marmaro.de
date Wed, 29 Oct 2008 21:21:26 +0100
parents 49dab67fe461
children 7c1635972aa7
comparison
equal deleted inserted replaced
13:49dab67fe461 14:a8f3424347dc
32 static gchar* 32 static gchar*
33 string_base62(gchar * res, guint value, gchar len) 33 string_base62(gchar * res, guint value, gchar len)
34 { 34 {
35 static gchar base62_chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 35 static gchar base62_chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
36 gchar *p = res + len; 36 gchar *p = res + len;
37 *p = 0; 37 *p = '\0';
38 while (p > res) { 38 while (p > res) {
39 *(--p) = base62_chars[value % 62]; 39 *(--p) = base62_chars[value % 62];
40 value /= 62; 40 value /= 62;
41 } 41 }
42 return res; 42 return res;
71 gboolean in_headers = TRUE; 71 gboolean in_headers = TRUE;
72 header *hdr = NULL; 72 header *hdr = NULL;
73 gint line_cnt = 0, data_size = 0; 73 gint line_cnt = 0, data_size = 0;
74 74
75 line = g_malloc(line_size); 75 line = g_malloc(line_size);
76 line[0] = 0; 76 line[0] = '\0';
77 77
78 while (TRUE) { 78 while (TRUE) {
79 int len = read_sockline1(in, &line, &line_size, 5 * 60, READSOCKL_CVT_CRLF); 79 int len = read_sockline1(in, &line, &line_size, 5 * 60, READSOCKL_CVT_CRLF);
80 80
81 line1 = line; 81 line1 = line;
93 /* we got an EOF, and the last line was not terminated by a CR */ 93 /* we got an EOF, and the last line was not terminated by a CR */
94 gint len1 = strlen(line1); 94 gint len1 = strlen(line1);
95 if (len1 > 0) { /* == 0 is 'normal' (EOF after a CR) */ 95 if (len1 > 0) { /* == 0 is 'normal' (EOF after a CR) */
96 if (line1[len1 - 1] != '\n') { /* some mail clients allow unterminated lines */ 96 if (line1[len1 - 1] != '\n') { /* some mail clients allow unterminated lines */
97 line1[len1] = '\n'; 97 line1[len1] = '\n';
98 line1[len1 + 1] = 0; 98 line1[len1 + 1] = '\0';
99 msg->data_list = g_list_prepend(msg->data_list, g_strdup(line1)); 99 msg->data_list = g_list_prepend(msg->data_list, g_strdup(line1));
100 data_size += strlen(line1); 100 data_size += strlen(line1);
101 line_cnt++; 101 line_cnt++;
102 } 102 }
103 } 103 }