Fixed compiler warning for all and extra
This commit is contained in:
parent
5695b9ed82
commit
7a790b0bfa
|
|
@ -5,7 +5,14 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define OUT_OF_BOUNDS(base, pos, size) do {\
|
#define OUT_OF_BOUNDS(base, pos, size) do {\
|
||||||
if ((pos) - (base) + 1 > (size) )\
|
void *__base__ = (base);\
|
||||||
|
void *__pos__ = (pos);\
|
||||||
|
if (__pos__ < __base__) {\
|
||||||
|
fprintf(stderr, "%s:%d: Error: Out of bounds check with pos being lower then base.\n", __FILE__, __LINE__);\
|
||||||
|
return 1;\
|
||||||
|
}\
|
||||||
|
size_t __diff__ = (size_t) (__pos__ - __base__);\
|
||||||
|
if (__diff__ + 1 > (size) )\
|
||||||
{\
|
{\
|
||||||
fprintf(stderr, "%s:%d: Error: Expected more characters, but found the end of the request.\n", __FILE__, __LINE__);\
|
fprintf(stderr, "%s:%d: Error: Expected more characters, but found the end of the request.\n", __FILE__, __LINE__);\
|
||||||
return 1;\
|
return 1;\
|
||||||
|
|
|
||||||
|
|
@ -336,8 +336,8 @@ int http_parse_response_1_1(HTTP_Transport *t, HTTP_Response *res)
|
||||||
raw_res += 1; // consume '\n'
|
raw_res += 1; // consume '\n'
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
size_t diff = (size_t) (raw_res - base);
|
||||||
if(raw_res - base >= size - 1) {
|
if(diff >= size - 1) {
|
||||||
fprintf(stderr, "%s:%d: Unexpected end of HTTP response.\n", __FILE__, __LINE__);
|
fprintf(stderr, "%s:%d: Unexpected end of HTTP response.\n", __FILE__, __LINE__);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -398,7 +398,7 @@ int http_recv_header_1_1(HTTP_Transport *t, HTTP_Response *res)
|
||||||
if (r_count <= 0)
|
if (r_count <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
size_t old_size = raw_res->size;
|
size_t old_size = raw_res->size;
|
||||||
da_memcpy(raw_res, buffer, r_count);
|
da_memcpy(raw_res, buffer, (size_t)r_count);
|
||||||
if (old_size >= 3)
|
if (old_size >= 3)
|
||||||
search_index = old_size - 3;
|
search_index = old_size - 3;
|
||||||
else
|
else
|
||||||
|
|
@ -472,6 +472,7 @@ int http_transport_init(HTTP_Transport *t, HTTP_T_Kind kind)
|
||||||
|
|
||||||
int http_transport_free(HTTP_Transport *t)
|
int http_transport_free(HTTP_Transport *t)
|
||||||
{
|
{
|
||||||
|
(void)t;
|
||||||
fprintf(stderr, "%s:%d: Not Implemented: int http_transport_free(HTTP_Transport *t)\n", __FILE__, __LINE__);
|
fprintf(stderr, "%s:%d: Not Implemented: int http_transport_free(HTTP_Transport *t)\n", __FILE__, __LINE__);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -642,7 +643,7 @@ int http_request(
|
||||||
|
|
||||||
// Check for 'Host' Header and if not present, inject it with url host
|
// Check for 'Host' Header and if not present, inject it with url host
|
||||||
int has_host = 0;
|
int has_host = 0;
|
||||||
for (int i = 0 ; i < headers->size ; i++) {
|
for (size_t i = 0 ; i < headers->size ; i++) {
|
||||||
if(cmpstrcasei(headers->data[i].key, "Host") == 0) {
|
if(cmpstrcasei(headers->data[i].key, "Host") == 0) {
|
||||||
has_host = 1;
|
has_host = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue