summaryrefslogtreecommitdiff
path: root/nuttx/netutils/webserver/httpd-fs.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-20 20:32:33 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-11-20 20:32:33 +0000
commit78dd0de872d9bef518f3ef395b4913197e1b2077 (patch)
tree0af928d900e8e43c520f6b06248eb84177b6a56e /nuttx/netutils/webserver/httpd-fs.c
parent93c4e0321431ad4164eb37c26c532d187d0aa1ab (diff)
downloadpx4-nuttx-78dd0de872d9bef518f3ef395b4913197e1b2077.tar.gz
px4-nuttx-78dd0de872d9bef518f3ef395b4913197e1b2077.tar.bz2
px4-nuttx-78dd0de872d9bef518f3ef395b4913197e1b2077.zip
Several webserver bugs fixed
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@391 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/netutils/webserver/httpd-fs.c')
-rw-r--r--nuttx/netutils/webserver/httpd-fs.c74
1 files changed, 38 insertions, 36 deletions
diff --git a/nuttx/netutils/webserver/httpd-fs.c b/nuttx/netutils/webserver/httpd-fs.c
index d3fe35171..f479aabaa 100644
--- a/nuttx/netutils/webserver/httpd-fs.c
+++ b/nuttx/netutils/webserver/httpd-fs.c
@@ -60,23 +60,23 @@ static uint16 count[HTTPD_FS_NUMFILES];
static uint8 httpd_fs_strcmp(const char *str1, const char *str2)
{
- uint8 i;
- i = 0;
- loop:
-
- if(str2[i] == 0 ||
- str1[i] == '\r' ||
- str1[i] == '\n') {
- return 0;
- }
-
- if(str1[i] != str2[i]) {
- return 1;
- }
+ int i;
-
- ++i;
- goto loop;
+ i = 0;
+ for (;;)
+ {
+ if (str2[i] == 0 || str1[i] == '\r' || str1[i] == '\n')
+ {
+ return 0;
+ }
+
+ if (str1[i] != str2[i])
+ {
+ return 1;
+ }
+
+ i++;
+ }
}
int httpd_fs_open(const char *name, struct httpd_fs_file *file)
@@ -88,21 +88,21 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file)
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
f != NULL;
- f = (struct httpd_fsdata_file_noconst *)f->next) {
-
- if(httpd_fs_strcmp(name, f->name) == 0) {
- file->data = f->data;
- file->len = f->len;
+ f = (struct httpd_fsdata_file_noconst *)f->next)
+ {
+ if (httpd_fs_strcmp(name, f->name) == 0)
+ {
+ file->data = f->data;
+ file->len = f->len;
#if HTTPD_FS_STATISTICS
- ++count[i];
+ ++count[i];
#endif /* HTTPD_FS_STATISTICS */
- return 1;
- }
+ return 1;
+ }
#if HTTPD_FS_STATISTICS
- ++i;
+ ++i;
#endif /* HTTPD_FS_STATISTICS */
-
- }
+ }
return 0;
}
@@ -110,9 +110,10 @@ void httpd_fs_init(void)
{
#if HTTPD_FS_STATISTICS
uint16 i;
- for(i = 0; i < HTTPD_FS_NUMFILES; i++) {
- count[i] = 0;
- }
+ for(i = 0; i < HTTPD_FS_NUMFILES; i++)
+ {
+ count[i] = 0;
+ }
#endif /* HTTPD_FS_STATISTICS */
}
@@ -125,13 +126,14 @@ uint16 httpd_fs_count(char *name)
i = 0;
for(f = (struct httpd_fsdata_file_noconst *)HTTPD_FS_ROOT;
f != NULL;
- f = (struct httpd_fsdata_file_noconst *)f->next) {
-
- if(httpd_fs_strcmp(name, f->name) == 0) {
- return count[i];
+ f = (struct httpd_fsdata_file_noconst *)f->next)
+ {
+ if (httpd_fs_strcmp(name, f->name) == 0)
+ {
+ return count[i];
+ }
+ ++i;
}
- ++i;
- }
return 0;
}
#endif /* HTTPD_FS_STATISTICS */