Skip to content

Commit

Permalink
misc src updates
Browse files Browse the repository at this point in the history
  • Loading branch information
raedrizqie committed Nov 16, 2024
1 parent bdf16d7 commit 9b71e12
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/common/classes/FpeControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define CLASSES_FPE_CONTROL_H

#include <math.h>
#if defined(WIN_NT)
#if defined(_MSC_VER)
#include <float.h>
#else
#include <fenv.h>
Expand Down Expand Up @@ -78,7 +78,7 @@ class FpeControl
}
}

#if defined(WIN_NT)
#if defined(_MSC_VER)
static void maskAll() noexcept
{
_clearfp(); // always call _clearfp() before setting control word
Expand Down Expand Up @@ -215,7 +215,7 @@ class FpeControl

inline bool isNegativeInf(double x)
{
#ifdef WIN_NT
#ifdef _MSC_VER
return _fpclass(x) == _FPCLASS_NINF;
#else
return x == -INFINITY;
Expand Down
4 changes: 2 additions & 2 deletions src/common/isc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ class SecurityAttributes
if (!InitializeSecurityDescriptor(p_security_desc, SECURITY_DESCRIPTOR_REVISION) ||
!SetSecurityDescriptorDacl(p_security_desc, TRUE, NULL, FALSE))
{
delete p_security_desc;
operator delete(p_security_desc);
attributes.lpSecurityDescriptor = NULL;
}
}

~SecurityAttributes()
{
if (attributes.lpSecurityDescriptor)
delete attributes.lpSecurityDescriptor;
operator delete(attributes.lpSecurityDescriptor);
}

operator LPSECURITY_ATTRIBUTES()
Expand Down
6 changes: 5 additions & 1 deletion src/common/isc_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,11 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
}

