[dss-commits] r8899 - in dss/trunk: . external/mongoose
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Mon Nov 9 16:50:28 CET 2009
Author: pstaehlin
Date: 2009-11-09 16:50:28 +0100 (Mon, 09 Nov 2009)
New Revision: 8899
Modified:
dss/trunk/CMakeLists.txt
dss/trunk/config.h.in
dss/trunk/external/mongoose/mongoose.c
dss/trunk/external/mongoose/mongoose.h
Log:
Made mg_send_file/mg_stat public functions.
I'll need to rework the patch for upstream but it should work
for us.
Modified: dss/trunk/CMakeLists.txt
===================================================================
--- dss/trunk/CMakeLists.txt 2009-11-09 08:40:50 UTC (rev 8898)
+++ dss/trunk/CMakeLists.txt 2009-11-09 15:50:28 UTC (rev 8899)
@@ -70,6 +70,8 @@
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckIncludeFileCXX)
+CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT)
+
CHECK_INCLUDE_FILES(dns_sd.h HAVE_DNS_SD)
CHECK_INCLUDE_FILES(avahi-client/publish.h HAVE_AVAHI)
Modified: dss/trunk/config.h.in
===================================================================
--- dss/trunk/config.h.in 2009-11-09 08:40:50 UTC (rev 8898)
+++ dss/trunk/config.h.in 2009-11-09 15:50:28 UTC (rev 8899)
@@ -4,6 +4,7 @@
#define DSS_VERSION "0.6-dev"
/* SpiderMonkey API header */
+#cmakedefine HAVE_STDINT
#cmakedefine HAVE_MOZJS_JSAPI_H
#cmakedefine HAVE_JS_JSAPI_H
#cmakedefine HAVE_LIBICAL_ICAL_H
Modified: dss/trunk/external/mongoose/mongoose.c
===================================================================
--- dss/trunk/external/mongoose/mongoose.c 2009-11-09 08:40:50 UTC (rev 8898)
+++ dss/trunk/external/mongoose/mongoose.c 2009-11-09 15:50:28 UTC (rev 8899)
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (c) 2004-2009 Sergey Lyubka
* Portions Copyright (c) 2009 Gilbert Wellisch
*
@@ -34,8 +34,7 @@
#include <signal.h>
#include <fcntl.h>
#endif /* !_WIN32_WCE */
-
-#include <time.h>
+
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
@@ -134,19 +133,6 @@
static int pthread_mutex_lock(pthread_mutex_t *);
static int pthread_mutex_unlock(pthread_mutex_t *);
-#if defined(HAVE_STDINT)
-#include <stdint.h>
-#else
-typedef unsigned int uint32_t;
-typedef unsigned short uint16_t;
-#if _MSC_VER > 1200
-typedef unsigned __int64 uint64_t;
-#else
-/* VC6 cannot cast double to unsigned __int64, needed by print_dir_entry() */
-typedef __int64 uint64_t;
-#endif /* _MSC_VER */
-#endif /* HAVE_STDINT */
-
/*
* POSIX dirent interface
*/
@@ -221,7 +207,6 @@
enum {FALSE, TRUE};
#endif /* !FALSE */
-typedef int bool_t;
typedef void * (*mg_thread_func_t)(void *);
static const char *http_500_error = "Internal Server Error";
@@ -340,15 +325,6 @@
size_t len;
};
-/*
- * Structure used by mg_stat() function. Uses 64 bit file length.
- */
-struct mgstat {
- bool_t is_directory; /* Directory marker */
- uint64_t size; /* File size */
- time_t mtime; /* Modification time */
-};
-
struct mg_option {
const char *name;
const char *description;
@@ -1073,7 +1049,7 @@
return (_wfopen(wbuf, wmode));
}
-static int
+int
mg_stat(const char *path, struct mgstat *stp)
{
int ok = -1; /* Error */
@@ -1323,7 +1299,7 @@
#else
-static int
+int
mg_stat(const char *path, struct mgstat *stp)
{
struct stat st;
@@ -2741,8 +2717,8 @@
/*
* Send regular file contents.
*/
-static void
-send_file(struct mg_connection *conn, const char *path, struct mgstat *stp)
+void
+mg_send_file(struct mg_connection *conn, const char *path, struct mgstat *stp)
{
char date[64], lm[64], etag[64], range[64];
const char *fmt = "%a, %d %b %Y %H:%M:%S %Z", *msg = "OK", *hdr;
@@ -3726,7 +3702,7 @@
} else if (is_not_modified(conn, &st)) {
send_error(conn, 304, "Not Modified", "");
} else {
- send_file(conn, path, &st);
+ mg_send_file(conn, path, &st);
}
}
Modified: dss/trunk/external/mongoose/mongoose.h
===================================================================
--- dss/trunk/external/mongoose/mongoose.h 2009-11-09 08:40:50 UTC (rev 8898)
+++ dss/trunk/external/mongoose/mongoose.h 2009-11-09 15:50:28 UTC (rev 8899)
@@ -25,8 +25,28 @@
#ifndef MONGOOSE_HEADER_INCLUDED
#define MONGOOSE_HEADER_INCLUDED
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
+#include <time.h>
+typedef int bool_t;
+#if defined(HAVE_STDINT)
+#include <stdint.h>
+#else
+typedef unsigned int uint32_t;
+typedef unsigned short uint16_t;
+#if _MSC_VER > 1200
+typedef unsigned __int64 uint64_t;
+#else
+/* VC6 cannot cast double to unsigned __int64, needed by print_dir_entry() */
+typedef __int64 uint64_t;
+#endif /* _MSC_VER */
+#endif /* HAVE_STDINT */
+
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -242,7 +262,19 @@
*/
const char *mg_version(void);
+/*
+ * Structure used by mg_stat() function. Uses 64 bit file length.
+ */
+struct mgstat {
+ bool_t is_directory; /* Directory marker */
+ uint64_t size; /* File size */
+ time_t mtime; /* Modification time */
+};
+int mg_stat(const char *path, struct mgstat *stp);
+void mg_send_file(struct mg_connection *conn, const char *path, struct mgstat *stp);
+
+
/*
* Print command line usage string.
*/
More information about the dss-commits
mailing list