diff --git a/HxCFloppyEmulator_software/sources/gui/microintro/microintro.c b/HxCFloppyEmulator_software/sources/gui/microintro/microintro.c index e35cd8e5..a6cc49c2 100644 --- a/HxCFloppyEmulator_software/sources/gui/microintro/microintro.c +++ b/HxCFloppyEmulator_software/sources/gui/microintro/microintro.c @@ -161,7 +161,7 @@ void convert8b16b(bmaptype * img,unsigned short transcolor) switch(img->type) { case 9: - newbuffer = malloc(img->Ysize*img->Xsize*sizeof(unsigned int )); + newbuffer = malloc((size_t)img->Ysize*(size_t)img->Xsize*sizeof(unsigned int )); if(!newbuffer) return; @@ -184,7 +184,7 @@ void convert8b16b(bmaptype * img,unsigned short transcolor) img->unpacked_data=(unsigned char*)newbuffer; break; case 1: - newbuffer=malloc(img->Ysize*img->Xsize*sizeof(unsigned int )); + newbuffer=malloc((size_t)img->Ysize*(size_t)img->Xsize*sizeof(unsigned int )); if(!newbuffer) return; @@ -215,7 +215,7 @@ void convert8b24b(bmaptype * img,unsigned short transcolor) switch(img->type) { case 9: - newbuffer=malloc(img->Ysize*img->Xsize*3); + newbuffer=malloc((size_t)img->Ysize*(size_t)img->Xsize*3); if(!newbuffer) return; @@ -241,7 +241,7 @@ void convert8b24b(bmaptype * img,unsigned short transcolor) break; case 1: - newbuffer=malloc(img->Ysize*img->Xsize*3); + newbuffer=malloc((size_t)img->Ysize*(size_t)img->Xsize*3); if(!newbuffer) return; diff --git a/HxCFloppyEmulator_software/sources/gui/microintro/microintro.h b/HxCFloppyEmulator_software/sources/gui/microintro/microintro.h index 9fd32f9e..e8097150 100644 --- a/HxCFloppyEmulator_software/sources/gui/microintro/microintro.h +++ b/HxCFloppyEmulator_software/sources/gui/microintro/microintro.h @@ -3,11 +3,11 @@ typedef struct uintro_context_ { - unsigned short xsize; - unsigned short ysize; + size_t xsize; + size_t ysize; - unsigned short sprite_xsize; - unsigned short sprite_ysize; + size_t sprite_xsize; + size_t sprite_ysize; unsigned int * framebuffer; unsigned int * background; diff --git a/libhxcfe/sources/floppy_loader.c b/libhxcfe/sources/floppy_loader.c index d97d3bda..6fa38f4d 100644 --- a/libhxcfe/sources/floppy_loader.c +++ b/libhxcfe/sources/floppy_loader.c @@ -1918,7 +1918,7 @@ int32_t hxcfe_generateDisk( HXCFE_FLPGEN* fb_ctx, HXCFE_FLOPPY* floppy, void * f interleave, rpm); - track_buffer = malloc( sectorsize * numberofsector ); + track_buffer = malloc( (size_t)sectorsize * (size_t)numberofsector ); if( !track_buffer ) return HXCFE_INTERNALERROR; @@ -1949,7 +1949,7 @@ int32_t hxcfe_generateDisk( HXCFE_FLPGEN* fb_ctx, HXCFE_FLOPPY* floppy, void * f fseek( filehandle, bufferoffset, SEEK_SET); if( (bufferoffset + (numberofsector * sectorsize)) < image_size ) { - if( fread( track_buffer, numberofsector * sectorsize, 1, filehandle ) != 1 ) + if( fread( track_buffer, (size_t)numberofsector * (size_t)sectorsize, 1, filehandle ) != 1 ) { fb_ctx->floppycontext->hxc_printf(MSG_ERROR,"hxcfe_generateDisk : Error while reading the file image ! Unexpected end of file ?"); } diff --git a/libhxcfe/sources/thirdpartylibs/adflib/Lib/adf_dump.c b/libhxcfe/sources/thirdpartylibs/adflib/Lib/adf_dump.c index 0d7170ef..89d9c3ca 100644 --- a/libhxcfe/sources/thirdpartylibs/adflib/Lib/adf_dump.c +++ b/libhxcfe/sources/thirdpartylibs/adflib/Lib/adf_dump.c @@ -317,7 +317,7 @@ adfCreateMemoryDumpDevice(int32_t cylinders, int32_t heads, int32_t sectors,unsi dev->nativeDev = nDev; nDev->fd=0; - nDev->memory_buffer=(unsigned char *) calloc(1,((cylinders*heads*sectors))*LOGICAL_BLOCK_SIZE); + nDev->memory_buffer=(unsigned char *) calloc(1,(((size_t)cylinders*(size_t)heads*(size_t)sectors))*LOGICAL_BLOCK_SIZE); if (!nDev->memory_buffer) { free(nDev); free(dev); (*adfEnv.eFct)("adfCreateMemoryDumpDevice : malloc");