Skip to content

Commit c82802d

Browse files
committed
C++ compiler support
1 parent f0ffdb3 commit c82802d

File tree

18 files changed

+112
-86
lines changed

18 files changed

+112
-86
lines changed

src/external/RGFW.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7727,8 +7727,8 @@ RGFW_bool RGFW_monitor_requestMode(RGFW_monitor mon, RGFW_monitorMode mode, RGFW
77277727
dm.dmBitsPerPel = (DWORD)(mode.red + mode.green + mode.blue);
77287728
}
77297729

7730-
if (ChangeDisplaySettingsEx(dd.DeviceName, &dm, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL) {
7731-
if (ChangeDisplaySettingsEx(dd.DeviceName, &dm, NULL, CDS_UPDATEREGISTRY, NULL) == DISP_CHANGE_SUCCESSFUL)
7730+
if (ChangeDisplaySettingsEx((LPCWSTR)dd.DeviceName, (DEVMODEW *)&dm, NULL, CDS_TEST, NULL) == DISP_CHANGE_SUCCESSFUL) {
7731+
if (ChangeDisplaySettingsEx((LPCWSTR)dd.DeviceName, (DEVMODEW *)&dm, NULL, CDS_UPDATEREGISTRY, NULL) == DISP_CHANGE_SUCCESSFUL)
77327732
return RGFW_TRUE;
77337733
return RGFW_FALSE;
77347734
} else return RGFW_FALSE;

src/external/glfw/src/context.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
359359
window->context.source = ctxconfig->source;
360360
window->context.client = GLFW_OPENGL_API;
361361

362-
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
362+
previous = (_GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
363363
glfwMakeContextCurrent((GLFWwindow*) window);
364364
if (_glfwPlatformGetTls(&_glfw.contextSlot) != window)
365365
return GLFW_FALSE;
@@ -620,7 +620,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
620620

621621
_GLFW_REQUIRE_INIT();
622622

623-
previous = _glfwPlatformGetTls(&_glfw.contextSlot);
623+
previous = (_GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
624624

625625
if (window && window->context.client == GLFW_NO_API)
626626
{
@@ -642,7 +642,7 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
642642
GLFWAPI GLFWwindow* glfwGetCurrentContext(void)
643643
{
644644
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
645-
return _glfwPlatformGetTls(&_glfw.contextSlot);
645+
return (GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
646646
}
647647

648648
GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
@@ -668,7 +668,7 @@ GLFWAPI void glfwSwapInterval(int interval)
668668

669669
_GLFW_REQUIRE_INIT();
670670

671-
window = _glfwPlatformGetTls(&_glfw.contextSlot);
671+
window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
672672
if (!window)
673673
{
674674
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
@@ -686,7 +686,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
686686

687687
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
688688

689-
window = _glfwPlatformGetTls(&_glfw.contextSlot);
689+
window = (_GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
690690
if (!window)
691691
{
692692
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
@@ -752,7 +752,7 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
752752

753753
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
754754

755-
window = _glfwPlatformGetTls(&_glfw.contextSlot);
755+
window = (_GLFWwindow *)_glfwPlatformGetTls(&_glfw.contextSlot);
756756
if (!window)
757757
{
758758
_glfwInputError(GLFW_NO_CURRENT_CONTEXT,
@@ -762,4 +762,3 @@ GLFWAPI GLFWglproc glfwGetProcAddress(const char* procname)
762762

763763
return window->context.getProcAddress(procname);
764764
}
765-

src/external/glfw/src/egl_context.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
118118
return GLFW_FALSE;
119119
}
120120

121-
nativeConfigs = _glfw_calloc(nativeCount, sizeof(EGLConfig));
121+
nativeConfigs = (EGLConfig*)_glfw_calloc(nativeCount, sizeof(EGLConfig));
122122
eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
123123

124-
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
124+
usableConfigs = (_GLFWfbconfig *)_glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
125125
usableCount = 0;
126126

127127
for (i = 0; i < nativeCount; i++)
@@ -308,7 +308,7 @@ static int extensionSupportedEGL(const char* extension)
308308

309309
static GLFWglproc getProcAddressEGL(const char* procname)
310310
{
311-
_GLFWwindow* window = _glfwPlatformGetTls(&_glfw.contextSlot);
311+
_GLFWwindow* window = (_GLFWwindow*)_glfwPlatformGetTls(&_glfw.contextSlot);
312312
assert(window != NULL);
313313

314314
if (window->context.egl.client)
@@ -908,4 +908,3 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
908908

909909
return window->context.egl.surface;
910910
}
911-

src/external/jar_mod.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ static bool jar_mod_load( jar_mod_context_t * modctx, void * mod_data, int mod_d
11481148
{
11491149
// 15 Samples modules support
11501150
// Shift the whole datas to make it look likes a standard 4 channels mod.
1151-
memcopy(&(modctx->song.signature), "M.K.", 4);
1151+
memcopy(&(modctx->song.signature), (void*)"M.K.", 4);
11521152
memcopy(&(modctx->song.length), &(modctx->song.samples[15]), 130);
11531153
memclear(&(modctx->song.samples[15]), 0, 480);
11541154
modmemory += 600;
@@ -1535,7 +1535,7 @@ mulong jar_mod_load_file(jar_mod_context_t * modctx, const char* filename)
15351535

15361536
if(fsize && fsize < 32*1024*1024)
15371537
{
1538-
modctx->modfile = JARMOD_MALLOC(fsize);
1538+
modctx->modfile = (muchar*) JARMOD_MALLOC(fsize);
15391539
modctx->modfilesize = fsize;
15401540
memset(modctx->modfile, 0, fsize);
15411541
fread(modctx->modfile, fsize, 1, f);

src/external/jar_xm.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ void jar_xm_generate_samples(jar_xm_context_t* ctx, float* output, size_t numsam
123123
// * @param output buffer of 2*numsamples elements (A left and right value for each sample)
124124
// * @param numsamples number of samples to generate
125125
void jar_xm_generate_samples_16bit(jar_xm_context_t* ctx, short* output, size_t numsamples) {
126-
float* musicBuffer = JARXM_MALLOC((2*numsamples)*sizeof(float));
126+
float* musicBuffer = (float*)JARXM_MALLOC((2*numsamples)*sizeof(float));
127127
jar_xm_generate_samples(ctx, musicBuffer, numsamples);
128128

129129
if(output){
@@ -136,7 +136,7 @@ void jar_xm_generate_samples_16bit(jar_xm_context_t* ctx, short* output, size_t
136136
// * @param output buffer of 2*numsamples elements (A left and right value for each sample)
137137
// * @param numsamples number of samples to generate
138138
void jar_xm_generate_samples_8bit(jar_xm_context_t* ctx, char* output, size_t numsamples) {
139-
float* musicBuffer = JARXM_MALLOC((2*numsamples)*sizeof(float));
139+
float* musicBuffer = (float*)JARXM_MALLOC((2*numsamples)*sizeof(float));
140140
jar_xm_generate_samples(ctx, musicBuffer, numsamples);
141141

142142
if(output){
@@ -543,7 +543,7 @@ int jar_xm_create_context_safe(jar_xm_context_t** ctxp, const char* moddata, siz
543543
#endif
544544

545545
bytes_needed = jar_xm_get_memory_needed_for_context(moddata, moddata_length);
546-
mempool = JARXM_MALLOC(bytes_needed);
546+
mempool = (char*)JARXM_MALLOC(bytes_needed);
547547
if(mempool == NULL && bytes_needed > 0) { /* JARXM_MALLOC() failed, trouble ahead */
548548
DEBUG("call to JARXM_MALLOC() failed, returned %p", (void*)mempool);
549549
return 2;
@@ -558,11 +558,11 @@ int jar_xm_create_context_safe(jar_xm_context_t** ctxp, const char* moddata, siz
558558

559559
ctx->rate = rate;
560560
mempool = jar_xm_load_module(ctx, moddata, moddata_length, mempool);
561-
mempool = ALIGN_PTR(mempool, 16);
561+
mempool = (char*)ALIGN_PTR(mempool, 16);
562562

563563
ctx->channels = (jar_xm_channel_context_t*)mempool;
564564
mempool += ctx->module.num_channels * sizeof(jar_xm_channel_context_t);
565-
mempool = ALIGN_PTR(mempool, 16);
565+
mempool = (char*)ALIGN_PTR(mempool, 16);
566566

567567
ctx->default_global_volume = 1.f;
568568
ctx->global_volume = ctx->default_global_volume;
@@ -583,7 +583,7 @@ int jar_xm_create_context_safe(jar_xm_context_t** ctxp, const char* moddata, siz
583583
ch->actual_panning = .5f;
584584
}
585585

586-
mempool = ALIGN_PTR(mempool, 16);
586+
mempool = (char*)ALIGN_PTR(mempool, 16);
587587
ctx->row_loop_count = (uint8_t *)mempool;
588588
mempool += MAX_NUM_ROWS * sizeof(uint8_t);
589589

@@ -687,8 +687,8 @@ uint64_t jar_xm_get_latest_trigger_of_channel(jar_xm_context_t *ctx, uint16_t ch
687687
#define READ_MEMCPY(ptr, offset, length) memcpy_pad(ptr, length, moddata, moddata_length, offset)
688688

689689
static void memcpy_pad(void *dst, size_t dst_len, const void *src, size_t src_len, size_t offset) {
690-
uint8_t *dst_c = dst;
691-
const uint8_t *src_c = src;
690+
uint8_t *dst_c = (uint8_t *)dst;
691+
const uint8_t *src_c = (uint8_t*)src;
692692

693693
/* how many bytes can be copied without overrunning `src` */
694694
size_t copy_bytes = (src_len >= offset) ? (src_len - offset) : 0;
@@ -808,10 +808,10 @@ char* jar_xm_load_module(jar_xm_context_t* ctx, const char* moddata, size_t modd
808808
mod->linear_interpolation = 1; // Linear interpolation can be set after loading
809809
mod->ramping = 1; // ramping can be set after loading
810810
mempool += mod->num_patterns * sizeof(jar_xm_pattern_t);
811-
mempool = ALIGN_PTR(mempool, 16);
811+
mempool = (char*)ALIGN_PTR(mempool, 16);
812812
mod->instruments = (jar_xm_instrument_t*)mempool;
813813
mempool += mod->num_instruments * sizeof(jar_xm_instrument_t);
814-
mempool = ALIGN_PTR(mempool, 16);
814+
mempool = (char*)ALIGN_PTR(mempool, 16);
815815
uint16_t flags = READ_U32(offset + 14);
816816
mod->frequency_type = (flags & (1 << 0)) ? jar_xm_LINEAR_FREQUENCIES : jar_xm_AMIGA_FREQUENCIES;
817817
ctx->default_tempo = READ_U16(offset + 16);
@@ -884,7 +884,7 @@ char* jar_xm_load_module(jar_xm_context_t* ctx, const char* moddata, size_t modd
884884

885885
offset += packed_patterndata_size;
886886
}
887-
mempool = ALIGN_PTR(mempool, 16);
887+
mempool = (char*)ALIGN_PTR(mempool, 16);
888888

889889
/* Read instruments */
890890
for(uint16_t i = 0; i < ctx->module.num_instruments; ++i) {
@@ -928,11 +928,11 @@ char* jar_xm_load_module(jar_xm_context_t* ctx, const char* moddata, size_t modd
928928
instr->panning_envelope.enabled = flags & (1 << 0);
929929
instr->panning_envelope.sustain_enabled = flags & (1 << 1);
930930
instr->panning_envelope.loop_enabled = flags & (1 << 2);
931-
instr->vibrato_type = READ_U8(offset + 235);
931+
instr->vibrato_type = (jar_xm_waveform_type_t )READ_U8(offset + 235);
932932
if(instr->vibrato_type == 2) {
933-
instr->vibrato_type = 1;
933+
instr->vibrato_type = (jar_xm_waveform_type_t)1;
934934
} else if(instr->vibrato_type == 1) {
935-
instr->vibrato_type = 2;
935+
instr->vibrato_type = (jar_xm_waveform_type_t)2;
936936
}
937937
instr->vibrato_sweep = READ_U8(offset + 236);
938938
instr->vibrato_depth = READ_U8(offset + 237);
@@ -1475,7 +1475,7 @@ static void jar_xm_handle_note_and_instrument(jar_xm_context_t* ctx, jar_xm_chan
14751475
jar_xm_pitch_slide(ctx, ch, ch->fine_portamento_down_param);
14761476
break;
14771477
case 4: /* E4y: Set vibrato control */
1478-
ch->vibrato_waveform = s->effect_param & 3;
1478+
ch->vibrato_waveform = (jar_xm_waveform_type_t)(s->effect_param & 3);
14791479
ch->vibrato_waveform_retrigger = !((s->effect_param >> 2) & 1);
14801480
break;
14811481
case 5: /* E5y: Set finetune */
@@ -1502,7 +1502,7 @@ static void jar_xm_handle_note_and_instrument(jar_xm_context_t* ctx, jar_xm_chan
15021502
}
15031503
break;
15041504
case 7: /* E7y: Set tremolo control */
1505-
ch->tremolo_waveform = s->effect_param & 3;
1505+
ch->tremolo_waveform = (jar_xm_waveform_type_t)(s->effect_param & 3);
15061506
ch->tremolo_waveform_retrigger = !((s->effect_param >> 2) & 1);
15071507
break;
15081508
case 0xA: /* EAy: Fine volume slide up */
@@ -2223,7 +2223,7 @@ int jar_xm_create_context_from_file(jar_xm_context_t** ctx, uint32_t rate, const
22232223
return 4;
22242224
}
22252225

2226-
char* data = JARXM_MALLOC(size + 1);
2226+
char* data = (char*)JARXM_MALLOC(size + 1);
22272227
if(!data || fread(data, 1, size, xmf) < size) {
22282228
fclose(xmf);
22292229
DEBUG_ERR(data ? "fread() failed" : "JARXM_MALLOC() failed");

src/external/qoa.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void *qoa_encode(const short *sample_data, qoa_desc *qoa, unsigned int *out_len)
500500
num_frames * QOA_LMS_LEN * 4 * qoa->channels + /* 4 * 4 bytes lms state per channel */
501501
num_slices * 8 * qoa->channels; /* 8 byte slices */
502502

503-
unsigned char *bytes = QOA_MALLOC(encoded_size);
503+
unsigned char *bytes = (unsigned char *)QOA_MALLOC(encoded_size);
504504

505505
for (unsigned int c = 0; c < qoa->channels; c++) {
506506
/* Set the initial LMS weights to {0, 0, -1, 2}. This helps with the
@@ -657,7 +657,7 @@ short *qoa_decode(const unsigned char *bytes, int size, qoa_desc *qoa) {
657657

658658
/* Calculate the required size of the sample buffer and allocate */
659659
int total_samples = qoa->samples * qoa->channels;
660-
short *sample_data = QOA_MALLOC(total_samples * sizeof(short));
660+
short *sample_data = (short *)QOA_MALLOC(total_samples * sizeof(short));
661661

662662
unsigned int sample_index = 0;
663663
unsigned int frame_len;
@@ -733,7 +733,7 @@ void *qoa_read(const char *filename, qoa_desc *qoa) {
733733
bytes_read = fread(data, 1, size, f);
734734
fclose(f);
735735

736-
sample_data = qoa_decode(data, bytes_read, qoa);
736+
sample_data = qoa_decode((const unsigned char*)data, bytes_read, qoa);
737737
QOA_FREE(data);
738738
return sample_data;
739739
}

src/external/qoaplay.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ qoaplay_desc *qoaplay_open(const char *path)
104104
// + a buffer to hold one frame of encoded data
105105
unsigned int buffer_size = qoa_max_frame_size(&qoa);
106106
unsigned int sample_data_size = qoa.channels*QOA_FRAME_LEN*sizeof(short)*2;
107-
qoaplay_desc *qoa_ctx = QOA_MALLOC(sizeof(qoaplay_desc) + buffer_size + sample_data_size);
107+
qoaplay_desc *qoa_ctx = (qoaplay_desc *)QOA_MALLOC(sizeof(qoaplay_desc) + buffer_size + sample_data_size);
108108
memset(qoa_ctx, 0, sizeof(qoaplay_desc));
109109

110110
qoa_ctx->file = file;
@@ -136,7 +136,7 @@ qoaplay_desc *qoaplay_open_memory(const unsigned char *data, int data_size)
136136
// + the sample data for one frame
137137
// + a buffer to hold one frame of encoded data
138138
unsigned int sample_data_size = qoa.channels*QOA_FRAME_LEN*sizeof(short)*2;
139-
qoaplay_desc *qoa_ctx = QOA_MALLOC(sizeof(qoaplay_desc) + sample_data_size + data_size);
139+
qoaplay_desc *qoa_ctx = (qoaplay_desc *)QOA_MALLOC(sizeof(qoaplay_desc) + sample_data_size + data_size);
140140
memset(qoa_ctx, 0, sizeof(qoaplay_desc));
141141

142142
qoa_ctx->file = NULL;

src/external/tinyobj_loader_c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static void parseFloat3(float *x, float *y, float *z, const char **token) {
454454
}
455455

456456
static unsigned int my_strnlen(const char *s, unsigned int n) {
457-
const char *p = memchr(s, 0, n);
457+
const char *p = (const char*)memchr(s, 0, n);
458458
return p ? (unsigned int)(p - s) : n;
459459
}
460460

src/external/vox_loader.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void Vox_FreeArrays(VoxArray3D* voxarray);
151151
/////////////////////////////////////////////////////////////////////////////////////////////
152152
/////////////////////////////////////////////////////////////////////////////////////////////
153153
// Implementation
154-
/////////////////////////////////////////////////////////////////////////////////////////////
154+
/////////////////////////////////////////////////////////////////////////////////////////////
155155
/////////////////////////////////////////////////////////////////////////////////////////////
156156

157157
#ifdef VOX_LOADER_IMPLEMENTATION
@@ -165,7 +165,7 @@ void Vox_FreeArrays(VoxArray3D* voxarray);
165165

166166
static void initArrayUShort(ArrayUShort* a, int initialSize)
167167
{
168-
a->array = VOX_MALLOC(initialSize * sizeof(unsigned short));
168+
a->array = (unsigned short*)VOX_MALLOC(initialSize * sizeof(unsigned short));
169169
a->used = 0;
170170
a->size = initialSize;
171171
}
@@ -175,7 +175,7 @@ static void insertArrayUShort(ArrayUShort* a, unsigned short element)
175175
if (a->used == a->size)
176176
{
177177
a->size *= 2;
178-
a->array = VOX_REALLOC(a->array, a->size * sizeof(unsigned short));
178+
a->array = (unsigned short *)VOX_REALLOC(a->array, a->size * sizeof(unsigned short));
179179
}
180180
a->array[a->used++] = element;
181181
}
@@ -194,7 +194,7 @@ static void freeArrayUShort(ArrayUShort* a)
194194

195195
static void initArrayVector3(ArrayVector3* a, int initialSize)
196196
{
197-
a->array = VOX_MALLOC(initialSize * sizeof(VoxVector3));
197+
a->array = (VoxVector3 *)VOX_MALLOC(initialSize * sizeof(VoxVector3));
198198
a->used = 0;
199199
a->size = initialSize;
200200
}
@@ -204,7 +204,7 @@ static void insertArrayVector3(ArrayVector3* a, VoxVector3 element)
204204
if (a->used == a->size)
205205
{
206206
a->size *= 2;
207-
a->array = VOX_REALLOC(a->array, a->size * sizeof(VoxVector3));
207+
a->array = (VoxVector3 *)VOX_REALLOC(a->array, a->size * sizeof(VoxVector3));
208208
}
209209
a->array[a->used++] = element;
210210
}
@@ -222,7 +222,7 @@ static void freeArrayVector3(ArrayVector3* a)
222222

223223
static void initArrayColor(ArrayColor* a, int initialSize)
224224
{
225-
a->array = VOX_MALLOC(initialSize * sizeof(VoxColor));
225+
a->array = (VoxColor *)VOX_MALLOC(initialSize * sizeof(VoxColor));
226226
a->used = 0;
227227
a->size = initialSize;
228228
}
@@ -232,7 +232,7 @@ static void insertArrayColor(ArrayColor* a, VoxColor element)
232232
if (a->used == a->size)
233233
{
234234
a->size *= 2;
235-
a->array = VOX_REALLOC(a->array, a->size * sizeof(VoxColor));
235+
a->array = (VoxColor *)VOX_REALLOC(a->array, a->size * sizeof(VoxColor));
236236
}
237237
a->array[a->used++] = element;
238238
}
@@ -327,7 +327,7 @@ static void Vox_AllocArray(VoxArray3D* pvoxarray, int _sx, int _sy, int _sz)
327327

328328
// Alloc chunks array
329329
int size = sizeof(CubeChunk3D) * chx * chy * chz;
330-
pvoxarray->m_arrayChunks = VOX_MALLOC(size);
330+
pvoxarray->m_arrayChunks = (CubeChunk3D *)VOX_MALLOC(size);
331331
pvoxarray->arrayChunksSize = size;
332332

333333
// Init chunks array
@@ -366,7 +366,7 @@ static void Vox_SetVoxel(VoxArray3D* pvoxarray, int x, int y, int z, unsigned ch
366366
if (chunk->m_array == 0)
367367
{
368368
int size = CHUNKSIZE * CHUNKSIZE * CHUNKSIZE;
369-
chunk->m_array = VOX_MALLOC(size);
369+
chunk->m_array = (unsigned char*)VOX_MALLOC(size);
370370
chunk->arraySize = size;
371371
memset(chunk->m_array, 0, size);
372372

src/external/win32_clipboard.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ typedef int WINBOOL;
9696

9797
// typedef HANDLE HGLOBAL;
9898

99-
#ifndef HWND
100-
#define HWND void*
101-
#endif
99+
typedef struct HWND__ *HWND;
102100

103101

104102
#if !defined(_WINUSER_) || !defined(WINUSER_ALREADY_INCLUDED)
@@ -284,7 +282,7 @@ unsigned char* Win32GetClipboardImageData(int* width, int* height, unsigned long
284282
// This may be wrong since we might be allocating in a DLL and freeing from another module, the main application
285283
// that may cause heap corruption. We could create a FreeImage function
286284
//
287-
bmpData = malloc(sizeof(bmpFileHeader) + clipDataSize);
285+
bmpData = (BYTE*)malloc(sizeof(bmpFileHeader) + clipDataSize);
288286
// First we add the header for a bmp file
289287
memcpy(bmpData, &bmpFileHeader, sizeof(bmpFileHeader));
290288
// Then we add the header for the bmp itself + the pixel data

0 commit comments

Comments
 (0)