fix windows platform compile error
This commit is contained in:
parent
8d46a84f08
commit
bd36129b83
@ -267,8 +267,9 @@ int http_get(lua_State* L)
|
|||||||
|
|
||||||
if (code != CURLE_OK)
|
if (code != CURLE_OK)
|
||||||
{
|
{
|
||||||
lua_pushnil(L);
|
|
||||||
char errorBuf[1024];
|
char errorBuf[1024];
|
||||||
|
|
||||||
|
lua_pushnil(L);
|
||||||
snprintf(errorBuf, sizeof(errorBuf) - 1, "%s\n%s\n", curl_easy_strerror(code), state.errorBuffer);
|
snprintf(errorBuf, sizeof(errorBuf) - 1, "%s\n%s\n", curl_easy_strerror(code), state.errorBuffer);
|
||||||
lua_pushstring(L, errorBuf);
|
lua_pushstring(L, errorBuf);
|
||||||
}
|
}
|
||||||
@ -297,10 +298,10 @@ int http_post(lua_State* L)
|
|||||||
string_init(&state.S);
|
string_init(&state.S);
|
||||||
if (curl)
|
if (curl)
|
||||||
{
|
{
|
||||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
|
||||||
|
|
||||||
size_t dataSize;
|
size_t dataSize;
|
||||||
const char* data = luaL_checklstring(L, 2, &dataSize);
|
const char* data = luaL_checklstring(L, 2, &dataSize);
|
||||||
|
|
||||||
|
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||||
if (data && dataSize > 0)
|
if (data && dataSize > 0)
|
||||||
{
|
{
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)dataSize);
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)dataSize);
|
||||||
@ -314,8 +315,9 @@ int http_post(lua_State* L)
|
|||||||
|
|
||||||
if (code != CURLE_OK)
|
if (code != CURLE_OK)
|
||||||
{
|
{
|
||||||
lua_pushnil(L);
|
|
||||||
char errorBuf[1024];
|
char errorBuf[1024];
|
||||||
|
|
||||||
|
lua_pushnil(L);
|
||||||
snprintf(errorBuf, sizeof(errorBuf) - 1, "%s\n%s\n", curl_easy_strerror(code), state.errorBuffer);
|
snprintf(errorBuf, sizeof(errorBuf) - 1, "%s\n%s\n", curl_easy_strerror(code), state.errorBuffer);
|
||||||
lua_pushstring(L, errorBuf);
|
lua_pushstring(L, errorBuf);
|
||||||
}
|
}
|
||||||
|
@ -143,6 +143,12 @@ int http_download(lua_State* L);
|
|||||||
int zip_extract(lua_State* L);
|
int zip_extract(lua_State* L);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#ifndef snprintf
|
||||||
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Engine interface */
|
/* Engine interface */
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
Reference in New Issue
Block a user