summaryrefslogtreecommitdiff
path: root/shared/IFileOperation
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:42 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:08:42 +0200
commitc32707148292d104c66276b43796d6057c8c7a5d (patch)
treebb83513f4aff24153e21a4ec92e34e4c27651b1f /shared/IFileOperation
parent3.9 (diff)
downloadFreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.gz
FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.tar.bz2
FreeFileSync-c32707148292d104c66276b43796d6057c8c7a5d.zip
3.10
Diffstat (limited to 'shared/IFileOperation')
-rw-r--r--shared/IFileOperation/file_op.cpp32
-rw-r--r--shared/IFileOperation/file_op.h6
2 files changed, 16 insertions, 22 deletions
diff --git a/shared/IFileOperation/file_op.cpp b/shared/IFileOperation/file_op.cpp
index f37a2e66..6180a561 100644
--- a/shared/IFileOperation/file_op.cpp
+++ b/shared/IFileOperation/file_op.cpp
@@ -7,37 +7,31 @@
#include "file_op.h"
#include "../com_ptr.h"
#include "../com_error.h"
+#include "../c_dll.h"
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
#include <Shellapi.h> // Included for shell constants such as FO_* values
#include <shobjidl.h> // Required for necessary shell dependencies
-
+#include <comdef.h>
#include <algorithm>
#include <string>
#include <cstdio>
-#include <comdef.h>
-
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
-void writeString(const std::wstring& input, wchar_t* output, size_t outputBufferLen)
-{
- const size_t newSize = min(input.length() + 1, outputBufferLen); //including null-termination
- memcpy(output, input.c_str(), newSize * sizeof(wchar_t));
- output[newSize-1] = 0; //if output buffer is too small...
-}
+using namespace c_dll;
-namespace FileOp
+namespace fileop
{
std::wstring lastErrorMessage;
}
-bool FileOp::moveToRecycleBin(const wchar_t* fileNames[],
+bool fileop::moveToRecycleBin(const wchar_t* fileNames[],
size_t fileNo) //size of fileNames array
{
- using Util::ComPtr;
- using Util::generateErrorMsg;
+ using util::ComPtr;
+ using util::generateErrorMsg;
HRESULT hr;
// Create the IFileOperation interface
@@ -117,11 +111,11 @@ bool FileOp::moveToRecycleBin(const wchar_t* fileNames[],
}
-bool FileOp::copyFile(const wchar_t* sourceFile,
+bool fileop::copyFile(const wchar_t* sourceFile,
const wchar_t* targetFile)
{
- using Util::ComPtr;
- using Util::generateErrorMsg;
+ using util::ComPtr;
+ using util::generateErrorMsg;
HRESULT hr;
@@ -223,7 +217,7 @@ bool FileOp::copyFile(const wchar_t* sourceFile,
//if any of the functions above returns 'false', this message returns last error
-void FileOp::getLastError(wchar_t* errorMessage, size_t errorBufferLen)
+void fileop::getLastError(wchar_t* errorMessage, size_t errorBufferLen)
{
writeString(lastErrorMessage, errorMessage, errorBufferLen);
}
diff --git a/shared/IFileOperation/file_op.h b/shared/IFileOperation/file_op.h
index 8fa6a75b..97c75747 100644
--- a/shared/IFileOperation/file_op.h
+++ b/shared/IFileOperation/file_op.h
@@ -14,7 +14,7 @@
#endif
-namespace FileOp
+namespace fileop
{
//COM needs to be initialized before calling any of these functions! CoInitializeEx/CoUninitialize
@@ -32,8 +32,8 @@ void getLastError(wchar_t* errorMessage, size_t errorBufferLen);
//function typedefs
-typedef bool (*MoveToRecycleBinFct)(const wchar_t* fileNames[], size_t fileNo);
-typedef bool (*CopyFileFct)(const wchar_t* sourceFile, const wchar_t* targetFile);
+typedef bool (*MoveToRecycleBinFct)(const wchar_t* fileNames[], size_t fileNo);
+typedef bool (*CopyFileFct)(const wchar_t* sourceFile, const wchar_t* targetFile);
typedef void (*GetLastErrorFct)(wchar_t* errorMessage, size_t errorBufferLen);
//function names (use const pointers to ensure internal linkage)
bgstack15