~patch #6459: Changed file name variables to const; changed file size in httpd from u16_t to u32_t to allow file sizes > 64KB (fsdata.c file size is int)

This commit is contained in:
goldsimon 2008-03-27 18:33:18 +00:00
parent cc36b3df63
commit d0b500244b
4 changed files with 12 additions and 17 deletions

View File

@ -39,15 +39,15 @@
/*-----------------------------------------------------------------------------------*/
int
fs_open(char *name, struct fs_file *file)
fs_open(const char *name, struct fs_file *file)
{
struct fsdata_file_noconst *f;
const struct fsdata_file *f;
for(f = (struct fsdata_file_noconst *)FS_ROOT;
for(f = FS_ROOT;
f != NULL;
f = (struct fsdata_file_noconst *)f->next) {
if (!strcmp(name, (char *)f->name)) {
file->data = (char *)f->data;
f = f->next) {
if (!strcmp(name, (const char*)f->name)) {
file->data = f->data;
file->len = f->len;
return 1;
}

View File

@ -33,12 +33,12 @@
#define __FS_H__
struct fs_file {
char *data;
const unsigned char *data;
int len;
};
/* file must be allocated by caller and will be filled in
by the function. */
int fs_open(char *name, struct fs_file *file);
int fs_open(const char *name, struct fs_file *file);
#endif /* __FS_H__ */

View File

@ -39,11 +39,4 @@ struct fsdata_file {
const int len;
};
struct fsdata_file_noconst {
struct fsdata_file *next;
unsigned char *name;
unsigned char *data;
int len;
};
#endif /* __FSDATA_H__ */

View File

@ -41,8 +41,8 @@
#include "fs.h"
struct http_state {
char *file;
u16_t left;
u32_t left;
const unsigned char *file;
u8_t retries;
};
@ -80,6 +80,7 @@ send_data(struct tcp_pcb *pcb, struct http_state *hs)
len = tcp_sndbuf(pcb);
} else {
len = hs->left;
LWIP_ASSERT((len == hs->left), "hs->left did not fit into u16_t!");
}
do {
@ -176,6 +177,7 @@ http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
}
hs->file = file.data;
LWIP_ASSERT((file.len >= 0), "File length must be positive!");
hs->left = file.len;
/* printf("data %p len %ld\n", hs->file, hs->left);*/