From b83f884f1e282bfc32866828bc25648c29d48794 Mon Sep 17 00:00:00 2001 From: Ian Holsman Date: Mon, 4 Feb 2002 04:43:34 +0000 Subject: [PATCH] make it compile on win32 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93214 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/cache_util.c | 22 +++++++-------- modules/experimental/mod_cache.h | 40 +++++++++++++++++++++------ modules/experimental/mod_disk_cache.c | 5 ++++ 3 files changed, 47 insertions(+), 20 deletions(-) diff --git a/modules/experimental/cache_util.c b/modules/experimental/cache_util.c index 4d16b880b8..9d80d030ff 100644 --- a/modules/experimental/cache_util.c +++ b/modules/experimental/cache_util.c @@ -65,7 +65,7 @@ /* -------------------------------------------------------------- */ /* return true if the request is conditional */ -int ap_cache_request_is_conditional(request_rec *r) +CACHE_DECLARE(int) ap_cache_request_is_conditional(request_rec *r) { if (apr_table_get(r->headers_in, "If-Match") || apr_table_get(r->headers_in, "If-None-Match") || @@ -79,7 +79,7 @@ int ap_cache_request_is_conditional(request_rec *r) /* remove other filters from filter stack */ -void ap_cache_reset_output_filters(request_rec *r) +CACHE_DECLARE(void) ap_cache_reset_output_filters(request_rec *r) { ap_filter_t *f = r->output_filters; @@ -97,9 +97,9 @@ void ap_cache_reset_output_filters(request_rec *r) } } -const char *ap_cache_get_cachetype(request_rec *r, - cache_server_conf *conf, - const char *url) +CACHE_DECLARE(const char *)ap_cache_get_cachetype(request_rec *r, + cache_server_conf *conf, + const char *url) { const char *type = NULL; int i; @@ -139,7 +139,7 @@ const char *ap_cache_get_cachetype(request_rec *r, * The return returns 1 if the token val is found in the list, or 0 * otherwise. */ -int ap_cache_liststr(const char *list, const char *key, char **val) +CACHE_DECLARE(int) ap_cache_liststr(const char *list, const char *key, char **val) { int len, i; char *p; @@ -183,7 +183,7 @@ int ap_cache_liststr(const char *list, const char *key, char **val) } /* return each comma separated token, one at a time */ -const char *ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str) +CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str) { apr_size_t i; const char *s; @@ -218,7 +218,7 @@ const char *ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str) /* * Converts apr_time_t hex digits to a time integer */ -apr_time_t ap_cache_hex2msec(const char *x) +CACHE_DECLARE(apr_time_t) ap_cache_hex2msec(const char *x) { int i, ch; apr_time_t j; @@ -238,7 +238,7 @@ apr_time_t ap_cache_hex2msec(const char *x) /* * Converts a time integer to apr_time_t hex digits */ -void ap_cache_msec2hex(apr_time_t j, char *y) +CACHE_DECLARE(void) ap_cache_msec2hex(apr_time_t j, char *y) { int i, ch; @@ -295,9 +295,9 @@ static void cache_hash(const char *it, char *val, int ndepth, int nlength) val[i + 22 - k] = '\0'; } -char *generate_name(apr_pool_t *p, int dirlevels, int dirlength, const char *name) +CACHE_DECLARE(char *)generate_name(apr_pool_t *p, int dirlevels, int dirlength, const char *name) { char hashfile[66]; cache_hash(name, hashfile, dirlevels, dirlength); return apr_pstrdup(p, hashfile); -} +} \ No newline at end of file diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h index 93e7c77aca..e68838e9f3 100644 --- a/modules/experimental/mod_cache.h +++ b/modules/experimental/mod_cache.h @@ -124,6 +124,27 @@ #define DEFAULT_CACHE_EXPIRE MSEC_ONE_HR #define DEFAULT_CACHE_LMFACTOR (0.1) +/* Create a set of PROXY_DECLARE(type), PROXY_DECLARE_NONSTD(type) and + * PROXY_DECLARE_DATA with appropriate export and import tags for the platform + */ +#if !defined(WIN32) +#define CACHE_DECLARE(type) type +#define CACHE_DECLARE_NONSTD(type) type +#define CACHE_DECLARE_DATA +#elif defined(CACHE_DECLARE_STATIC) +#define CACHE_DECLARE(type) type __stdcall +#define CACHE_DECLARE_NONSTD(type) type +#define CACHE_DECLARE_DATA +#elif defined(CACHE_DECLARE_EXPORT) +#define CACHE_DECLARE(type) __declspec(dllexport) type __stdcall +#define CACHE_DECLARE_NONSTD(type) __declspec(dllexport) type +#define CACHE_DECLARE_DATA __declspec(dllexport) +#else +#define CACHE_DECLARE(type) __declspec(dllimport) type __stdcall +#define CACHE_DECLARE_NONSTD(type) __declspec(dllimport) type +#define CACHE_DECLARE_DATA __declspec(dllimport) +#endif + struct cache_enable { const char *url; const char *type; @@ -211,15 +232,16 @@ typedef struct { /** * */ -apr_time_t ap_cache_hex2msec(const char *x); -void ap_cache_msec2hex(apr_time_t j, char *y); -char *generate_name(apr_pool_t *p, int dirlevels, int dirlength, - const char *name); -int ap_cache_request_is_conditional(request_rec *r); -void ap_cache_reset_output_filters(request_rec *r); -const char *ap_cache_get_cachetype(request_rec *r, cache_server_conf *conf, const char *url); -int ap_cache_liststr(const char *list, const char *key, char **val); -const char *ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str); +CACHE_DECLARE(apr_time_t) ap_cache_hex2msec(const char *x); +CACHE_DECLARE(void) ap_cache_msec2hex(apr_time_t j, char *y); +CACHE_DECLARE(char *) generate_name(apr_pool_t *p, int dirlevels, + int dirlength, + const char *name); +CACHE_DECLARE(int) ap_cache_request_is_conditional(request_rec *r); +CACHE_DECLARE(void) ap_cache_reset_output_filters(request_rec *r); +CACHE_DECLARE(const char *)ap_cache_get_cachetype(request_rec *r, cache_server_conf *conf, const char *url); +CACHE_DECLARE(int) ap_cache_liststr(const char *list, const char *key, char **val); +CACHE_DECLARE(const char *)ap_cache_tokstr(apr_pool_t *p, const char *list, const char **str); /** * cache_storage.c diff --git a/modules/experimental/mod_disk_cache.c b/modules/experimental/mod_disk_cache.c index 267f9402cf..a83858fe81 100644 --- a/modules/experimental/mod_disk_cache.c +++ b/modules/experimental/mod_disk_cache.c @@ -151,7 +151,12 @@ static apr_status_t file_cache_el_final(cache_info *info, cache_handle_t *h, req else { /* XXX log */ } +#ifdef WIN32 + /* XXX: win32 doesn't have a link */ + if (apr_file_copy(dobj->tempfile, info->datafile, APR_FILE_SOURCE_PERMS, r->pool) != APR_SUCCESS) { +#else if (link(dobj->tempfile, info->datafile) == -1) { +#endif /* XXX log */ } else { -- 2.40.0