From cf88e025ab2dc2db139f3276f5c2fb2a0620b54f Mon Sep 17 00:00:00 2001 From: David Fries Date: Sat, 3 Nov 2012 15:49:25 -0500 Subject: [PATCH] typo fix, unused variable cleanup, etc motion.c bad spelling, to "an image" webhttpd.c consolidate the timeout to the top of the file as I needed to change it for testing --- jpegutils.c | 2 +- motion.c | 4 ++-- webhttpd.c | 9 ++++++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jpegutils.c b/jpegutils.c index 89980346..7447c9dc 100644 --- a/jpegutils.c +++ b/jpegutils.c @@ -818,7 +818,7 @@ int decode_jpeg_gray_raw(unsigned char *jpeg_data, int len, guarantee_huff_tables(&dinfo); jpeg_start_decompress (&dinfo); - vsf[0]= 1; vsf[1] = 1; vsf[2] = 1; + vsf[0] = 1; vsf[1] = 1; vsf[2] = 1; /* Height match image height or be exact twice the image height. */ diff --git a/motion.c b/motion.c index 072a8350..9b88b431 100644 --- a/motion.c +++ b/motion.c @@ -174,7 +174,7 @@ static void image_ring_destroy(struct context *cnt) /** * image_save_as_preview * - * This routine is called when we detect motion and want to save a image in the preview buffer + * This routine is called when we detect motion and want to save an image in the preview buffer * * Parameters: * @@ -2728,7 +2728,7 @@ int main (int argc, char **argv) SLEEP(1, 0); /* - * Calculate how many threads runnig or wants to run + * Calculate how many threads are running or wants to run * if zero and we want to finish, break out */ int motion_threads_running = 0; diff --git a/webhttpd.c b/webhttpd.c index 2b3a1333..d228e124 100644 --- a/webhttpd.c +++ b/webhttpd.c @@ -16,6 +16,9 @@ #include #include +/* Timeout in seconds, used for read and write */ +const int NONBLOCK_TIMEOUT = 1; + pthread_mutex_t httpd_mutex; // This is a dummy variable use to kill warnings when not checking sscanf and similar functions @@ -197,7 +200,7 @@ static ssize_t write_nonblock(int fd, const void *buf, size_t size) struct timeval tm; fd_set fds; - tm.tv_sec = 1; /* Timeout in seconds */ + tm.tv_sec = NONBLOCK_TIMEOUT; tm.tv_usec = 0; FD_ZERO(&fds); FD_SET(fd, &fds); @@ -223,7 +226,7 @@ static ssize_t read_nonblock(int fd ,void *buf, ssize_t size) struct timeval tm; fd_set fds; - tm.tv_sec = 1; /* Timeout in seconds */ + tm.tv_sec = NONBLOCK_TIMEOUT; /* Timeout in seconds */ tm.tv_usec = 0; FD_ZERO(&fds); FD_SET(fd, &fds); @@ -2509,7 +2512,7 @@ void httpd_run(struct context **cnt) while ((client_sent_quit_message) && (!closehttpd)) { - client_socket_fd = acceptnonblocking(sd, 1); + client_socket_fd = acceptnonblocking(sd, NONBLOCK_TIMEOUT); if (client_socket_fd < 0) { if ((!cnt[0]) || (cnt[0]->finish)) {