Commit a2562082 by Carwyn

Fixes: 1. XP 下 CRT 库依赖不满足问题

parent 15c0d5d2
......@@ -19,13 +19,13 @@ HEADERS += \
fmapirelay.h \
fmhttpclient.h \
fmsockserver.h \
fmvdispctrl.h
fmvdispctrl.h \
include/fmutils/fmutils.hpp
INCLUDEPATH += include
LIBS += -lwinhttp -lws2_32
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/../FMVipTest/Debug
TARGET = FMVipDC
......@@ -33,3 +33,5 @@ CONFIG(debug, debug|release) {
DESTDIR = $$PWD/../FMVipTest/Release
TARGET = FMVipDC
}
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc -static -lpthread
......@@ -35,7 +35,7 @@ FMApiCfgPrivate::FMApiCfgPrivate(FMApiCfg *parent, LPCSTR file)
{
GetModuleFileNameA(NULL, _file, MAX_PATH);
LPSTR str_pos = strrchr(_file, FM_PATH_DELIM) + 1;
strcpy_s(_app_name, str_pos);
strcpy(_app_name, str_pos);
str_pos = strchr(_app_name, FM_DOT_DELIM);
*str_pos = 0;
......@@ -45,10 +45,10 @@ FMApiCfgPrivate::FMApiCfgPrivate(FMApiCfg *parent, LPCSTR file)
int suffix_len = strlen(file_suffix) + 1;
str_pos = strrchr(str_pos, FM_DOT_DELIM);
if (str_pos) {
strcpy_s(str_pos, suffix_len, file_suffix);
strcpy(str_pos, file_suffix);
}
} else {
strcpy_s(_file, file);
strcpy(_file, file);
}
InitializeCriticalSection(&_cfg_cs);
......
......@@ -68,7 +68,7 @@ INT FMApiRelay::_ParseRequest(LPSTR data)
FM_ARRAY_FREE(_request);
int len = buffer.GetSize() + 1;
_request = new char[len];
strcpy_s(_request, len, buffer.GetString());
strcpy(_request, buffer.GetString());
return FM_API_SUCCESS;
......@@ -85,7 +85,7 @@ BOOL FMApiRelay::_GetResponse( LPSTR &rsp, UINT &len )
_response = new char[l];
rsp = _response;
len = l;
strcpy_s(_response, len, resp);
strcpy(_response, resp);
return TRUE;
}
else {
......@@ -100,7 +100,7 @@ BOOL FMApiRelay::_SimpleResponse(int code, LPSTR &rsp, UINT &len)
_response = new char[len];
rsp = _response;
sprintf_s(rsp, len, "{\"statusCode\":%d, \"msg\":\"%s\"}", code, fm_error.at(code));
sprintf(rsp, "{\"statusCode\":%d, \"msg\":\"%s\"}", code, fm_error.at(code));
return TRUE;
}
......@@ -36,7 +36,7 @@ LPCTSTR GetLastErrorMsg(DWORD dwError = 0) {
(LPTSTR)&sys_buff, 0, NULL);
if (sys_buff) {
memset(buffer, 0, sizeof(buffer));
_tcscpy_s(buffer, sys_buff);
_tcscpy(buffer, sys_buff);
LocalFree(sys_buff);
}
......@@ -51,11 +51,11 @@ FMHttpClient::FMHttpClient( LPCWSTR url ) :
_port(80),
_is_file(false)
{
wcscpy_s(_version, L"HTTP/1.1");
wcscpy_s(_method_get, L"GET");
wcscpy_s(_method_post,8, L"POST");
wcscpy_s(_method_put, L"PUT");
wcscpy_s(_method_del, L"DELETE");
wcscpy(_version, L"HTTP/1.1");
wcscpy(_method_get, L"GET");
wcscpy(_method_post, L"POST");
wcscpy(_method_put, L"PUT");
wcscpy(_method_del, L"DELETE");
_method_map[FMHTTP_GET] = _method_get;
_method_map[FMHTTP_POST] = _method_post;
......@@ -90,11 +90,11 @@ FMHttpClient::FMHttpClient( LPCSTR url ) :
_port(80),
_is_file(false)
{
wcscpy_s(_version, L"HTTP/1.1");
wcscpy_s(_method_get, L"GET");
wcscpy_s(_method_post,8, L"POST");
wcscpy_s(_method_put, L"PUT");
wcscpy_s(_method_del, L"DELETE");
wcscpy(_version, L"HTTP/1.1");
wcscpy(_method_get, L"GET");
wcscpy(_method_post, L"POST");
wcscpy(_method_put, L"PUT");
wcscpy(_method_del, L"DELETE");
_method_map[FMHTTP_GET] = _method_get;
_method_map[FMHTTP_POST] = _method_post;
......@@ -178,13 +178,13 @@ BOOL FMHttpClient::_CrackUrl( LPWSTR url )
if (str_pos != NULL) {
int server_len = str_pos - urlComp.lpszHostName;
wcsncpy_s(_server, sizeof(_server), urlComp.lpszHostName, server_len);
wcsncpy(_server, urlComp.lpszHostName, server_len);
}
else {
wcscpy_s(_server, urlComp.lpszHostName);
wcscpy(_server, urlComp.lpszHostName);
}
wcscpy_s(_object, urlComp.lpszUrlPath);
wcscpy(_object, urlComp.lpszUrlPath);
_port = urlComp.nPort;
return bRet;
......@@ -271,7 +271,7 @@ const char* FMHttpClient::Read()
LPCWSTR sTmp = wcsstr(lpOutBuffer, L"Content-Type:");
if (sTmp) {
INT nLen = wcschr(sTmp, L'\r') - sTmp;
wcsncpy_s(_content_type, sizeof(_content_type), sTmp, nLen);
wcsncpy(_content_type, sTmp, nLen);
}
swscanf(sHttpStatus, L"%d", &_status);
......@@ -279,7 +279,7 @@ const char* FMHttpClient::Read()
sTmp = wcsstr(lpOutBuffer, L"Content-Length:");
if (sTmp) {
INT nLen = wcschr(sTmp, L'\r') - sTmp;
wcsncpy_s(sContentLen, sizeof(sContentLen), sTmp, nLen);
wcsncpy(sContentLen, sTmp, nLen);
LPCWSTR sContentLenTmp = wcschr(sContentLen, L':') + 1;
swscanf(sContentLenTmp, L"%ld", &dwContentLen);
}
......@@ -369,7 +369,7 @@ VOID FMHttpClient::_Save()
}
if (_status == 200 || _status == 206) {
_tfopen_s(&fTarget, _filename, fileMode);
fTarget = _tfopen(_filename, fileMode);
fwrite(_response._buffer.c_str(), sizeof(char), _response._total_bytes, fTarget);
fclose(fTarget);
}
......@@ -378,7 +378,7 @@ VOID FMHttpClient::_Save()
VOID FMHttpClient::SetHeaders(LPCWSTR headers)
{
if (headers) {
wcscpy_s(_headers, headers);
wcscpy(_headers, headers);
}
}
......
......@@ -138,7 +138,7 @@ public:
LPWSTR msg = new WCHAR[size];
memset((void*)msg, 0, size * sizeof(WCHAR));
vswprintf_s(msg, size, format, arg_ptr);
vswprintf(msg, format, arg_ptr);
int str_size = WideCharToMultiByte(CP_ACP, 0, msg, -1, NULL, 0, NULL, NULL);
if (str_size > 0) {
......@@ -184,7 +184,7 @@ public:
LPSTR msg = new CHAR[size];
memset((void*)msg, 0, size);
vsprintf_s(msg, size, format, arg_ptr);
vsprintf(msg, format, arg_ptr);
_Log(msg);
delete []msg;
......@@ -216,7 +216,7 @@ private:
SYSTEMTIME st;
GetLocalTime(&st);
CHAR timestamp[32] = { 0 };
sprintf_s(timestamp, "%04d-%02d-%02d %02d:%02d:%02d %03d => ", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
sprintf(timestamp, "%04d-%02d-%02d %02d:%02d:%02d %03d => ", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
if (0 == _fp) {
printf(timestamp);
printf(msg);
......@@ -247,7 +247,7 @@ private:
path_start = strrchr(path_start, '\\');
*path_start = '\0';
LPSTR module = ++path_start;
sprintf_s(_filename, "%s\\log\\%s_%04d%02d%02d%02d%02d_pid_%ld.log", path, module, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, GetCurrentProcessId());
sprintf(_filename, "%s\\log\\%s_%04d%02d%02d%02d%02d_pid_%ld.log", path, module, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, GetCurrentProcessId());
return _filename;
}
......@@ -255,11 +255,11 @@ private:
VOID _DeleteExpiredLogs()
{
CHAR log_path[MAX_PATH] = { 0 };
strcpy_s(log_path, _filename);
strcpy(log_path, _filename);
CHAR *str_pos = strrchr(log_path, '\\');
if (str_pos) {
*++str_pos = '\0';
strcat_s(log_path, "*");
strcat(log_path, "*");
DWORD dwStatus = 0;
WIN32_FIND_DATAA findFileData;
......@@ -296,7 +296,7 @@ private:
est.wDayOfWeek = 0;
if (est.wYear > 0 || est.wMonth > 0 || est.wDay > 3) {
*str_pos = '\0';
strcat_s(log_path, findFileData.cFileName);
strcat(log_path, findFileData.cFileName);
DeleteFileA(log_path);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment