Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit c7c095b

Browse files
Fix PR #26
1 parent 918a70e commit c7c095b

4 files changed

Lines changed: 16 additions & 13 deletions

File tree

binding.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"src/Main.cpp",
77
"src/DiffWorkerCallback.cpp",
88
"src/PatchWorkerCallback.cpp",
9+
"src/Util.cpp",
910
"src/c/bsdiff/bsdiff.c",
1011
"src/c/bspatch/bspatch.c",
1112
"src/c/bzip2/bzlib.c",

src/Main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ namespace bsdpNode {
2222
Nan::Callback *callback = new Nan::Callback(args[3].As<v8::Function>());
2323

2424
Nan::Utf8String param0(args[0]);
25-
#ifdef WIN32
25+
#ifdef _WIN32
2626
std::string oldfile = Utf8ToAnsi(*param0);
2727
#else
2828
std::string oldfile = std::string(*param0);
2929
#endif
3030

3131
Nan::Utf8String param1(args[1]);
32-
#ifdef WIN32
32+
#ifdef _WIN32
3333
std::string newfile = Utf8ToAnsi(*param1);
3434
#else
3535
std::string newfile = std::string(*param1);
3636
#endif
3737

3838
Nan::Utf8String param2(args[2]);
39-
#ifdef WIN32
39+
#ifdef _WIN32
4040
std::string patchfile = Utf8ToAnsi(*param2);
4141
#else
4242
std::string patchfile = std::string(*param2);
@@ -65,7 +65,7 @@ std::string patchfile = std::string(*param2);
6565
char error[1024];
6666
memset(error, 0, sizeof error);
6767

68-
#ifdef WIN32
68+
#ifdef _WIN32
6969
int ret = bsdiff(error, Utf8ToAnsi(*oldfile).c_str(), Utf8ToAnsi(*newfile).c_str(), Utf8ToAnsi(*patchfile).c_str(), nullptr, nullptr);
7070
#else
7171
int ret = bsdiff(error, *oldfile, *newfile, *patchfile, nullptr, nullptr);
@@ -86,21 +86,21 @@ std::string patchfile = std::string(*param2);
8686
Nan::Callback *callback = new Nan::Callback(args[3].As<v8::Function>());
8787

8888
Nan::Utf8String param0(args[0]);
89-
#ifdef WIN32
89+
#ifdef _WIN32
9090
std::string oldfile = Utf8ToAnsi(*param0);
9191
#else
9292
std::string oldfile = std::string(*param0);
9393
#endif
9494

9595
Nan::Utf8String param1(args[1]);
96-
#ifdef WIN32
96+
#ifdef _WIN32
9797
std::string newfile = Utf8ToAnsi(*param1);
9898
#else
9999
std::string newfile = std::string(*param1);
100100
#endif
101101

102102
Nan::Utf8String param2(args[2]);
103-
#ifdef WIN32
103+
#ifdef _WIN32
104104
std::string patchfile = Utf8ToAnsi(*param2);
105105
#else
106106
std::string patchfile = std::string(*param2);
@@ -128,7 +128,7 @@ std::string patchfile = std::string(*param2);
128128
char error[1024];
129129
memset(error, 0, sizeof error);
130130

131-
#ifdef WIN32
131+
#ifdef _WIN32
132132
int ret = bspatch(error, Utf8ToAnsi(*oldfile).c_str(), Utf8ToAnsi(*newfile).c_str(), Utf8ToAnsi(*patchfile).c_str(), nullptr, nullptr);
133133
#else
134134
int ret = bspatch(error, *oldfile, *newfile, *patchfile, nullptr, nullptr);

src/Util.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include "Util.hpp"
22

3+
#ifdef _WIN32
34
#include <Windows.h>
5+
#endif
46

57
namespace bsdpNode {
6-
#ifdef WIN32
8+
#ifdef _WIN32
79
std::string Utf8ToAnsi(const std::string& utf8str)
810
{
911
int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, utf8str.c_str(), strlen(utf8str.c_str()), NULL, 0);

src/Util.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#ifndef Uitl_H
2-
#define Uitl_H
1+
#ifndef Util_H
2+
#define Util_H
33

44
#include <string>
55

66
namespace bsdpNode {
7-
#ifdef WIN32
7+
#ifdef _WIN32
88
std::string Utf8ToAnsi(const std::string& utf8str);
99
#endif
1010
}
1111

12-
#endif // Uitl_H
12+
#endif // Util_H

0 commit comments

Comments
 (0)