Skip to content

Commit

Permalink
need uintptr_t for pointer arithmetic @ ImageMagick/ImageMagick#5380
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Aug 5, 2022
1 parent 19a9454 commit 19d2899
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
46 changes: 23 additions & 23 deletions magick/distribute-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,13 @@ MagickPrivate DistributeCacheInfo *DestroyDistributeCacheInfo(
static MagickBooleanType DestroyDistributeCache(SplayTreeInfo *registry,
const size_t session_key)
{
const size_t
*key = (const size_t *) NULL;
MagickAddressType
key = (MagickAddressType) session_key;

/*
Destroy distributed pixel cache.
*/
return(DeleteNodeFromSplayTree(registry,key+session_key));
return(DeleteNodeFromSplayTree(registry,(const void *) key));
}

static inline MagickOffsetType dpc_send(int file,const MagickSizeType length,
Expand Down Expand Up @@ -471,12 +471,12 @@ static inline MagickOffsetType dpc_send(int file,const MagickSizeType length,
static MagickBooleanType OpenDistributeCache(SplayTreeInfo *registry,int file,
const size_t session_key,ExceptionInfo *exception)
{
const size_t
*key = (const size_t *) NULL;

Image
*image;

MagickAddressType
key = (MagickAddressType) session_key;

MagickBooleanType
status;

Expand Down Expand Up @@ -517,7 +517,7 @@ static MagickBooleanType OpenDistributeCache(SplayTreeInfo *registry,int file,
p+=sizeof(image->rows);
if (SyncImagePixelCache(image,exception) == MagickFalse)
return(MagickFalse);
status=AddValueToSplayTree(registry,key+session_key,image);
status=AddValueToSplayTree(registry,(const void *) key,image);
return(status);
}

Expand All @@ -530,12 +530,12 @@ static MagickBooleanType ReadDistributeCacheIndexes(SplayTreeInfo *registry,
const PixelPacket
*p;

const size_t
*key = (const size_t *) NULL;

Image
*image;

MagickAddressType
key = (MagickAddressType) session_key;

MagickOffsetType
count;

Expand All @@ -552,7 +552,7 @@ static MagickBooleanType ReadDistributeCacheIndexes(SplayTreeInfo *registry,
/*
Read distributed pixel cache indexes.
*/
image=(Image *) GetValueFromSplayTree(registry,key+session_key);
image=(Image *) GetValueFromSplayTree(registry,(const void *) key);
if (image == (Image *) NULL)
return(MagickFalse);
length=sizeof(region.width)+sizeof(region.height)+sizeof(region.x)+
Expand Down Expand Up @@ -588,12 +588,12 @@ static MagickBooleanType ReadDistributeCachePixels(SplayTreeInfo *registry,
const PixelPacket
*p;

const size_t
*key = (const size_t *) NULL;

Image
*image;

MagickAddressType
key = (MagickAddressType) session_key;

MagickOffsetType
count;

Expand All @@ -610,7 +610,7 @@ static MagickBooleanType ReadDistributeCachePixels(SplayTreeInfo *registry,
/*
Read distributed pixel cache pixels.
*/
image=(Image *) GetValueFromSplayTree(registry,key+session_key);
image=(Image *) GetValueFromSplayTree(registry,(const void *) key);
if (image == (Image *) NULL)
return(MagickFalse);
length=sizeof(region.width)+sizeof(region.height)+sizeof(region.x)+
Expand Down Expand Up @@ -647,15 +647,15 @@ static void *RelinquishImageRegistry(void *image)
static MagickBooleanType WriteDistributeCacheIndexes(SplayTreeInfo *registry,
int file,const size_t session_key,ExceptionInfo *exception)
{
const size_t
*key = (const size_t *) NULL;

Image
*image;

IndexPacket
*indexes;

MagickAddressType
key = (MagickAddressType) session_key;

MagickOffsetType
count;

Expand All @@ -674,7 +674,7 @@ static MagickBooleanType WriteDistributeCacheIndexes(SplayTreeInfo *registry,
/*
Write distributed pixel cache indexes.
*/
image=(Image *) GetValueFromSplayTree(registry,key+session_key);
image=(Image *) GetValueFromSplayTree(registry,(const void *) key);
if (image == (Image *) NULL)
return(MagickFalse);
length=sizeof(region.width)+sizeof(region.height)+sizeof(region.x)+
Expand Down Expand Up @@ -707,12 +707,12 @@ static MagickBooleanType WriteDistributeCacheIndexes(SplayTreeInfo *registry,
static MagickBooleanType WriteDistributeCachePixels(SplayTreeInfo *registry,
int file,const size_t session_key,ExceptionInfo *exception)
{
const size_t
*key = (const size_t *) NULL;

Image
*image;

MagickAddressType
key = (MagickAddressType) session_key;

MagickOffsetType
count;

Expand All @@ -732,7 +732,7 @@ static MagickBooleanType WriteDistributeCachePixels(SplayTreeInfo *registry,
/*
Write distributed pixel cache pixels.
*/
image=(Image *) GetValueFromSplayTree(registry,key+session_key);
image=(Image *) GetValueFromSplayTree(registry,(const void *) key);
if (image == (Image *) NULL)
return(MagickFalse);
length=sizeof(region.width)+sizeof(region.height)+sizeof(region.x)+
Expand Down
22 changes: 10 additions & 12 deletions wand/wand.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,24 @@ static SemaphoreInfo
*/
WandExport size_t AcquireWandId(void)
{
const size_t
*wand_id = (const size_t *) NULL;

size_t
id;
MagickAddressType
wand_id;

static size_t
isn = 0;
id = 0;

if (wand_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&wand_semaphore);
LockSemaphoreInfo(wand_semaphore);
if (wand_ids == (SplayTreeInfo *) NULL)
wand_ids=NewSplayTree((int (*)(const void *,const void *)) NULL,
(void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
id=isn++;
(void) AddValueToSplayTree(wand_ids,wand_id+id,wand_id+id);
wand_id=id++;
(void) AddValueToSplayTree(wand_ids,(const void *) wand_id,(const void *)
wand_id);
instantiate_wand=MagickTrue;
UnlockSemaphoreInfo(wand_semaphore);
return(id);
return((size_t) wand_id);
}

/*
Expand Down Expand Up @@ -154,11 +152,11 @@ WandExport void DestroyWandIds(void)
*/
WandExport void RelinquishWandId(const size_t id)
{
const size_t
*wand_id = (const size_t *) NULL;
MagickAddressType
wand_id = (MagickAddressType) id;

LockSemaphoreInfo(wand_semaphore);
if (wand_ids != (SplayTreeInfo *) NULL)
(void) DeleteNodeFromSplayTree(wand_ids,wand_id+id);
(void) DeleteNodeFromSplayTree(wand_ids,(const void *) wand_id);
UnlockSemaphoreInfo(wand_semaphore);
}

0 comments on commit 19d2899

Please sign in to comment.