strftime fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2014 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
32716fbc25
commit
f7483ab7b1
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* lib/lib_strftime.c
|
* lib/lib_strftime.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -70,13 +70,13 @@
|
|||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
static const char *g_abbrevmonthname[12] =
|
static const char * const g_abbrevmonthname[12] =
|
||||||
{
|
{
|
||||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *g_monthname[12] =
|
static const char * const g_monthname[12] =
|
||||||
{
|
{
|
||||||
"January", "February", "March", "April", "May", "June",
|
"January", "February", "March", "April", "May", "June",
|
||||||
"July", "August", "September", "October", "November", "December"
|
"July", "August", "September", "October", "November", "December"
|
||||||
@ -163,12 +163,21 @@ size_t strftime(char *s, size_t max, const char *format, const struct tm *tm)
|
|||||||
|
|
||||||
/* Handle the format character */
|
/* Handle the format character */
|
||||||
|
|
||||||
|
format++;
|
||||||
len = 0;
|
len = 0;
|
||||||
value = 0;
|
|
||||||
str = "??";
|
|
||||||
|
|
||||||
switch (*++format)
|
switch (*format++)
|
||||||
{
|
{
|
||||||
|
/* %a: A three-letter abbreviation for the day of the week. */
|
||||||
|
/* %A: The full name for the day of the week. */
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
case 'A':
|
||||||
|
{
|
||||||
|
len = snprintf(dest, chleft, "Day"); /* Not supported */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/* %h: Equivalent to %b */
|
/* %h: Equivalent to %b */
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
|
@ -177,7 +177,7 @@ void fdwatch_uninitialize(struct fdwatch_s *fw)
|
|||||||
|
|
||||||
void fdwatch_add_fd(struct fdwatch_s *fw, int fd, void *client_data, int rw)
|
void fdwatch_add_fd(struct fdwatch_s *fw, int fd, void *client_data, int rw)
|
||||||
{
|
{
|
||||||
nvdbg("fd: %d\n", fd);
|
nvdbg("fd: %d client_data: %p\n", fd, client_data);
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
if (fd < CONFIG_NFILE_DESCRIPTORS ||
|
if (fd < CONFIG_NFILE_DESCRIPTORS ||
|
||||||
@ -347,11 +347,13 @@ int fdwatch_check_fd(struct fdwatch_s *fw, int fd)
|
|||||||
|
|
||||||
void *fdwatch_get_next_client_data(struct fdwatch_s *fw)
|
void *fdwatch_get_next_client_data(struct fdwatch_s *fw)
|
||||||
{
|
{
|
||||||
if (fw->next >= fw->nfds)
|
if (fw->next >= fw->nwatched)
|
||||||
{
|
{
|
||||||
ndbg("All client data returned: %d\n", fw->next);
|
nvdbg("All client data returned: %d\n", fw->next);
|
||||||
return NULL;
|
return (void*)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nvdbg("client_data[%d]: %p\n", fw->next, fw->client[fw->next].data);
|
||||||
return fw->client[fw->next++].data;
|
return fw->client[fw->next++].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,10 +372,10 @@ static void add_response(httpd_conn *hc, char *str)
|
|||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
resplen = hc->buflen + len;
|
resplen = hc->buflen + len;
|
||||||
DEBUGASSERT(resplen < CONFIG_THTTPD_IOBUFFERSIZE);
|
|
||||||
|
|
||||||
if (resplen > CONFIG_THTTPD_IOBUFFERSIZE)
|
if (resplen > CONFIG_THTTPD_IOBUFFERSIZE)
|
||||||
{
|
{
|
||||||
|
ndbg("resplen(%d) > buffer size(%d)\n", resplen, CONFIG_THTTPD_IOBUFFERSIZE);
|
||||||
resplen = CONFIG_THTTPD_IOBUFFERSIZE;
|
resplen = CONFIG_THTTPD_IOBUFFERSIZE;
|
||||||
len = resplen - hc->buflen;
|
len = resplen - hc->buflen;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user