From 9d32b9cd791fb5f51dad17567152c70a8511a500 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 25 Jul 2013 20:15:05 +0000 Subject: replace sprintf to mir_snprintf (part 6) git-svn-id: http://svn.miranda-ng.org/main/trunk@5485 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/HTTPServer/src/HttpUser.cpp | 38 +++++++++++-------------------------- plugins/HTTPServer/src/main.cpp | 4 ---- 2 files changed, 11 insertions(+), 31 deletions(-) (limited to 'plugins/HTTPServer') diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index e64656d93e..428a5cb087 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -231,7 +231,7 @@ void CLHttpUser::SendError(int iErrorCode, const char * pszError, const char * p pszDescription = pszError; char szBuf[1000]; - DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf) , + DWORD dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), "HTTP/1.1 %i %s\r\n" "Date: %s\r\n" "Server: MirandaWeb/%s\r\n" @@ -281,7 +281,7 @@ void CLHttpUser::SendRedir(int iErrorCode, const char * pszError, const char * p pszDescription = pszError; char szBuff[1000]; - DWORD dwBytesToWrite = mir_snprintf(szBuff, sizeof(szBuff) , + DWORD dwBytesToWrite = mir_snprintf(szBuff, sizeof(szBuff), "HTTP/1.1 %i %s\r\n" "Date: %s\r\n" "Server: MirandaWeb/%s\r\n" @@ -616,11 +616,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n" "\r\n"; - dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial , - szCurTime , + dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpPartial, + szCurTime, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - szETag , - dwDataToSend , + szETag, + dwDataToSend, pszGetMimeType(pszRealPath), dwFileStart, (dwFileStart + dwDataToSend - 1), @@ -638,11 +638,11 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { "Last-Modified: %s\r\n" "\r\n"; - dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk , - szCurTime , + dwBytesToWrite = mir_snprintf(szBuf, sizeof(szBuf), szHttpOk, + szCurTime, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), - szETag , - nDataSize , + szETag, + nDataSize, pszGetMimeType(pszRealPath), szFileTime); } @@ -671,11 +671,7 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { for (;;) { { DWORD dwCurTick = GetTickCount(); - if (dwCurTick - dwLastUpdate >= 1000) {/* - char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "Bytes tr %d Time %d Tick %d\n", dwCurrentDL - dwLastCurrentDL, dwCurTick - dwLastUpdate, dwCurTick ); - OutputDebugString( szTmp ); - */ + if (dwCurTick - dwLastUpdate >= 1000) { dwSpeed = ((dwCurrentDL - dwLastCurrentDL) * 1000) / (dwCurTick - dwLastUpdate); dwLastUpdate = dwCurTick; dwLastCurrentDL = dwCurrentDL; @@ -723,11 +719,6 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { dwLastResetTime = GetTickCount(); nMaxBytesToSend = nMaxUploadSpeed / nThreadCount; } - /* - char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "Current status : %d %% pos %d size %d\n", (dwCurrentDL * 100) / dwTotalSize, dwCurrentDL , dwTotalSize ); - OutputDebugString( szTmp ); - */ } // file is always closed in destructor @@ -738,13 +729,6 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { DeleteFile(szTempfile); } - /* - { - char szBuf[200]; - _snprintf( szBuf, sizeof( szBuf ), "File Transfer stoped %d transfer complete %d\n", GetTickCount(), dwCurrentDL == nDataSize); - OutputDebugString( szBuf ); - } - */ clCritSection.Lock(); nThreadCount--; diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index f71fe47ac0..3e476d40b8 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -602,10 +602,6 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) { return 0; bIsOnline = ((int)ack->lParam != ID_STATUS_AWAY && (int)ack->lParam != ID_STATUS_NA); - /* - char szTmp[200]; - _snprintf( szTmp, sizeof( szTmp ), "%s New status %d\n" ,ack->szModule, (int)bIsOnline); - OutputDebugString( szTmp );*/ return 0; } -- cgit v1.2.3