diff --git a/tinyweb.h b/tinyweb.h index 1d32118..6503577 100644 --- a/tinyweb.h +++ b/tinyweb.h @@ -167,7 +167,7 @@ void tw_send_data(uv_stream_t* client, const void* data, size_t len, size_t need //u8data:utf-8编码的数据 //content_length:数据长度,为-1时自动计算(strlen) //respone_size:获取响应最终发送的数据长度,为0表示放不需要取此长度 -void tw_send_200_OK(uv_stream_t* client, const char* content_type, const void* u8data, int content_length, int* respone_size); +void tw_send_200_OK(uv_stream_t* client, const char* content_type, const void* u8data, size_t content_length, size_t* respone_size); //关闭客户端连接 void tw_close_client(uv_stream_t* client); diff --git a/tools.c b/tools.c index b3d899e..f0d3e27 100644 --- a/tools.c +++ b/tools.c @@ -213,8 +213,8 @@ inline struct _finddata_t GetFileInfo(const char* lpPath) { struct _finddata_t fileinfo; memset(&fileinfo, 0, sizeof(struct _finddata_t)); - HANDLE hFind = _findfirst(lpPath, &fileinfo); - FindClose(hFind); + intptr_t hFind = _findfirst(lpPath, &fileinfo); + _findclose(hFind); return fileinfo; } @@ -249,7 +249,7 @@ char* listDir(const char* fullpath, const char* reqPath) //文件(size>-1) 或 目录(size=-1) [name:"file1.txt",mtime:"2016-11-28 16:25:46",size:123],\r\n struct _finddatai64_t fdt; - HANDLE hFind; + intptr_t hFind; char szFind[256]; snprintf(szFind, 255, "%s\\*", fullpath); @@ -277,7 +277,7 @@ char* listDir(const char* fullpath, const char* reqPath) if (_findnexti64(hFind, &fdt)) break;//下一个文件 } - FindClose(hFind); + _findclose(hFind); //membuf_remove(&buf, buf.size-1, 1); buf.data[--buf.size] = 0; buf.data[--buf.size] = 0; membuf_append_format(&buf, "],total:%d}", fnum);