# HG changeset patch # User Waqas Hussain # Date 1227804433 -18000 # Node ID 4089b62b510cd0493ffb55703394f94229e498cb # Parent 193f9dd64f17f44d488f5028c9c9014fb7281a35 Minor changes to C files (to prevent compiler warnings) diff -r 193f9dd64f17 -r 4089b62b510c util-src/encodings.c --- a/util-src/encodings.c Thu Nov 27 03:12:12 2008 +0000 +++ b/util-src/encodings.c Thu Nov 27 21:47:13 2008 +0500 @@ -3,7 +3,11 @@ * Lua library for base64, stringprep and idna encodings */ +// Newer MSVC compilers deprecate strcpy as unsafe, but we use it in a safe way +#define _CRT_SECURE_NO_DEPRECATE + #include +#include #include "lua.h" #include "lauxlib.h" @@ -51,9 +55,9 @@ char s[3]; switch (--n) { - case 3: s[2]=tuple; - case 2: s[1]=tuple >> 8; - case 1: s[0]=tuple >> 16; + case 3: s[2]=(char) tuple; + case 2: s[1]=(char) (tuple >> 8); + case 1: s[0]=(char) (tuple >> 16); } luaL_addlstring(b,s,n); } @@ -74,7 +78,7 @@ const char *p; default: p=strchr(code,c); if (p==NULL) return 0; - t[n++]= p-code; + t[n++]= (char) (p-code); if (n==4) { base64_decode(&b,t[0],t[1],t[2],t[3],4); diff -r 193f9dd64f17 -r 4089b62b510c util-src/hashes.c --- a/util-src/hashes.c Thu Nov 27 03:12:12 2008 +0000 +++ b/util-src/hashes.c Thu Nov 27 21:47:13 2008 +0500 @@ -26,7 +26,7 @@ int hex_out = lua_toboolean(L, 2); \ char hash[size]; \ char result[size*2]; \ - func(s, len, hash); \ + func((const unsigned char*)s, len, (unsigned char*)hash); \ if (hex_out) { \ toHex(hash, size, result); \ lua_pushlstring(L, result, size*2); \