Skip to content

Commit 55bcbce

Browse files
committed
Compilation fix for x32
1 parent 89b6678 commit 55bcbce

12 files changed

Lines changed: 62 additions & 43 deletions

File tree

Source/FreeImage.hpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,22 +1567,22 @@ namespace fi
15671567
{
15681568
public:
15691569
// catch any exception to not cross DLL boundry
1570-
static const char* FormatProc(void* ctx) try { return unwrap(ctx).FormatProc(); } catch (...) { return nullptr; };
1571-
static const char* DescriptionProc(void* ctx) try { return unwrap(ctx).DescriptionProc(); } catch (...) { return nullptr; };
1572-
static const char* ExtensionListProc(void* ctx) try { return unwrap(ctx).ExtensionListProc(); } catch (...) { return nullptr; };
1573-
static const char* RegExprProc(void* ctx) try { return unwrap(ctx).RegExprProc(); } catch (...) { return nullptr; };
1574-
static void* OpenProc(void* ctx, FreeImageIO* io, fi_handle handle, FIBOOL read) try { return unwrap(ctx).OpenProc(io, handle, read); } catch (...) { return nullptr; };
1575-
static void CloseProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { unwrap(ctx).CloseProc(io, handle, data); } catch (...) { };
1576-
static uint32_t PageCountProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { return unwrap(ctx).PageCountProc(io, handle, data); } catch (...) { return 1U; };
1577-
static uint32_t PageCapabilityProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { return unwrap(ctx).PageCapabilityProc(io, handle, data); } catch (...) { return 1U; };
1578-
static FIBITMAP* LoadProc(void* ctx, FreeImageIO* io, fi_handle handle, uint32_t page, uint32_t flags, void* data) try { return unwrap(ctx).LoadProc(io, handle, page, flags, data); } catch (...) { return nullptr; };
1579-
static FIBOOL SaveProc(void* ctx, FreeImageIO* io, FIBITMAP* dib, fi_handle handle, uint32_t page, uint32_t flags, void* data) try { return unwrap(ctx).SaveProc(io, dib, handle, page, flags, data); } catch (...) { return FALSE; };
1580-
static FIBOOL ValidateProc(void* ctx, FreeImageIO* io, fi_handle handle) try { return unwrap(ctx).ValidateProc(io, handle); } catch (...) { return FALSE; };
1581-
static const char* MimeProc(void* ctx) try { return unwrap(ctx).MimeProc(); } catch (...) { return nullptr; };
1582-
static FIBOOL SupportsExportBPPProc(void* ctx, uint32_t bpp) try { return unwrap(ctx).SupportsExportBPPProc(bpp); } catch (...) { return FALSE; };
1583-
static FIBOOL SupportsExportTypeProc(void* ctx, FREE_IMAGE_TYPE type) try { return unwrap(ctx).SupportsExportTypeProc(type); } catch (...) { return FALSE; };
1584-
static FIBOOL SupportsICCProfilesProc(void* ctx) try { return unwrap(ctx).SupportsICCProfilesProc(); } catch (...) { return FALSE; };
1585-
static FIBOOL SupportsNoPixelsProc(void* ctx) try { return unwrap(ctx).SupportsNoPixelsProc(); } catch (...) { return FALSE; };
1570+
static const char* DLL_CALLCONV FormatProc(void* ctx) try { return unwrap(ctx).FormatProc(); } catch (...) { return nullptr; };
1571+
static const char* DLL_CALLCONV DescriptionProc(void* ctx) try { return unwrap(ctx).DescriptionProc(); } catch (...) { return nullptr; };
1572+
static const char* DLL_CALLCONV ExtensionListProc(void* ctx) try { return unwrap(ctx).ExtensionListProc(); } catch (...) { return nullptr; };
1573+
static const char* DLL_CALLCONV RegExprProc(void* ctx) try { return unwrap(ctx).RegExprProc(); } catch (...) { return nullptr; };
1574+
static void* DLL_CALLCONV OpenProc(void* ctx, FreeImageIO* io, fi_handle handle, FIBOOL read) try { return unwrap(ctx).OpenProc(io, handle, read); } catch (...) { return nullptr; };
1575+
static void DLL_CALLCONV CloseProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { unwrap(ctx).CloseProc(io, handle, data); } catch (...) { };
1576+
static uint32_t DLL_CALLCONV PageCountProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { return unwrap(ctx).PageCountProc(io, handle, data); } catch (...) { return 1U; };
1577+
static uint32_t DLL_CALLCONV PageCapabilityProc(void* ctx, FreeImageIO* io, fi_handle handle, void* data) try { return unwrap(ctx).PageCapabilityProc(io, handle, data); } catch (...) { return 1U; };
1578+
static FIBITMAP* DLL_CALLCONV LoadProc(void* ctx, FreeImageIO* io, fi_handle handle, uint32_t page, uint32_t flags, void* data) try { return unwrap(ctx).LoadProc(io, handle, page, flags, data); } catch (...) { return nullptr; };
1579+
static FIBOOL DLL_CALLCONV SaveProc(void* ctx, FreeImageIO* io, FIBITMAP* dib, fi_handle handle, uint32_t page, uint32_t flags, void* data) try { return unwrap(ctx).SaveProc(io, dib, handle, page, flags, data); } catch (...) { return FALSE; };
1580+
static FIBOOL DLL_CALLCONV ValidateProc(void* ctx, FreeImageIO* io, fi_handle handle) try { return unwrap(ctx).ValidateProc(io, handle); } catch (...) { return FALSE; };
1581+
static const char* DLL_CALLCONV MimeProc(void* ctx) try { return unwrap(ctx).MimeProc(); } catch (...) { return nullptr; };
1582+
static FIBOOL DLL_CALLCONV SupportsExportBPPProc(void* ctx, uint32_t bpp) try { return unwrap(ctx).SupportsExportBPPProc(bpp); } catch (...) { return FALSE; };
1583+
static FIBOOL DLL_CALLCONV SupportsExportTypeProc(void* ctx, FREE_IMAGE_TYPE type) try { return unwrap(ctx).SupportsExportTypeProc(type); } catch (...) { return FALSE; };
1584+
static FIBOOL DLL_CALLCONV SupportsICCProfilesProc(void* ctx) try { return unwrap(ctx).SupportsICCProfilesProc(); } catch (...) { return FALSE; };
1585+
static FIBOOL DLL_CALLCONV SupportsNoPixelsProc(void* ctx) try { return unwrap(ctx).SupportsNoPixelsProc(); } catch (...) { return FALSE; };
15861586

15871587
static void DLL_CALLCONV ReleaseProc(void* ctx) {
15881588
delete static_cast<Plugin2Wrapper*>(ctx);

Source/FreeImage/BitmapAccess.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,12 +698,12 @@ FreeImage_SetThumbnail(FIBITMAP *dib, FIBITMAP *thumbnail) {
698698

699699
// ----------------------------------------------------------
700700

701-
FREE_IMAGE_COLOR_TYPE
701+
FREE_IMAGE_COLOR_TYPE DLL_CALLCONV
702702
FreeImage_GetColorType(FIBITMAP* dib) {
703703
return FreeImage_GetColorType2(dib, TRUE);
704704
}
705705

706-
FREE_IMAGE_COLOR_TYPE
706+
FREE_IMAGE_COLOR_TYPE DLL_CALLCONV
707707
FreeImage_GetColorType2(FIBITMAP* dib, FIBOOL scan_alpha) {
708708
FIRGBA8 *rgb;
709709

Source/FreeImage/Conversion.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
// ==========================================================
6363
// Utility functions declared in Utilities.h
6464

65-
FIBOOL SwapRedBlue32(FIBITMAP* dib) {
65+
FIBOOL DLL_CALLCONV
66+
SwapRedBlue32(FIBITMAP* dib) {
6667
if (FreeImage_GetImageType(dib) != FIT_BITMAP) {
6768
return FALSE;
6869
}
@@ -153,7 +154,7 @@ _convertCMYKtoRGBA(unsigned width, unsigned height, uint8_t* line_start, unsigne
153154
}
154155
}
155156

156-
FIBOOL
157+
FIBOOL DLL_CALLCONV
157158
ConvertCMYKtoRGBA(FIBITMAP* dib) {
158159
if (!FreeImage_HasPixels(dib)) {
159160
return FALSE;
@@ -302,7 +303,7 @@ _convertLABtoRGB(unsigned width, unsigned height, uint8_t* line_start, unsigned
302303
}
303304
}
304305

305-
FIBOOL
306+
FIBOOL DLL_CALLCONV
306307
ConvertLABtoRGB(FIBITMAP* dib) {
307308
if (!FreeImage_HasPixels(dib)) {
308309
return FALSE;
@@ -337,7 +338,7 @@ ConvertLABtoRGB(FIBITMAP* dib) {
337338

338339
// ----------------------------------------------------------
339340

340-
FIBITMAP*
341+
FIBITMAP* DLL_CALLCONV
341342
RemoveAlphaChannel(FIBITMAP* src) {
342343

343344
if (!FreeImage_HasPixels(src)) {

Source/FreeImage/ConversionColor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include "ConversionYUV.h"
1010

1111

12-
FIBITMAP* FreeImage_ConvertToColor(FIBITMAP* dib, FREE_IMAGE_COLOR_TYPE dst_color, int64_t fisrt_param, int64_t second_param)
12+
FIBITMAP* DLL_CALLCONV
13+
FreeImage_ConvertToColor(FIBITMAP* dib, FREE_IMAGE_COLOR_TYPE dst_color, int64_t fisrt_param, int64_t second_param)
1314
{
1415
(void)second_param;
1516
if (!FreeImage_HasPixels(dib)) {

Source/FreeImage/FreeImage.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ namespace {
193193

194194
} // namespace
195195

196-
uint32_t DLL_CALLCONV
196+
uint32_t DLL_CALLCONV
197197
FreeImage_GetDependenciesCount(void)
198198
try {
199199
return DependenciesTable::GetInstance().GetSize();
@@ -284,7 +284,8 @@ FreeImage_OutputMessageProc(int fif, const char *fmt, ...) {
284284
}
285285

286286

287-
DLL_API uint32_t DLL_CALLCONV FreeImage_AddProcessMessageFunction(void* ctx, FreeImage_ProcessMessageFunction func)
287+
uint32_t DLL_CALLCONV
288+
FreeImage_AddProcessMessageFunction(void* ctx, FreeImage_ProcessMessageFunction func)
288289
{
289290
static_assert(kMaxMessageProcessorsNumber < std::numeric_limits<uint32_t>::max() - 1);
290291
if (func == nullptr) {
@@ -310,7 +311,8 @@ DLL_API uint32_t DLL_CALLCONV FreeImage_AddProcessMessageFunction(void* ctx, Fre
310311
}
311312

312313

313-
FIBOOL FreeImage_RemoveProcessMessageFunction(uint32_t id)
314+
FIBOOL DLL_CALLCONV
315+
FreeImage_RemoveProcessMessageFunction(uint32_t id)
314316
{
315317
if (id == 0) {
316318
return FALSE;
@@ -334,7 +336,8 @@ FIBOOL FreeImage_RemoveProcessMessageFunction(uint32_t id)
334336
}
335337

336338

337-
void FreeImage_ProcessMessage(const FIMESSAGE* msg)
339+
void DLL_CALLCONV
340+
FreeImage_ProcessMessage(const FIMESSAGE* msg)
338341
{
339342
if (!msg) {
340343
return;
@@ -348,21 +351,24 @@ void FreeImage_ProcessMessage(const FIMESSAGE* msg)
348351
}
349352

350353

351-
FIMESSAGE* FreeImage_CreateMessage(FREE_IMAGE_FORMAT scope, FREE_IMAGE_SEVERITY severity, const char* what)
354+
FIMESSAGE* DLL_CALLCONV
355+
FreeImage_CreateMessage(FREE_IMAGE_FORMAT scope, FREE_IMAGE_SEVERITY severity, const char* what)
352356
{
353357
return new FIMESSAGE(scope, severity, what ? what : "Unknown");
354358
}
355359

356360

357-
void FreeImage_DeleteMessage(FIMESSAGE* msg)
361+
void DLL_CALLCONV
362+
FreeImage_DeleteMessage(FIMESSAGE* msg)
358363
{
359364
if (msg) {
360365
delete msg;
361366
}
362367
}
363368

364369

365-
FREE_IMAGE_FORMAT FreeImage_GetMessageScope(const FIMESSAGE* msg)
370+
FREE_IMAGE_FORMAT DLL_CALLCONV
371+
FreeImage_GetMessageScope(const FIMESSAGE* msg)
366372
{
367373
if (msg) {
368374
return msg->scope;
@@ -371,7 +377,8 @@ FREE_IMAGE_FORMAT FreeImage_GetMessageScope(const FIMESSAGE* msg)
371377
}
372378

373379

374-
FREE_IMAGE_SEVERITY FreeImage_GetMessageSeverity(const FIMESSAGE* msg)
380+
FREE_IMAGE_SEVERITY DLL_CALLCONV
381+
FreeImage_GetMessageSeverity(const FIMESSAGE* msg)
375382
{
376383
if (msg) {
377384
return msg->severity;
@@ -380,7 +387,8 @@ FREE_IMAGE_SEVERITY FreeImage_GetMessageSeverity(const FIMESSAGE* msg)
380387
}
381388

382389

383-
const char* FreeImage_GetMessageString(const FIMESSAGE* msg)
390+
const char* DLL_CALLCONV
391+
FreeImage_GetMessageString(const FIMESSAGE* msg)
384392
{
385393
if (msg) {
386394
return msg->text.c_str();

Source/FreeImage/Plugin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,15 +860,16 @@ FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif) {
860860
// =====================================================================
861861

862862

863-
int DLL_CALLCONV
863+
int DLL_CALLCONV
864864
FreeImage_GetFIFCount2() {
865865
if (auto& plugins = PluginsRegistrySingleton::Instance()) {
866866
return static_cast<int>(plugins->GetFifCount2());
867867
}
868868
return 0;
869869
}
870870

871-
FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromIndex(int idx) {
871+
FREE_IMAGE_FORMAT DLL_CALLCONV
872+
FreeImage_GetFIFFromIndex(int idx) {
872873
if (auto& plugins = PluginsRegistrySingleton::Instance()) {
873874
return plugins->GetFifFromIndex(idx);
874875
}

Source/FreeImage/SimpleTools.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#include <algorithm>
1010

1111

12-
FIBOOL FreeImage_FindMinMax(FIBITMAP* dib, double* min_brightness, double* max_brightness, void** min_ptr, void** max_ptr)
12+
FIBOOL DLL_CALLCONV
13+
FreeImage_FindMinMax(FIBITMAP* dib, double* min_brightness, double* max_brightness, void** min_ptr, void** max_ptr)
1314
{
1415
if (!FreeImage_HasPixels(dib)) {
1516
return FALSE;
@@ -174,7 +175,8 @@ namespace
174175

175176
} // namespace
176177

177-
FIBOOL FreeImage_FindMinMaxValue(FIBITMAP* dib, void* min_value, void* max_value)
178+
FIBOOL DLL_CALLCONV
179+
FreeImage_FindMinMaxValue(FIBITMAP* dib, void* min_value, void* max_value)
178180
{
179181
if (!FreeImage_HasPixels(dib)) {
180182
return FALSE;
@@ -263,7 +265,8 @@ FIBOOL FreeImage_FindMinMaxValue(FIBITMAP* dib, void* min_value, void* max_value
263265
}
264266

265267

266-
FIBOOL FreeImage_Fill(FIBITMAP* dib, const void* value_ptr, size_t value_size)
268+
FIBOOL DLL_CALLCONV
269+
FreeImage_Fill(FIBITMAP* dib, const void* value_ptr, size_t value_size)
267270
{
268271
if (!FreeImage_HasPixels(dib)) {
269272
return FALSE;

Source/FreeImage/tmoClamp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#include <memory>
1111
#include <limits>
1212

13-
FIBITMAP* FreeImage_TmoClamp(FIBITMAP* src, double max_value)
13+
FIBITMAP* DLL_CALLCONV
14+
FreeImage_TmoClamp(FIBITMAP* src, double max_value)
1415
{
1516
if (!FreeImage_HasPixels(src)) {
1617
return nullptr;

Source/FreeImage/tmoLinear.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ FIBOOL TmoLinearImpl(FIBITMAP* dst, FIBITMAP* src, double maxValue, double minBr
100100
}
101101

102102

103-
FIBITMAP* FreeImage_TmoLinear(FIBITMAP* src, double max_value, FREE_IMAGE_CVT_COLOR_PARAM yuv_standard)
103+
FIBITMAP* DLL_CALLCONV
104+
FreeImage_TmoLinear(FIBITMAP* src, double max_value, FREE_IMAGE_CVT_COLOR_PARAM yuv_standard)
104105
{
105106
if (!FreeImage_HasPixels(src)) {
106107
return nullptr;

Source/FreeImageToolkit/Colors.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,8 @@ namespace
785785
} // namespace
786786

787787

788-
FIBOOL FreeImage_MakeHistogram(FIBITMAP* dib, uint32_t binsNumber, void* outMinVal, void* outMaxVal, uint32_t* histR, uint32_t strideR, uint32_t* histG, uint32_t strideG, uint32_t* histB, uint32_t strideB, uint32_t* histL, uint32_t strideL)
788+
FIBOOL DLL_CALLCONV
789+
FreeImage_MakeHistogram(FIBITMAP* dib, uint32_t binsNumber, void* outMinVal, void* outMaxVal, uint32_t* histR, uint32_t strideR, uint32_t* histG, uint32_t strideG, uint32_t* histB, uint32_t strideB, uint32_t* histL, uint32_t strideL)
789790
{
790791
if (!FreeImage_HasPixels(dib) || binsNumber < 1) {
791792
return FALSE;
@@ -1506,7 +1507,8 @@ namespace
15061507

15071508
} // namespace
15081509

1509-
FIBOOL CastPixelValue(FREE_IMAGE_TYPE src_type, const void* src_pixel, FREE_IMAGE_TYPE dst_type, void* dst_pixel)
1510+
FIBOOL DLL_CALLCONV
1511+
CastPixelValue(FREE_IMAGE_TYPE src_type, const void* src_pixel, FREE_IMAGE_TYPE dst_type, void* dst_pixel)
15101512
{
15111513
if (!src_pixel || !dst_pixel) {
15121514
return FALSE;

0 commit comments

Comments
 (0)