1
0
mirror of https://github.com/aseprite/aseprite.git synced 2025-03-30 13:20:28 +00:00

Fix gif encoding on x64 compiled with VS2017

bool is 1 byte on C++, not 4 bytes (int), so we cannot just "typedef int
bool" and assume that structs with bools will have the same size on C++
than on C.
This commit is contained in:
David Capello 2017-09-27 08:42:05 -03:00
parent e14b4caa78
commit 8e7a5e5014
4 changed files with 13 additions and 12 deletions

@ -236,7 +236,7 @@ int
DGifGetScreenDesc(GifFileType *GifFile)
{
int BitsPerPixel;
bool SortFlag;
GifBool SortFlag;
GifByteType Buf[3];
GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private;

@ -57,7 +57,7 @@ static int EGifBufferedOutput(GifFileType * GifFile, GifByteType * Buf,
info record. The Error member is cleared if successful.
******************************************************************************/
GifFileType *
EGifOpenFileName(const char *FileName, const bool TestExistence, int *Error)
EGifOpenFileName(const char *FileName, const GifBool TestExistence, int *Error)
{
int FileHandle;
@ -237,7 +237,7 @@ EGifGetGifVersion(GifFileType *GifFile)
is 1 (numerically the same as bool true). That way we'll even preserve
object-file compatibility!
******************************************************************************/
void EGifSetGifVersion(GifFileType *GifFile, const bool gif89)
void EGifSetGifVersion(GifFileType *GifFile, const GifBool gif89)
{
GifFilePrivateType *Private = (GifFilePrivateType *) GifFile->Private;
@ -360,7 +360,7 @@ EGifPutImageDesc(GifFileType *GifFile,
const int Top,
const int Width,
const int Height,
const bool Interlace,
const GifBool Interlace,
const ColorMapObject *ColorMap)
{
GifByteType Buf[3];

@ -22,11 +22,12 @@ extern "C" {
#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#elif !defined __cplusplus
typedef int bool;
#define false 0
#define true 1
#endif
typedef int GifBool;
#define GIF_STAMP "GIFVER" /* First chars in file - GIF stamp. */
#define GIF_STAMP_LEN sizeof(GIF_STAMP) - 1
#define GIF_VERSION_POS 3 /* Version first character in stamp. */
@ -46,13 +47,13 @@ typedef struct GifColorType {
typedef struct ColorMapObject {
int ColorCount;
int BitsPerPixel;
bool SortFlag;
GifBool SortFlag;
GifColorType *Colors; /* on malloc(3) heap */
} ColorMapObject;
typedef struct GifImageDesc {
GifWord Left, Top, Width, Height; /* Current image dimensions. */
bool Interlace; /* Sequential/Interlaced lines. */
GifBool Interlace; /* Sequential/Interlaced lines. */
ColorMapObject *ColorMap; /* The local color map */
} GifImageDesc;
@ -118,7 +119,7 @@ typedef struct GraphicsControlBlock {
#define DISPOSE_DO_NOT 1 /* Leave image in place */
#define DISPOSE_BACKGROUND 2 /* Set area too background color */
#define DISPOSE_PREVIOUS 3 /* Restore to previous content */
bool UserInputFlag; /* User confirmation required before disposal */
GifBool UserInputFlag; /* User confirmation required before disposal */
int DelayTime; /* pre-display delay in 0.01sec units */
int TransparentColor; /* Palette index for transparency, -1 if none */
#define NO_TRANSPARENT_COLOR -1
@ -130,7 +131,7 @@ typedef struct GraphicsControlBlock {
/* Main entry points */
GifFileType *EGifOpenFileName(const char *GifFileName,
const bool GifTestExistence, int *Error);
const GifBool GifTestExistence, int *Error);
GifFileType *EGifOpenFileHandle(const int GifFileHandle, int *Error);
GifFileType *EGifOpen(void *userPtr, OutputFunc writeFunc, int *Error);
int EGifSpew(GifFileType * GifFile);
@ -158,9 +159,9 @@ int EGifPutScreenDesc(GifFileType *GifFile,
int EGifPutImageDesc(GifFileType *GifFile,
const int GifLeft, const int GifTop,
const int GifWidth, const int GifHeight,
const bool GifInterlace,
const GifBool GifInterlace,
const ColorMapObject *GifColorMap);
void EGifSetGifVersion(GifFileType *GifFile, const bool gif89);
void EGifSetGifVersion(GifFileType *GifFile, const GifBool gif89);
int EGifPutLine(GifFileType *GifFile, GifPixelType *GifLine,
int GifLineLen);
int EGifPutPixel(GifFileType *GifFile, const GifPixelType GifPixel);

@ -51,7 +51,7 @@ typedef struct GifFilePrivateType {
GifByteType Suffix[LZ_MAX_CODE + 1]; /* So we can trace the codes. */
GifPrefixType Prefix[LZ_MAX_CODE + 1];
GifHashTableType *HashTable;
bool gif89;
GifBool gif89;
} GifFilePrivateType;
#endif /* _GIF_LIB_PRIVATE_H */