summaryrefslogtreecommitdiff
path: root/HTTPServer/IndexXML.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'HTTPServer/IndexXML.cpp')
-rw-r--r--HTTPServer/IndexXML.cpp31
1 files changed, 12 insertions, 19 deletions
diff --git a/HTTPServer/IndexXML.cpp b/HTTPServer/IndexXML.cpp
index 6806670..634ce72 100644
--- a/HTTPServer/IndexXML.cpp
+++ b/HTTPServer/IndexXML.cpp
@@ -15,16 +15,9 @@
//along with this program; if not, write to the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#ifdef NDEBUG //release
-#include "AggressiveOptimize.h" //create small code
-#endif
-
#include "HttpUser.h"
#include "MimeHandling.h"
#include "GuiElements.h"
-#include "Glob.h"
-#include <stdio.h>
-#include <time.h>
#include "IndexCreation.h"
@@ -78,7 +71,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
strcpy(szMask, pszRealPath);
strcat(szMask, "*");
- WIN32_FIND_DATAA fdFindFileData;
+ WIN32_FIND_DATA fdFindFileData;
HANDLE hFind = FindFirstFile(szMask, &fdFindFileData);
if (hFind == INVALID_HANDLE_VALUE)
@@ -133,7 +126,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
// Write dirname
ReplaceSign(szFileName, MAX_PATH, '&', "&amp;");
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <dirname>%s</dirname>\r\n", szFileName);
WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL);
@@ -148,7 +141,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
ReplaceSign(szFileName, MAX_PATH, '&', "&amp;");
if (fdFindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
} else {
pszExt = strrchr(szFileName, '.');
@@ -158,24 +151,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
pszExt++;
}
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
szFileName, (pszExt == NULL) ? "" : pszExt, fdFindFileData.nFileSizeLow);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&fdFindFileData.ftCreationTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"created=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
FileTimeToSystemTime(&fdFindFileData.ftLastWriteTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"modified=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
}
@@ -202,7 +195,7 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
if (pclCur->bIsDirectory()) {
szFileName[strlen(szFileName)-1] = '\0';
if (!strchr(szFileName, '/')) { // only one level deeper
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" isdir=\"true\"/>\r\n", szFileName);
if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))
@@ -230,24 +223,24 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
CloseHandle(hFileS);
}
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
" <item name=\"%s\" ext=\"%s\" size=\"%i\" ",
szFileName, (pszExt == NULL) ? "" : pszExt, dwFileSize);
SYSTEMTIME systemTime;
FileTimeToSystemTime(&ftFileCreateTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"created=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
FileTimeToSystemTime(&ftFileModifyTime, &systemTime);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"modified=\"%i/%02i/%02i %i:%02i:%02i\" ",
systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour,
systemTime.wMinute, systemTime.wSecond);
- pszBuffer += _snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
+ pszBuffer += mir_snprintf(pszBuffer, BUFFER_SIZE - (pszBuffer - szBuffer),
"/>\r\n");
if (!WriteFile(hFile, szBuffer, pszBuffer - szBuffer, &dwBytesWritten, NULL))