PathName mappedName;
#ifdef MINGW
if (!getMappedFileName(address, mappedName))
#else
if (!getMappedFileName(address, mappedName) || mappedName != expanded_filename)
#endif
{
UnmapViewOfFile(address);
CloseHandle(file_obj);
Expand Down Expand Up @@ -2096,7 +2100,7 @@ static const int DEFAULT_INTERLOCKED_SPIN_COUNT_SMP = 200;

static SLONG pid = 0;

typedef WINBASEAPI BOOL (WINAPI *pfnSwitchToThread) ();
typedef BOOL (WINAPI *pfnSwitchToThread) ();
static inline BOOL switchToThread()
{
static pfnSwitchToThread fnSwitchToThread = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/common/os/guid.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Guid
{
// Some versions of MSVC cannot recognize hh specifier but MSVC 2015 has it
static constexpr const char* GUID_FORMAT =
"{%08X-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}";
"{%08lX-%04hX-%04hX-%02hhX%02hhX-%02hhX%02hhX%02hhX%02hhX%02hhX%02hhX}";
static constexpr int GUID_FORMAT_ARGS = 11;

public:
Expand Down
7 changes: 5 additions & 2 deletions src/common/unicode_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@
using namespace Firebird;

namespace {
#if defined(WIN_NT)
#if defined(_MSC_VER)
const char* const inTemplate = "icuin%s.dll";
const char* const ucTemplate = "icuuc%s.dll";
#elif defined(MINGW)
const char* const inTemplate = "libicuin%s.dll";
const char* const ucTemplate = "libicuuc%s.dll";
#elif defined(DARWIN)
const char* const inTemplate = "lib/libicui18n.%s.dylib";
const char* const ucTemplate = "lib/libicuuc.%s.dylib";
Expand Down Expand Up @@ -1328,7 +1331,7 @@ UnicodeUtil::ConversionICU& UnicodeUtil::getConversionICU()

for (int major = 79; major >= 3;)
{
#ifdef WIN_NT
#ifdef _MSC_VER
int minor = 0;
#else
int minor = 9;
Expand Down
8 changes: 4 additions & 4 deletions src/common/utils_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ namespace fb_utils

#if FB_INT64_COMPARE_FAILED
// avoid compiler bug when comparing minimum INT64
const SINT64 MININT64 = 0x8000000000000000;
if (n1 == MININT64)
return n2 == MININT64 ? 0 : 2;
if (n2 == MININT64)
const SINT64 minInt64 = 0x8000000000000000;
if (n1 == minInt64)
return n2 == minInt64 ? 0 : 2;
if (n2 == minInt64)
return -2;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/gpre/languages/fbrmclib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ struct date_fmt
};

#ifdef __WIN32__
#define EXPORT __declspec(dllexport)
#define EXPORT extern __declspec(dllexport)
#define CDECL __cdecl
#else
#define EXPORT
Expand Down
2 changes: 2 additions & 0 deletions src/include/firebird.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@
#include "../common/common.h"
#endif

#if !defined(MINGW)
#ifdef NULL
#undef NULL
#endif

#define NULL nullptr
#endif

#if defined(WIN_NT)
#define TRUSTED_AUTH
Expand Down
2 changes: 1 addition & 1 deletion src/iscguard/iscguard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ THREAD_ENTRY_DECLARE start_and_watch_server(THREAD_ENTRY_PARAM)
}

// wait for process to terminate
DWORD exit_status;
DWORD exit_status = 0;
if (service_flag)
{
while (WaitForSingleObject(procHandle, 500) == WAIT_OBJECT_0)
Expand Down
2 changes: 1 addition & 1 deletion src/jrd/jrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8886,7 +8886,7 @@ namespace
THREAD_ENTRY_DECLARE attachmentShutdownThread(THREAD_ENTRY_PARAM arg)
{
#ifdef WIN_NT
ThreadModuleRef thdRef(attachmentShutdownThread, &engineShutdown);
ThreadModuleRef thdRef((void*)attachmentShutdownThread, &engineShutdown);
#endif

AttShutParams* params = static_cast<AttShutParams*>(arg);
Expand Down
4 changes: 2 additions & 2 deletions src/remote/inet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ static rem_port* listener_socket(rem_port* port, USHORT flag, const addrinfo* pa
forkEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
forkSockets = FB_NEW SocketsArray(*getDefaultMemoryPool());

Thread::start(forkThread, (void*) flag, THREAD_medium);
Thread::start(forkThread, (void*)(U_IPTR) flag, THREAD_medium);
}
forkSockets->add(s);
SetEvent(forkEvent);
Expand Down Expand Up @@ -3181,7 +3181,7 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng
}
#endif
SSHORT n = send(port->port_handle, data, length, FB_SEND_FLAGS);
#if COMPRESS_DEBUG > 1
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
fprintf(stderr, "send(%d, %p, %d, FB_SEND_FLAGS) == %d\n", port->port_handle, data, length, n);
#endif
#ifdef DEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/remote/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bool_t xdr_protocol(RemoteXdr* xdrs, PACKET* p)
if (!xdr_enum(xdrs, reinterpret_cast<xdr_op*>(&p->p_operation)))
return P_FALSE(xdrs, p);

#if COMPRESS_DEBUG > 1
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
if (xdrs->x_op != XDR_FREE)
{
fprintf(stderr, "operation=%d %c\n", p->p_operation,
Expand Down
2 changes: 1 addition & 1 deletion src/remote/remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ bool REMOTE_deflate(RemoteXdr* xdrs, ProtoWrite* proto_write, PacketSend* packet
expectMoreOut = !strm.avail_out;
if ((port->port_buff_size != strm.avail_out) && (flush || !strm.avail_out))
{
#if COMPRESS_DEBUG > 1
#if defined(COMPRESS_DEBUG) && COMPRESS_DEBUG > 1
fprintf(stderr, "Send packet %d bytes size\n", port->port_buff_size - strm.avail_out);
#endif
if (!packet_send(port, (SCHAR*) &port->port_compressed[REM_SEND_OFFSET(port->port_buff_size)],
Expand Down
2 changes: 1 addition & 1 deletion src/yvalve/gds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

#ifdef WIN_NT
#include <shlobj.h>
#if _MSC_VER <= 1500
#if defined(_MSC_VER) && (_MSC_VER<=1500)
#include <shfolder.h>
#endif
#define _WINSOCKAPI_
Expand Down

0 comments on commit 9b71e12

Please sign in to comment.