1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_lua: Fix Windows compatibility issues and remove an unused variable. Thanks, Gregg!

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1422072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Gruno
2012-12-14 20:44:41 +00:00
parent 74708ea8f3
commit ff81e58f05
2 changed files with 11 additions and 10 deletions

View File

@@ -260,13 +260,13 @@ static int lua_apr_md5(lua_State *L)
/*~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/
union { union {
unsigned char chr[16]; unsigned char chr[16];
uint32_t num[4]; apr_uint32_t num[4];
} digest; } digest;
apr_md5_ctx_t md5; apr_md5_ctx_t md5;
const char* buffer; const char* buffer;
char* result; char* result;
char Rmd5[16]; char Rmd5[16];
uint32_t *md5X; apr_uint32_t *md5X;
size_t x,y; size_t x,y;
request_rec *r; request_rec *r;
/*~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/
@@ -285,7 +285,7 @@ static int lua_apr_md5(lua_State *L)
Rmd5[x + 3] = digest.chr[x]; Rmd5[x + 3] = digest.chr[x];
} }
md5X = (uint32_t *) Rmd5; md5X = (apr_uint32_t *) Rmd5;
sprintf(result, "%08x%08x%08x%08x", md5X[0], md5X[1], md5X[2], md5X[3]); sprintf(result, "%08x%08x%08x%08x", md5X[0], md5X[1], md5X[2], md5X[3]);
lua_pushstring(L, result); lua_pushstring(L, result);
return 1; return 1;
@@ -297,13 +297,13 @@ static int lua_apr_sha1(lua_State *L)
/*~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/
union { union {
unsigned char chr[16]; unsigned char chr[16];
uint32_t num[4]; apr_uint32_t num[4];
} digest; } digest;
apr_sha1_ctx_t sha1; apr_sha1_ctx_t sha1;
const char* buffer; const char* buffer;
char* result; char* result;
unsigned char Rsha1[20]; unsigned char Rsha1[20];
uint32_t *sha1X; apr_uint32_t *sha1X;
size_t x,y; size_t x,y;
request_rec *r; request_rec *r;
/*~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/
@@ -323,7 +323,7 @@ static int lua_apr_sha1(lua_State *L)
Rsha1[x + 3] = digest.chr[x]; Rsha1[x + 3] = digest.chr[x];
} }
sha1X = (uint32_t *) Rsha1; sha1X = (apr_uint32_t *) Rsha1;
sprintf(result, "%08x%08x%08x%08x%08x", sha1X[0], sha1X[1], sha1X[2], sha1X[3], sha1X[4]); sprintf(result, "%08x%08x%08x%08x%08x", sha1X[0], sha1X[1], sha1X[2], sha1X[3], sha1X[4]);
lua_pushstring(L, result); lua_pushstring(L, result);
return 1; return 1;
@@ -564,13 +564,14 @@ static int lua_ap_scoreboard_worker(lua_State *L)
lua_settable(L, -3); lua_settable(L, -3);
lua_pushstring(L, "tid"); lua_pushstring(L, "tid");
lua_pushnumber(L, ws_record->tid);
lua_pushinteger(L, (lua_Integer) ws_record->tid);
lua_settable(L, -3); lua_settable(L, -3);
lua_pushstring(L, "vhost"); lua_pushstring(L, "vhost");
lua_pushstring(L, ws_record->vhost); lua_pushstring(L, ws_record->vhost);
lua_settable(L, -3); lua_settable(L, -3);
#ifdef HAVE_TIMES
lua_pushstring(L, "stimes"); lua_pushstring(L, "stimes");
lua_pushnumber(L, ws_record->times.tms_stime); lua_pushnumber(L, ws_record->times.tms_stime);
lua_settable(L, -3); lua_settable(L, -3);
@@ -578,7 +579,7 @@ static int lua_ap_scoreboard_worker(lua_State *L)
lua_pushstring(L, "utimes"); lua_pushstring(L, "utimes");
lua_pushnumber(L, ws_record->times.tms_utime); lua_pushnumber(L, ws_record->times.tms_utime);
lua_settable(L, -3); lua_settable(L, -3);
#endif
return 1; return 1;
} }
return 0; return 0;

View File

@@ -224,7 +224,7 @@ static int req_parsebody(lua_State *L)
char *buffer, *key, *filename; char *buffer, *key, *filename;
char *start = 0, *end = 0, *crlf = 0; char *start = 0, *end = 0, *crlf = 0;
const char *data; const char *data;
int i, z; int i;
size_t vlen = 0; size_t vlen = 0;
size_t len = 0; size_t len = 0;
if (lua_read_body(r, &data, (apr_off_t*) &size) != OK) { if (lua_read_body(r, &data, (apr_off_t*) &size) != OK) {