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 a30934c..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,9 +27,6 @@
 #include <QDir>
 #include <Shellapi.h>
 
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define IS_UNICODE(STR) (qstricmp(STR.toUtf8().constData(), QString::fromLocal8Bit(STR.toLocal8Bit()).toUtf8().constData()))
 #define FIX_SEPARATORS(STR) for(int i = 0; STR[i]; i++) { if(STR[i] == L'/') STR[i] = L'\\'; }
 
 WaveEncoder::WaveEncoder(void)
@@ -46,6 +43,10 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
        memset(&fileOperation, 0, sizeof(SHFILEOPSTRUCTW));
        fileOperation.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMMKDIR | FOF_NOERRORUI | FOF_FILESONLY;
 
+       emit messageLogged(QString("Copy file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
+       fileOperation.wFunc = FO_COPY;
+
+       /*
        if(lamexp_temp_folder().compare(QFileInfo(sourceFile).canonicalPath(), Qt::CaseInsensitive) == 0)
        {
                //If the source is in the TEMP folder take shortcut and move the file
@@ -58,18 +59,19 @@ bool WaveEncoder::encode(const QString &sourceFile, const AudioFileModel &metaIn
                emit messageLogged(QString("Copy file \"%1\" to \"%2\"").arg(sourceFile, outputFile));
                fileOperation.wFunc = FO_COPY;
        }
+       */
        
        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;