mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2026-05-12 21:05:44 +00:00
Fix compiling on MS VS 2022 (64-Bit) without type conversion warnings
This commit is contained in:
@@ -85,11 +85,11 @@ tftp_close(void* handle)
|
||||
static int
|
||||
tftp_read(void* handle, void* buf, int bytes)
|
||||
{
|
||||
int ret = fread(buf, 1, bytes, (FILE*)handle);
|
||||
if (ret <= 0) {
|
||||
size_t ret = fread(buf, 1, bytes, (FILE*)handle);
|
||||
if ((ret == 0) || (ret > INT_MAX)) {
|
||||
return -1;
|
||||
}
|
||||
return ret;
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -132,7 +132,7 @@ int process_sub(FILE *data_file, FILE *struct_file);
|
||||
int process_file(FILE *data_file, FILE *struct_file, const char *filename);
|
||||
int file_write_http_header(FILE *data_file, const char *filename, int file_size, u16_t *http_hdr_len,
|
||||
u16_t *http_hdr_chksum, u8_t provide_content_len, int is_compressed);
|
||||
int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i);
|
||||
int file_put_ascii(FILE *file, const char *ascii_string, size_t len, int *i);
|
||||
int s_put_ascii(char *buf, const char *ascii_string, int len, int *i);
|
||||
void concat_files(const char *file1, const char *file2, const char *targetfile);
|
||||
int check_path(char *path, size_t size);
|
||||
@@ -590,7 +590,7 @@ static u8_t *get_file_data(const char *filename, int *file_size, int can_be_comp
|
||||
LWIP_ASSERT("buf != NULL", buf != NULL);
|
||||
r = fread(buf, 1, fsize, inFile);
|
||||
LWIP_ASSERT("r == fsize", r == fsize);
|
||||
*file_size = fsize;
|
||||
*file_size = rs;
|
||||
*is_compressed = 0;
|
||||
#if MAKEFS_SUPPORT_DEFLATE
|
||||
overallDataBytes += fsize;
|
||||
@@ -715,6 +715,9 @@ static int write_checksums(FILE *struct_file, const char *varname,
|
||||
#if LWIP_TCP_TIMESTAMPS
|
||||
/* when timestamps are used, usable space is 12 bytes less per segment */
|
||||
chunk_size -= 12;
|
||||
#if TCP_MSS <= 12
|
||||
#error TCP_MSS <= 12
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fprintf(struct_file, "#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE);
|
||||
@@ -726,7 +729,7 @@ static int write_checksums(FILE *struct_file, const char *varname,
|
||||
i++;
|
||||
}
|
||||
src_offset = 0;
|
||||
for (offset = hdr_len; ; offset += len) {
|
||||
for (offset = hdr_len; ; offset += (int)len) {
|
||||
unsigned short chksum;
|
||||
const void *data = (const void *)&file_data[src_offset];
|
||||
len = LWIP_MIN(chunk_size, (int)file_size - src_offset);
|
||||
@@ -1281,9 +1284,12 @@ int file_write_http_header(FILE *data_file, const char *filename, int file_size,
|
||||
return written;
|
||||
}
|
||||
|
||||
int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i)
|
||||
int file_put_ascii(FILE *file, const char *ascii_string, size_t len, int *i)
|
||||
{
|
||||
int x;
|
||||
if (len > INT_MAX) {
|
||||
return -1;
|
||||
}
|
||||
size_t x;
|
||||
for (x = 0; x < len; x++) {
|
||||
unsigned char cur = ascii_string[x];
|
||||
fprintf(file, "0x%02x,", cur);
|
||||
@@ -1291,7 +1297,7 @@ int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i)
|
||||
fprintf(file, NEWLINE);
|
||||
}
|
||||
}
|
||||
return len;
|
||||
return (int)len;
|
||||
}
|
||||
|
||||
int s_put_ascii(char *buf, const char *ascii_string, int len, int *i)
|
||||
|
||||
@@ -1919,7 +1919,7 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre
|
||||
}
|
||||
|
||||
MEMCPY(secret, pcb->settings.passwd, len);
|
||||
*secret_len = len;
|
||||
*secret_len = (int)len;
|
||||
return 1;
|
||||
|
||||
#if 0 /* UNUSED */
|
||||
|
||||
@@ -480,7 +480,7 @@ static void chap_respond(ppp_pcb *pcb, int id,
|
||||
memset(secret, 0, secret_len);
|
||||
|
||||
clen = *outp;
|
||||
nlen = strlen(pcb->chap_client.name);
|
||||
nlen = (int)strlen(pcb->chap_client.name);
|
||||
memcpy(outp + clen + 1, pcb->chap_client.name, nlen);
|
||||
|
||||
outp = (u_char*)p->payload + PPP_HDRLEN;
|
||||
|
||||
@@ -289,7 +289,7 @@ int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
|
||||
if (fillch == '0' && prec >= 0) {
|
||||
n = prec;
|
||||
} else {
|
||||
n = strlen((const char *)p);
|
||||
n = (int)strlen((const char *)p);
|
||||
if (prec >= 0 && n > prec)
|
||||
n = prec;
|
||||
}
|
||||
@@ -378,7 +378,7 @@ int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args) {
|
||||
}
|
||||
len = num + sizeof(num) - 1 - str;
|
||||
} else {
|
||||
len = strlen(str);
|
||||
len = (int)strlen(str);
|
||||
if (prec >= 0 && len > prec)
|
||||
len = prec;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user