fix(http_loop): correctly parse content-type
parent
f97de2fe83
commit
13b20715bf
|
@ -4,6 +4,18 @@
|
|||
#include "http_loop.h"
|
||||
#include "lander.h"
|
||||
|
||||
// Just a naive pow implementation; might improve later
|
||||
static uint64_t ipow(uint64_t base, uint64_t power) {
|
||||
uint64_t res = 1;
|
||||
|
||||
while (power > 0) {
|
||||
res *= base;
|
||||
power--;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* Converts a string to a number, returning true if the string contained a valid
|
||||
* positive number.
|
||||
|
@ -18,7 +30,7 @@ static bool string_to_num(size_t *res, const char *s, size_t len) {
|
|||
return false;
|
||||
}
|
||||
|
||||
*res += val * (int)pow(10, (len - 1) - i);
|
||||
*res += (uint64_t)val * ipow(10, (len - 1) - i);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue