Skip to content

Commit 9b71e12

Browse files
committed
misc src updates
1 parent bdf16d7 commit 9b71e12

File tree

14 files changed

+30
-21
lines changed

14 files changed

+30
-21
lines changed

src/common/classes/FpeControl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#define CLASSES_FPE_CONTROL_H
3131

3232
#include <math.h>
33-
#if defined(WIN_NT)
33+
#if defined(_MSC_VER)
3434
#include <float.h>
3535
#else
3636
#include <fenv.h>
@@ -78,7 +78,7 @@ class FpeControl
7878
}
7979
}
8080

81-
#if defined(WIN_NT)
81+
#if defined(_MSC_VER)
8282
static void maskAll() noexcept
8383
{
8484
_clearfp(); // always call _clearfp() before setting control word
@@ -215,7 +215,7 @@ class FpeControl
215215

216216
inline bool isNegativeInf(double x)
217217
{
218-
#ifdef WIN_NT
218+
#ifdef _MSC_VER
219219
return _fpclass(x) == _FPCLASS_NINF;
220220
#else
221221
return x == -INFINITY;

src/common/isc.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ class SecurityAttributes
147147
if (!InitializeSecurityDescriptor(p_security_desc, SECURITY_DESCRIPTOR_REVISION) ||
148148
!SetSecurityDescriptorDacl(p_security_desc, TRUE, NULL, FALSE))
149149
{
150-
delete p_security_desc;
150+
operator delete(p_security_desc);
151151
attributes.lpSecurityDescriptor = NULL;
152152
}
153153
}
154154

155155
~SecurityAttributes()
156156
{
157157
if (attributes.lpSecurityDescriptor)
158-
delete attributes.lpSecurityDescriptor;
158+
operator delete(attributes.lpSecurityDescriptor);
159159
}
160160

161161
operator LPSECURITY_ATTRIBUTES()

src/common/isc_sync.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,11 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
18471847
}
18481848

