OSDN Git Service

If no item matches the current filter, hide all items and show an overlay message...
[lamexp/LameXP.git] / src / Encoder_Wave.cpp
index 859986a..97c0568 100644 (file)
@@ -1,6 +1,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -27,8 +27,6 @@
 #include <QDir>
 #include <Shellapi.h>
 
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#define min(a,b) (((a) < (b)) ? (a) : (b))
 #define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; }
 
 WaveEncoder::WaveEncoder(void)
@@ -66,14 +64,14 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
        size_t srcLen = wcslen(reinterpret_cast<const wchar_t*>(sourceFile.utf16())) + 3;
        wchar_t *srcBuffer = new wchar_t[srcLen];
        memset(srcBuffer, 0, srcLen * sizeof(wchar_t));
-       wcscpy_s(srcBuffer, srcLen, reinterpret_cast<const wchar_t*>(sourceFile.utf16()));
+       wcsncpy_s(srcBuffer, srcLen, reinterpret_cast<const wchar_t*>(sourceFile.utf16()), _TRUNCATE);
        FIX_SEPARATORS (srcBuffer);
        fileOperation.pFrom = srcBuffer;
 
        size_t outLen = wcslen(reinterpret_cast<const wchar_t*>(outputFile.utf16())) + 3;
        wchar_t *outBuffer = new wchar_t[outLen];
        memset(outBuffer, 0, outLen * sizeof(wchar_t));
-       wcscpy_s(outBuffer, outLen, reinterpret_cast<const wchar_t*>(outputFile.utf16()));
+       wcsncpy_s(outBuffer, outLen, reinterpret_cast<const wchar_t*>(outputFile.utf16()), _TRUNCATE);
        FIX_SEPARATORS (outBuffer);
        fileOperation.pTo = outBuffer;