Use int over size_t.
This commit is contained in:
parent
014ce0e988
commit
11bb4d8906
15
darkhttpd.c
15
darkhttpd.c
|
@ -751,19 +751,18 @@ static int mime_mapping_cmp_str(const void *a, const void *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *uri_content_type(const char *uri) {
|
static const char *uri_content_type(const char *uri) {
|
||||||
size_t period, urilen = strlen(uri);
|
int period, urilen = (int)strlen(uri);
|
||||||
|
|
||||||
period = urilen;
|
for (period = urilen - 1;
|
||||||
while ((period > 0) &&
|
(period > 0) && (uri[period] != '.') &&
|
||||||
(uri[period] != '.') &&
|
(urilen - period - 1 <= (int)longest_ext);
|
||||||
((urilen - period - 1) <= longest_ext))
|
period--)
|
||||||
period--;
|
;
|
||||||
|
|
||||||
if (uri[period] == '.') {
|
if ((period >= 0) && (uri[period] == '.')) {
|
||||||
struct mime_mapping *result =
|
struct mime_mapping *result =
|
||||||
bsearch((uri + period + 1), mime_map, mime_map_size,
|
bsearch((uri + period + 1), mime_map, mime_map_size,
|
||||||
sizeof(struct mime_mapping), mime_mapping_cmp_str);
|
sizeof(struct mime_mapping), mime_mapping_cmp_str);
|
||||||
|
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
assert(strcmp(uri + period + 1, result->extension) == 0);
|
assert(strcmp(uri + period + 1, result->extension) == 0);
|
||||||
return result->mimetype;
|
return result->mimetype;
|
||||||
|
|
Loading…
Reference in New Issue