comparison src/lib/strescape.c @ 898:0d5be52d7131 HEAD

Use unsigned char* when accessing non-NUL terminating strings. Compiler warnings would then notify about accidentally passing them to functions which require them NUL-terminated. Changed a few functions to use void* to avoid unneeded casting.
author Timo Sirainen <tss@iki.fi>
date Sat, 04 Jan 2003 19:26:29 +0200
parents 21ffcce83c70
children fd8888f6f037
comparison
equal deleted inserted replaced
897:e27267f227e6 898:0d5be52d7131
49 } 49 }
50 *p = '\0'; 50 *p = '\0';
51 return ret; 51 return ret;
52 } 52 }
53 53
54 void str_append_unescaped(String *dest, const char *src, size_t src_size) 54 void str_append_unescaped(String *dest, const void *src, size_t src_size)
55 { 55 {
56 const unsigned char *src_c = src;
56 size_t start = 0, i = 0; 57 size_t start = 0, i = 0;
57 58
58 while (i < src_size) { 59 while (i < src_size) {
59 start = i; 60 start = i;
60 for (; i < src_size; i++) { 61 for (; i < src_size; i++) {
61 if (src[i] == '\\') 62 if (src_c[i] == '\\')
62 break; 63 break;
63 } 64 }
64 65
65 str_append_n(dest, src + start, i-start); 66 str_append_n(dest, src_c + start, i-start);
66 67
67 if (src[i] == '\\') 68 if (src_c[i] == '\\')
68 i++; 69 i++;
69 start = i; 70 start = i;
70 } 71 }
71 } 72 }
72 73