Mercurial > hg > nginx
comparison src/core/ngx_string.c @ 290:87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 16 Mar 2004 07:10:12 +0000 |
parents | c0552e5ab567 |
children | 0376cffa29e6 |
comparison
equal
deleted
inserted
replaced
289:0750faf8d7e3 | 290:87e73f067470 |
---|---|
1 | 1 |
2 #include <ngx_config.h> | 2 #include <ngx_config.h> |
3 #include <ngx_core.h> | 3 #include <ngx_core.h> |
4 | 4 |
5 | 5 |
6 char *ngx_cpystrn(char *dst, char *src, size_t n) | 6 u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n) |
7 { | 7 { |
8 if (n == 0) { | 8 if (n == 0) { |
9 return dst; | 9 return dst; |
10 } | 10 } |
11 | 11 |
21 | 21 |
22 return dst; | 22 return dst; |
23 } | 23 } |
24 | 24 |
25 | 25 |
26 int ngx_rstrncmp(char *s1, char *s2, size_t n) | 26 ngx_int_t ngx_rstrncmp(u_char *s1, u_char *s2, size_t n) |
27 { | 27 { |
28 if (n == 0) { | 28 if (n == 0) { |
29 return 0; | 29 return 0; |
30 } | 30 } |
31 | 31 |
32 n--; | 32 n--; |
33 | 33 |
34 for ( ;; ) { | 34 for ( ;; ) { |
35 if (s1[n] != s2[n]) { | 35 if (s1[n] != s2[n]) { |
36 return (u_char) s1[n] - (u_char) s2[n]; | 36 return s1[n] - s2[n]; |
37 } | 37 } |
38 | 38 |
39 if (n == 0) { | 39 if (n == 0) { |
40 return 0; | 40 return 0; |
41 } | 41 } |
43 n--; | 43 n--; |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 | 47 |
48 int ngx_atoi(char *line, size_t n) | 48 ngx_int_t ngx_atoi(u_char *line, size_t n) |
49 { | 49 { |
50 int value; | 50 ngx_int_t value; |
51 | 51 |
52 if (n == 0) { | 52 if (n == 0) { |
53 return NGX_ERROR; | 53 return NGX_ERROR; |
54 } | 54 } |
55 | 55 |
67 return value; | 67 return value; |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 void ngx_md5_text(char *text, u_char *md5) | 72 void ngx_md5_text(u_char *text, u_char *md5) |
73 { | 73 { |
74 int i; | 74 int i; |
75 static char hex[] = "0123456789abcdef"; | 75 static u_char hex[] = "0123456789abcdef"; |
76 | 76 |
77 for (i = 0; i < 16; i++) { | 77 for (i = 0; i < 16; i++) { |
78 *text++ = hex[md5[i] >> 4]; | 78 *text++ = hex[md5[i] >> 4]; |
79 *text++ = hex[md5[i] & 0xf]; | 79 *text++ = hex[md5[i] & 0xf]; |
80 } | 80 } |