18491849
PathName mappedName;
1850+
#ifdef MINGW
1851+
if (!getMappedFileName(address, mappedName))
1852+
#else
18501853
if (!getMappedFileName(address, mappedName) || mappedName != expanded_filename)
1854+
#endif
18511855
{
18521856
UnmapViewOfFile(address);
18531857
CloseHandle(file_obj);
@@ -2096,7 +2100,7 @@ static const int DEFAULT_INTERLOCKED_SPIN_COUNT_SMP = 200;
20962100

20972101
static SLONG pid = 0;
20982102

2099-
typedef WINBASEAPI BOOL (WINAPI *pfnSwitchToThread) ();
2103+
typedef BOOL (WINAPI *pfnSwitchToThread) ();
21002104
static inline BOOL switchToThread()
21012105
{
21022106
static pfnSwitchToThread fnSwitchToThread = NULL;

src/common/os/guid.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Guid
6666
{
6767
// Some versions of MSVC cannot recognize hh specifier but MSVC 2015 has it
6868
static constexpr const char* GUID_FORMAT =
69-
"{%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}";
69+
"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}";
7070
static constexpr int GUID_FORMAT_ARGS = 11;
7171

7272
public:

src/common/unicode_util.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@
5656
using namespace Firebird;
5757

5858
namespace {
59-
#if defined(WIN_NT)
59+
#if defined(_MSC_VER)
6060
const char* const inTemplate = "icuin%s.dll";
6161
const char* const ucTemplate = "icuuc%s.dll";
62+
#elif defined(MINGW)
63+
const char* const inTemplate = "libicuin%s.dll";
64+
const char* const ucTemplate = "libicuuc%s.dll";
6265
#elif defined(DARWIN)
6366
const char* const inTemplate = "lib/libicui18n.%s.dylib";
6467
const char* const ucTemplate = "lib/libicuuc.%s.dylib";
@@ -1328,7 +1331,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()
13281331

13291332
for (int major = 79; major >= 3;)
13301333
{
1331-
#ifdef WIN_NT
1334+
#ifdef _MSC_VER
13321335
int minor = 0;
13331336
#else
13341337
int minor = 9;

src/common/utils_proto.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ namespace fb_utils
127127

128128
#if FB_INT64_COMPARE_FAILED
129129
// avoid compiler bug when comparing minimum INT64
130-
const SINT64 MININT64 = 0x8000000000000000;
131-
if (n1 == MININT64)
132-
return n2 == MININT64 ? 0 : 2;
133-
if (n2 == MININT64)
130+
const SINT64 minInt64 = 0x8000000000000000;
131+
if (n1 == minInt64)
132+
return n2 == minInt64 ? 0 : 2;
133+
if (n2 == minInt64)
134134
return -2;
135135
#endif
136136

src/gpre/languages/fbrmclib.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct date_fmt
8989
};
9090

9191
#ifdef __WIN32__
92-
#define EXPORT __declspec(dllexport)
92+
#define EXPORT extern __declspec(dllexport)
9393
#define CDECL __cdecl
9494
#else
9595
#define EXPORT

src/include/firebird.h

+2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@
6363
#include "../common/common.h"
6464
#endif
6565

66+
#if !defined(MINGW)
6667
#ifdef NULL
6768
#undef NULL
6869
#endif
6970

7071
#define NULL nullptr
72+
#endif
7173

7274
#if defined(WIN_NT)
7375
#define TRUSTED_AUTH

src/iscguard/iscguard.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ THREAD_ENTRY_DECLARE start_and_watch_server(THREAD_ENTRY_PARAM)
726726
}
727727

728728
// wait for process to terminate
729-
DWORD exit_status;
729+
DWORD exit_status = 0;
730730
if (service_flag)
731731
{
732732
while (WaitForSingleObject(procHandle, 500) == WAIT_OBJECT_0)

src/jrd/jrd.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8886,7 +8886,7 @@ namespace
88868886
THREAD_ENTRY_DECLARE attachmentShutdownThread(THREAD_ENTRY_PARAM arg)
88878887
{
88888888
#ifdef WIN_NT
8889-
ThreadModuleRef thdRef(attachmentShutdownThread, &engineShutdown);
8889+
ThreadModuleRef thdRef((void*)attachmentShutdownThread, &engineShutdown);
88908890
#endif
88918891

88928892
AttShutParams* params = static_cast<AttShutParams*>(arg);

src/remote/inet.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ static rem_port* listener_socket(rem_port* port, USHORT flag, const addrinfo* pa
12071207
forkEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
12081208
forkSockets = FB_NEW SocketsArray(*getDefaultMemoryPool());
12091209

1210-
Thread::start(forkThread, (void*) flag, THREAD_medium);
1210+
Thread::start(forkThread, (void*)(U_IPTR) flag, THREAD_medium);
12111211
}
12121212
forkSockets->add(s);
12131213
SetEvent(forkEvent);
@@ -3181,7 +3181,7 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
31813181
}
31823182
#endif
31833183
SSHORT n = send(port->port_handle, data, length, FB_SEND_FLAGS);
3184-
#if COMPRESS_DEBUG > 1
3184+
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
31853185
fprintf(stderr, "send(%d, %p, %d, FB_SEND_FLAGS) == %d\n", port->port_handle, data, length, n);
31863186
#endif
31873187
#ifdef DEBUG

src/remote/protocol.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ bool_t xdr_protocol(RemoteXdr* xdrs, PACKET* p)
293293
if (!xdr_enum(xdrs, reinterpret_cast<xdr_op*>(&p->p_operation)))
294294
return P_FALSE(xdrs, p);
295295

296-
#if COMPRESS_DEBUG > 1
296+
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
297297
if (xdrs->x_op != XDR_FREE)
298298
{
299299
fprintf(stderr, "operation=%d %c\n", p->p_operation,

src/remote/remote.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ bool REMOTE_deflate(RemoteXdr* xdrs, ProtoWrite* proto_write, PacketSend* packet
16341634
expectMoreOut = !strm.avail_out;
16351635
if ((port->port_buff_size != strm.avail_out) && (flush || !strm.avail_out))
16361636
{
1637-
#if COMPRESS_DEBUG > 1
1637+
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
16381638
fprintf(stderr, "Send packet %d bytes size\n", port->port_buff_size - strm.avail_out);
16391639
#endif
16401640
if (!packet_send(port, (SCHAR*) &port->port_compressed[REM_SEND_OFFSET(port->port_buff_size)],

src/yvalve/gds.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
#ifdef WIN_NT
106106
#include <shlobj.h>
107-
#if _MSC_VER <= 1500
107+
#if defined(_MSC_VER) && (_MSC_VER<=1500)
108108
#include <shfolder.h>
109109
#endif
110110
#define _WINSOCKAPI_

0 commit comments

Comments
 (0)