Lines Matching refs:str
6 #include "str.h"
10 static bool verify_q(const char *str, unsigned int i, bool starts_with_a)
14 if (strncmp(str+i, "\n\t", 2) == 0) {
20 if (strncmp(str+i, "=?utf-8?q?", 10) != 0)
25 if (str[i] != 'a')
30 while (strncmp(str+i, "?=", 2) != 0) {
31 if (strncmp(str+i, "=C3=A4", 6) != 0)
40 if (str[i] == '\0')
42 if (strncmp(str+i, "\n\t", 2) != 0)
53 string_t *str = t_str_new(512);
63 str_truncate(str, 0);
65 str_append_c(str, 'X');
67 str_append_c(str, ' ');
70 str_len(input) - skip, str,
72 test_assert(verify_q(str_c(str), i, skip == 0));
78 static bool verify_b(const char *str, unsigned int i, bool starts_with_a)
85 if (strncmp(str+i, "\n\t", 2) == 0) {
91 if (strncmp(str+i, "=?utf-8?b?", 10) != 0)
96 for (; str[i] != '?'; i++) {
97 if (str[i] == '\0')
101 if (base64_decode(str+start, i-start, NULL, &buf) < 0)
121 if (str[i++] != '=')
127 if (str[i] == '\0')
129 if (strncmp(str+i, "\n\t", 2) != 0)
140 string_t *str = t_str_new(512);
150 str_truncate(str, 0);
152 str_append_c(str, 'X');
154 str_append_c(str, ' ');
157 str_len(input) - skip, str,
159 test_assert(verify_b(str_c(str), i, skip == 0));
195 string_t *str = t_str_new(128);
200 str_truncate(str, 0);
201 message_header_encode(data[i], str);
202 test_assert(strcmp(str_c(str), data[i+1]) == 0);
209 string_t *str = t_str_new(128);
213 message_header_encode_data(nuls, 1, str);
214 test_assert(strcmp(str_c(str), "=?utf-8?q?=00?=") == 0);
216 str_truncate(str, 0);
217 message_header_encode_data(nuls, sizeof(nuls), str);
218 test_assert(strcmp(str_c(str), "=?utf-8?b?AAAAAAAAAAAAAA==?=") == 0);