From fc31dc5682b5b7481882b1997a65913405c48298 Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 10 Mar 2018 10:42:46 -0500 Subject: [PATCH] Replace CopyMagickMemory() with memcpy() / memmove() --- MagickCore/cipher.c | 14 +++++++------- MagickCore/draw.c | 10 +++++----- MagickCore/feature.c | 2 +- MagickCore/fourier.c | 6 +++--- MagickCore/image.c | 2 +- MagickCore/nt-base.c | 2 +- MagickCore/paint.c | 2 +- MagickCore/pixel.c | 2 +- MagickCore/profile.c | 18 +++++++++--------- MagickCore/property.c | 2 +- MagickCore/quantize.c | 2 +- MagickCore/random.c | 6 +++--- MagickCore/signature.c | 4 ++-- MagickCore/string.c | 4 ++-- MagickCore/widget.c | 2 +- MagickCore/xml-tree.c | 23 +++++++++++------------ MagickCore/xwindow.c | 2 +- MagickWand/magick-property.c | 4 ++-- coders/icon.c | 2 +- coders/jpeg.c | 6 +++--- coders/mvg.c | 2 +- coders/palm.c | 4 ++-- coders/pcd.c | 2 +- coders/pcl.c | 2 +- coders/pcx.c | 2 +- coders/pdb.c | 8 ++++---- coders/pict.c | 6 +++--- coders/png.c | 6 +++--- coders/psd.c | 6 +++--- coders/sfw.c | 2 +- coders/sixel.c | 8 ++++---- coders/sun.c | 2 +- coders/svg.c | 2 +- coders/tiff.c | 2 +- 34 files changed, 84 insertions(+), 85 deletions(-) diff --git a/MagickCore/cipher.c b/MagickCore/cipher.c index 6338b80ab..6459e2717 100644 --- a/MagickCore/cipher.c +++ b/MagickCore/cipher.c @@ -638,7 +638,7 @@ MagickExport MagickBooleanType PasskeyDecipherImage(Image *image, FinalizeSignature(signature_info); (void) memset(input_block,0,sizeof(input_block)); digest=GetStringInfoDatum(GetSignatureDigest(signature_info)); - (void) CopyMagickMemory(input_block,digest,MagickMin(AESBlocksize, + (void) memcpy(input_block,digest,MagickMin(AESBlocksize, GetSignatureDigestsize(signature_info))*sizeof(*input_block)); signature_info=DestroySignatureInfo(signature_info); /* @@ -671,7 +671,7 @@ MagickExport MagickBooleanType PasskeyDecipherImage(Image *image, p=pixels; for (x=0; x < (ssize_t) length; x+=AESBlocksize) { - (void) CopyMagickMemory(output_block,input_block,AESBlocksize* + (void) memcpy(output_block,input_block,AESBlocksize* sizeof(*output_block)); IncrementCipherNonce(AESBlocksize,input_block); EncipherAESBlock(aes_info,output_block,output_block); @@ -679,7 +679,7 @@ MagickExport MagickBooleanType PasskeyDecipherImage(Image *image, p[i]^=output_block[i]; p+=AESBlocksize; } - (void) CopyMagickMemory(output_block,input_block,AESBlocksize* + (void) memcpy(output_block,input_block,AESBlocksize* sizeof(*output_block)); EncipherAESBlock(aes_info,output_block,output_block); for (i=0; x < (ssize_t) length; x++) @@ -858,7 +858,7 @@ MagickExport MagickBooleanType PasskeyEncipherImage(Image *image, signature=DestroyString(signature); (void) memset(input_block,0,sizeof(input_block)); digest=GetStringInfoDatum(GetSignatureDigest(signature_info)); - (void) CopyMagickMemory(input_block,digest,MagickMin(AESBlocksize, + (void) memcpy(input_block,digest,MagickMin(AESBlocksize, GetSignatureDigestsize(signature_info))*sizeof(*input_block)); signature_info=DestroySignatureInfo(signature_info); /* @@ -891,7 +891,7 @@ MagickExport MagickBooleanType PasskeyEncipherImage(Image *image, p=pixels; for (x=0; x < (ssize_t) length; x+=AESBlocksize) { - (void) CopyMagickMemory(output_block,input_block,AESBlocksize* + (void) memcpy(output_block,input_block,AESBlocksize* sizeof(*output_block)); IncrementCipherNonce(AESBlocksize,input_block); EncipherAESBlock(aes_info,output_block,output_block); @@ -899,7 +899,7 @@ MagickExport MagickBooleanType PasskeyEncipherImage(Image *image, p[i]^=output_block[i]; p+=AESBlocksize; } - (void) CopyMagickMemory(output_block,input_block,AESBlocksize* + (void) memcpy(output_block,input_block,AESBlocksize* sizeof(*output_block)); EncipherAESBlock(aes_info,output_block,output_block); for (i=0; x < (ssize_t) length; x++) @@ -1030,7 +1030,7 @@ static void SetAESKey(AESInfo *aes_info,const StringInfo *key) */ datum=GetStringInfoDatum(aes_info->key); (void) memset(datum,0,GetStringInfoLength(aes_info->key)); - (void) CopyMagickMemory(datum,GetStringInfoDatum(key),MagickMin( + (void) memcpy(datum,GetStringInfoDatum(key),MagickMin( GetStringInfoLength(key),GetStringInfoLength(aes_info->key))); for (i=0; i < n; i++) aes_info->encipher_key[i]=datum[4*i] | (datum[4*i+1] << 8) | diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 3b04aec8b..b733a6ebc 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -320,8 +320,8 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, if (clone_info->dash_pattern == (double *) NULL) ThrowFatalException(ResourceLimitFatalError, "UnableToAllocateDashPattern"); - (void) CopyMagickMemory(clone_info->dash_pattern,draw_info->dash_pattern, - (size_t) (x+1)*sizeof(*clone_info->dash_pattern)); + (void) memcpy(clone_info->dash_pattern,draw_info->dash_pattern,(size_t) + (x+1)*sizeof(*clone_info->dash_pattern)); } clone_info->gradient=draw_info->gradient; if (draw_info->gradient.stops != (StopInfo *) NULL) @@ -335,7 +335,7 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, if (clone_info->gradient.stops == (StopInfo *) NULL) ThrowFatalException(ResourceLimitFatalError, "UnableToAllocateDashPattern"); - (void) CopyMagickMemory(clone_info->gradient.stops, + (void) memcpy(clone_info->gradient.stops, draw_info->gradient.stops,(size_t) number_stops* sizeof(*clone_info->gradient.stops)); } @@ -899,7 +899,7 @@ static size_t DestroyEdge(PolygonInfo *polygon_info, polygon_info->edges[edge].points); polygon_info->number_edges--; if (edge < polygon_info->number_edges) - (void) CopyMagickMemory(polygon_info->edges+edge,polygon_info->edges+edge+1, + (void) memmove(polygon_info->edges+edge,polygon_info->edges+edge+1, (size_t) (polygon_info->number_edges-edge)*sizeof(*polygon_info->edges)); return(polygon_info->number_edges); } @@ -6213,7 +6213,7 @@ static PrimitiveInfo *TraceStrokePolygon(const DrawInfo *draw_info, polygon_primitive); return((PrimitiveInfo *) NULL); } - (void) CopyMagickMemory(polygon_primitive,primitive_info,(size_t) + (void) memcpy(polygon_primitive,primitive_info,(size_t) number_vertices*sizeof(*polygon_primitive)); closed_path= (fabs(primitive_info[number_vertices-1].point.x-primitive_info[0].point.x) < DrawEpsilon) && diff --git a/MagickCore/feature.c b/MagickCore/feature.c index e6fd778ee..3e1205e09 100644 --- a/MagickCore/feature.c +++ b/MagickCore/feature.c @@ -1812,7 +1812,7 @@ static Image *RenderHoughLines(const ImageInfo *image_info,const size_t columns, GetBlobSize(image)+1); if (draw_info->primitive != (char *) NULL) { - (void) CopyMagickMemory(draw_info->primitive,GetBlobStreamData(image), + (void) memcpy(draw_info->primitive,GetBlobStreamData(image), (size_t) GetBlobSize(image)); draw_info->primitive[GetBlobSize(image)]='\0'; } diff --git a/MagickCore/fourier.c b/MagickCore/fourier.c index e2b25192e..a5cdac333 100644 --- a/MagickCore/fourier.c +++ b/MagickCore/fourier.c @@ -428,7 +428,7 @@ static MagickBooleanType RollFourier(const size_t width,const size_t height, source_pixels[v*width+u]=roll_pixels[i++]; } } - (void) CopyMagickMemory(roll_pixels,source_pixels,height*width* + (void) memcpy(roll_pixels,source_pixels,height*width* sizeof(*source_pixels)); source_info=RelinquishVirtualMemory(source_info); return(MagickTrue); @@ -1190,7 +1190,7 @@ static MagickBooleanType InverseFourier(FourierInfo *fourier_info, magnitude_view=DestroyCacheView(magnitude_view); status=InverseQuadrantSwap(fourier_info->width,fourier_info->height, magnitude_pixels,inverse_pixels); - (void) CopyMagickMemory(magnitude_pixels,inverse_pixels,fourier_info->height* + (void) memcpy(magnitude_pixels,inverse_pixels,fourier_info->height* fourier_info->center*sizeof(*magnitude_pixels)); i=0L; phase_view=AcquireVirtualCacheView(phase_image,exception); @@ -1251,7 +1251,7 @@ static MagickBooleanType InverseFourier(FourierInfo *fourier_info, if (status != MagickFalse) status=InverseQuadrantSwap(fourier_info->width,fourier_info->height, phase_pixels,inverse_pixels); - (void) CopyMagickMemory(phase_pixels,inverse_pixels,fourier_info->height* + (void) memcpy(phase_pixels,inverse_pixels,fourier_info->height* fourier_info->center*sizeof(*phase_pixels)); inverse_info=RelinquishVirtualMemory(inverse_info); /* diff --git a/MagickCore/image.c b/MagickCore/image.c index df6bf6697..3d42f6757 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -886,7 +886,7 @@ MagickExport Image *CloneImage(const Image *image,const size_t columns, clone_image=DestroyImage(clone_image); ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); } - (void) CopyMagickMemory(clone_image->colormap,image->colormap,length* + (void) memcpy(clone_image->colormap,image->colormap,length* sizeof(*clone_image->colormap)); } if ((columns == 0) || (rows == 0)) diff --git a/MagickCore/nt-base.c b/MagickCore/nt-base.c index ce2592730..ae8560007 100644 --- a/MagickCore/nt-base.c +++ b/MagickCore/nt-base.c @@ -2194,7 +2194,7 @@ MagickPrivate unsigned char *NTResourceToBlob(const char *id) sizeof(*blob)); if (blob != (unsigned char *) NULL) { - (void) CopyMagickMemory(blob,value,length); + (void) memcpy(blob,value,length); blob[length]='\0'; } UnlockResource(global); diff --git a/MagickCore/paint.c b/MagickCore/paint.c index adbf4e574..9b3e15c25 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -605,7 +605,7 @@ MagickExport MagickBooleanType GradientImage(Image *image, if (gradient->stops == (StopInfo *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); - (void) CopyMagickMemory(gradient->stops,stops,(size_t) number_stops* + (void) memcpy(gradient->stops,stops,(size_t) number_stops* sizeof(*stops)); /* Draw a gradient on the image. diff --git a/MagickCore/pixel.c b/MagickCore/pixel.c index 7edffd930..8f1d596cc 100644 --- a/MagickCore/pixel.c +++ b/MagickCore/pixel.c @@ -139,7 +139,7 @@ MagickExport PixelChannelMap *ClonePixelChannelMap(PixelChannelMap *channel_map) clone_map=AcquirePixelChannelMap(); if (clone_map == (PixelChannelMap *) NULL) return((PixelChannelMap *) NULL); - (void) CopyMagickMemory(clone_map,channel_map,MaxPixelChannels* + (void) memcpy(clone_map,channel_map,MaxPixelChannels* sizeof(*channel_map)); return(clone_map); } diff --git a/MagickCore/profile.c b/MagickCore/profile.c index c4b8cbf17..d163b1b94 100644 --- a/MagickCore/profile.c +++ b/MagickCore/profile.c @@ -1336,7 +1336,7 @@ static inline void WriteResourceLong(unsigned char *p, buffer[1]=(unsigned char) (quantum >> 16); buffer[2]=(unsigned char) (quantum >> 8); buffer[3]=(unsigned char) quantum; - (void) CopyMagickMemory(p,buffer,4); + (void) memcpy(p,buffer,4); } static void WriteTo8BimProfile(Image *image,const char *name, @@ -1423,7 +1423,7 @@ static void WriteTo8BimProfile(Image *image,const char *name, { offset=(q-datum); extract_profile=AcquireStringInfo(offset+extent); - (void) CopyMagickMemory(extract_profile->datum,datum,offset); + (void) memcpy(extract_profile->datum,datum,offset); } else { @@ -1432,13 +1432,13 @@ static void WriteTo8BimProfile(Image *image,const char *name, if ((extract_extent & 0x01) != 0) extract_extent++; extract_profile=AcquireStringInfo(offset+extract_extent+extent); - (void) CopyMagickMemory(extract_profile->datum,datum,offset-4); + (void) memcpy(extract_profile->datum,datum,offset-4); WriteResourceLong(extract_profile->datum+offset-4,(unsigned int) profile->length); - (void) CopyMagickMemory(extract_profile->datum+offset, + (void) memcpy(extract_profile->datum+offset, profile->datum,profile->length); } - (void) CopyMagickMemory(extract_profile->datum+offset+extract_extent, + (void) memcpy(extract_profile->datum+offset+extract_extent, p+count,extent); (void) AddValueToSplayTree((SplayTreeInfo *) image->profiles, ConstantString("8bim"),CloneStringInfo(extract_profile)); @@ -1776,14 +1776,14 @@ static inline void WriteProfileLong(const EndianType endian, buffer[1]=(unsigned char) (value >> 8); buffer[2]=(unsigned char) (value >> 16); buffer[3]=(unsigned char) (value >> 24); - (void) CopyMagickMemory(p,buffer,4); + (void) memcpy(p,buffer,4); return; } buffer[0]=(unsigned char) (value >> 24); buffer[1]=(unsigned char) (value >> 16); buffer[2]=(unsigned char) (value >> 8); buffer[3]=(unsigned char) value; - (void) CopyMagickMemory(p,buffer,4); + (void) memcpy(p,buffer,4); } static void WriteProfileShort(const EndianType endian, @@ -1796,12 +1796,12 @@ static void WriteProfileShort(const EndianType endian, { buffer[0]=(unsigned char) value; buffer[1]=(unsigned char) (value >> 8); - (void) CopyMagickMemory(p,buffer,2); + (void) memcpy(p,buffer,2); return; } buffer[0]=(unsigned char) (value >> 8); buffer[1]=(unsigned char) value; - (void) CopyMagickMemory(p,buffer,2); + (void) memcpy(p,buffer,2); } static MagickBooleanType Sync8BimProfile(Image *image,StringInfo *profile) diff --git a/MagickCore/property.c b/MagickCore/property.c index ea1320a04..f2c31d38c 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -708,7 +708,7 @@ static MagickBooleanType Get8BIMProperty(const Image *image,const char *key, sizeof(*attribute)); if (attribute != (char *) NULL) { - (void) CopyMagickMemory(attribute,(char *) info,(size_t) count); + (void) memcpy(attribute,(char *) info,(size_t) count); attribute[count]='\0'; info+=count; length-=MagickMin(count,(ssize_t) length); diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c index 3e3ddb9c3..ae13eb497 100644 --- a/MagickCore/quantize.c +++ b/MagickCore/quantize.c @@ -1898,7 +1898,7 @@ static MagickBooleanType RiemersmaDither(Image *image,CacheView *image_view, /* Propagate the error as the last entry of the error queue. */ - (void) CopyMagickMemory(p->error,p->error+1,(ErrorQueueLength-1)* + (void) memmove(p->error,p->error+1,(ErrorQueueLength-1)* sizeof(p->error[0])); AssociateAlphaPixelInfo(cube_info,image->colormap+index,&color); p->error[ErrorQueueLength-1].red=pixel.red-color.red; diff --git a/MagickCore/random.c b/MagickCore/random.c index 68fb6ea6c..ef8a9effd 100644 --- a/MagickCore/random.c +++ b/MagickCore/random.c @@ -221,7 +221,7 @@ MagickExport RandomInfo *AcquireRandomInfo(void) if (random_info->secret_key == ~0UL) { key=GetRandomKey(random_info,sizeof(random_info->secret_key)); - (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(key), + (void) memcpy(random_info->seed,GetStringInfoDatum(key), GetStringInfoLength(key)); key=DestroyStringInfo(key); } @@ -237,7 +237,7 @@ MagickExport RandomInfo *AcquireRandomInfo(void) key=DestroyStringInfo(key); FinalizeSignature(signature_info); digest=GetSignatureDigest(signature_info); - (void) CopyMagickMemory(random_info->seed,GetStringInfoDatum(digest), + (void) memcpy(random_info->seed,GetStringInfoDatum(digest), MagickMin(GetSignatureDigestsize(signature_info), sizeof(*random_info->seed))); signature_info=DestroySignatureInfo(signature_info); @@ -910,7 +910,7 @@ MagickExport void SetRandomKey(RandomInfo *random_info,const size_t length, UpdateSignature(signature_info,random_info->nonce); FinalizeSignature(signature_info); IncrementRandomNonce(random_info->nonce); - (void) CopyMagickMemory(p,GetStringInfoDatum(GetSignatureDigest( + (void) memcpy(p,GetStringInfoDatum(GetSignatureDigest( signature_info)),GetSignatureDigestsize(signature_info)); p+=GetSignatureDigestsize(signature_info); i-=GetSignatureDigestsize(signature_info); diff --git a/MagickCore/signature.c b/MagickCore/signature.c index 0ce2c9646..564d02fa9 100644 --- a/MagickCore/signature.c +++ b/MagickCore/signature.c @@ -808,7 +808,7 @@ MagickPrivate void UpdateSignature(SignatureInfo *signature_info, i=GetStringInfoLength(signature_info->message)-signature_info->extent; if (i > n) i=n; - (void) CopyMagickMemory(GetStringInfoDatum(signature_info->message)+ + (void) memcpy(GetStringInfoDatum(signature_info->message)+ signature_info->extent,p,i); n-=i; p+=i; @@ -824,6 +824,6 @@ MagickPrivate void UpdateSignature(SignatureInfo *signature_info, n-=GetStringInfoLength(signature_info->message); TransformSignature(signature_info); } - (void) CopyMagickMemory(GetStringInfoDatum(signature_info->message),p,n); + (void) memcpy(GetStringInfoDatum(signature_info->message),p,n); signature_info->extent=n; } diff --git a/MagickCore/string.c b/MagickCore/string.c index 091242a25..6cd3c5991 100644 --- a/MagickCore/string.c +++ b/MagickCore/string.c @@ -2647,9 +2647,9 @@ MagickExport MagickBooleanType SubstituteString(char **string, Replace string. */ if (search_extent != replace_extent) - (void) CopyMagickMemory(p+replace_extent,p+search_extent, + (void) memmove(p+replace_extent,p+search_extent, strlen(p+search_extent)+1); - (void) CopyMagickMemory(p,replace,replace_extent); + (void) memcpy(p,replace,replace_extent); p+=replace_extent-1; } return(status); diff --git a/MagickCore/widget.c b/MagickCore/widget.c index 514b5cd90..c17f39563 100644 --- a/MagickCore/widget.c +++ b/MagickCore/widget.c @@ -1107,7 +1107,7 @@ static void XEditText(Display *display,XWidgetInfo *text_info, if (text_info->cursor != text_info->text) { text_info->cursor--; - (void) CopyMagickString(text_info->cursor,text_info->cursor+1, + (void) memmove(text_info->cursor,text_info->cursor+1, MagickPathExtent); text_info->highlight=MagickFalse; break; diff --git a/MagickCore/xml-tree.c b/MagickCore/xml-tree.c index 9bc03a084..d62ce1f9a 100644 --- a/MagickCore/xml-tree.c +++ b/MagickCore/xml-tree.c @@ -1316,7 +1316,7 @@ static char *ConvertUTF16ToUTF8(const char *content,size_t *length) /* Already UTF-8. */ - (void) CopyMagickMemory(utf8,content,*length*sizeof(*utf8)); + (void) memcpy(utf8,content,*length*sizeof(*utf8)); utf8[*length]='\0'; return(utf8); } @@ -1401,7 +1401,7 @@ static char *ParseEntities(char *xml,char **entities,int state) { *(xml++)='\n'; if (*xml == '\n') - (void) CopyMagickMemory(xml,xml+1,strlen(xml)); + (void) memmove(xml,xml+1,strlen(xml)); } for (xml=p; ; ) { @@ -1455,7 +1455,7 @@ static char *ParseEntities(char *xml,char **entities,int state) xml++; } } - (void) CopyMagickMemory(xml,strchr(xml,';')+1,strlen(strchr(xml,';'))); + (void) memmove(xml,strchr(xml,';')+1,strlen(strchr(xml,';'))); } else if (((*xml == '&') && ((state == '&') || (state == ' ') || @@ -1508,7 +1508,7 @@ static char *ParseEntities(char *xml,char **entities,int state) entity=strchr(xml,';'); } if (entity != (char *) NULL) - (void) CopyMagickMemory(xml+length,entity+1,strlen(entity)); + (void) memcpy(xml+length,entity+1,strlen(entity)); (void) strncpy(xml,entities[i],length); } } @@ -1531,7 +1531,7 @@ static char *ParseEntities(char *xml,char **entities,int state) i=(ssize_t) strspn(xml,accept); if (i != 0) - (void) CopyMagickMemory(xml,xml+i,strlen(xml+i)+1); + (void) memmove(xml,xml+i,strlen(xml+i)+1); while ((*xml != '\0') && (*xml != ' ')) xml++; if (*xml == '\0') @@ -1709,7 +1709,7 @@ static MagickBooleanType ParseInternalDoctype(XMLTreeRoot *root,char *xml, predefined_entitites=(char **) AcquireMagickMemory(sizeof(sentinel)); if (predefined_entitites == (char **) NULL) ThrowFatalException(ResourceLimitError,"MemoryAllocationFailed"); - (void) CopyMagickMemory(predefined_entitites,sentinel,sizeof(sentinel)); + (void) memcpy(predefined_entitites,sentinel,sizeof(sentinel)); for (xml[length]='\0'; xml != (char *) NULL; ) { while ((*xml != '\0') && (*xml != '<') && (*xml != '%')) @@ -2377,7 +2377,7 @@ MagickExport XMLTreeInfo *NewXMLTreeTag(const char *tag) root->entities=(char **) AcquireMagickMemory(sizeof(predefined_entities)); if (root->entities == (char **) NULL) return((XMLTreeInfo *) NULL); - (void) CopyMagickMemory(root->entities,predefined_entities, + (void) memcpy(root->entities,predefined_entities, sizeof(predefined_entities)); root->root.attributes=sentinel; root->attributes=(char ***) root->root.attributes; @@ -2538,16 +2538,15 @@ MagickPrivate XMLTreeInfo *SetXMLTreeAttribute(XMLTreeInfo *xml_info, } if (xml_info->attributes[i] != (char *) NULL) xml_info->attributes[i]=DestroyString(xml_info->attributes[i]); - (void) CopyMagickMemory(xml_info->attributes+i,xml_info->attributes+i+2, - (size_t) (j-i)*sizeof(*xml_info->attributes)); + (void) memmove(xml_info->attributes+i,xml_info->attributes+i+2,(size_t) + (j-i)*sizeof(*xml_info->attributes)); xml_info->attributes=(char **) ResizeQuantumMemory(xml_info->attributes, (size_t) (j+2),sizeof(*xml_info->attributes)); if (xml_info->attributes == (char **) NULL) ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireString"); j-=2; - (void) CopyMagickMemory(xml_info->attributes[j+1]+(i/2), - xml_info->attributes[j+1]+(i/2)+1,(size_t) (((j+2)/2)-(i/2))* - sizeof(**xml_info->attributes)); + (void) memmove(xml_info->attributes[j+1]+(i/2),xml_info->attributes[j+1]+ + (i/2)+1,(size_t) (((j+2)/2)-(i/2))*sizeof(**xml_info->attributes)); return(xml_info); } diff --git a/MagickCore/xwindow.c b/MagickCore/xwindow.c index 5ca73a444..66603ab50 100644 --- a/MagickCore/xwindow.c +++ b/MagickCore/xwindow.c @@ -8418,7 +8418,7 @@ MagickPrivate void XMakeWindow(Display *display,Window parent,char **argv, if ((isspace((int) ((unsigned char) *p)) == 0) && (*p != '%')) p++; else - (void) CopyMagickString(p,p+1,MagickPathExtent-(p-geometry)); + (void) memmove(p,p+1,MagickPathExtent-(p-geometry)); } flags=XWMGeometry(display,window_info->screen,geometry,default_geometry, window_info->border_width,size_hints,&size_hints->x,&size_hints->y, diff --git a/MagickWand/magick-property.c b/MagickWand/magick-property.c index fa3f79564..c6bbdb218 100644 --- a/MagickWand/magick-property.c +++ b/MagickWand/magick-property.c @@ -721,7 +721,7 @@ WandExport unsigned char *MagickGetImageProfile(MagickWand *wand, sizeof(*datum)); if (datum == (unsigned char *) NULL) return((unsigned char *) NULL); - (void) CopyMagickMemory(datum,GetStringInfoDatum(profile), + (void) memcpy(datum,GetStringInfoDatum(profile), GetStringInfoLength(profile)); *length=(size_t) GetStringInfoLength(profile); return(datum); @@ -1811,7 +1811,7 @@ WandExport unsigned char *MagickRemoveImageProfile(MagickWand *wand, sizeof(*datum)); if (datum == (unsigned char *) NULL) return((unsigned char *) NULL); - (void) CopyMagickMemory(datum,GetStringInfoDatum(profile), + (void) memcpy(datum,GetStringInfoDatum(profile), GetStringInfoLength(profile)); *length=GetStringInfoLength(profile); profile=DestroyStringInfo(profile); diff --git a/coders/icon.c b/coders/icon.c index d73e0825e..a99c68c48 100644 --- a/coders/icon.c +++ b/coders/icon.c @@ -362,7 +362,7 @@ static Image *ReadICONImage(const ImageInfo *image_info, png=(unsigned char *) AcquireQuantumMemory(length+16,sizeof(*png)); if (png == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - (void) CopyMagickMemory(png,"\211PNG\r\n\032\n\000\000\000\015",12); + (void) memcpy(png,"\211PNG\r\n\032\n\000\000\000\015",12); png[12]=(unsigned char) icon_info.planes; png[13]=(unsigned char) (icon_info.planes >> 8); png[14]=(unsigned char) icon_info.bits_per_pixel; diff --git a/coders/jpeg.c b/coders/jpeg.c index 5eae6837e..18545e418 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -2004,14 +2004,14 @@ static void WriteProfile(j_compress_ptr jpeg_info,Image *image, tag_length=strlen(ICC_PROFILE); p=GetStringInfoDatum(custom_profile); - (void) CopyMagickMemory(p,ICC_PROFILE,tag_length); + (void) memcpy(p,ICC_PROFILE,tag_length); p[tag_length]='\0'; for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=65519L) { length=MagickMin(GetStringInfoLength(profile)-i,65519L); p[12]=(unsigned char) ((i/65519L)+1); p[13]=(unsigned char) (GetStringInfoLength(profile)/65519L+1); - (void) CopyMagickMemory(p+tag_length+3,GetStringInfoDatum(profile)+i, + (void) memcpy(p+tag_length+3,GetStringInfoDatum(profile)+i, length); jpeg_write_marker(jpeg_info,ICC_MARKER,GetStringInfoDatum( custom_profile),(unsigned int) (length+tag_length+3)); @@ -2039,7 +2039,7 @@ static void WriteProfile(j_compress_ptr jpeg_info,Image *image, } else { - (void) CopyMagickMemory(p,"Photoshop 3.0 8BIM\04\04\0\0\0\0",24); + (void) memcpy(p,"Photoshop 3.0 8BIM\04\04\0\0\0\0",24); tag_length=26; p[24]=(unsigned char) (length >> 8); p[25]=(unsigned char) (length & 0xff); diff --git a/coders/mvg.c b/coders/mvg.c index 6fa3efac9..bbc996876 100644 --- a/coders/mvg.c +++ b/coders/mvg.c @@ -211,7 +211,7 @@ static Image *ReadMVGImage(const ImageInfo *image_info,ExceptionInfo *exception) draw_info->primitive=(char *) AcquireMagickMemory(GetBlobSize(image)+1); if (draw_info->primitive != (char *) NULL) { - CopyMagickMemory(draw_info->primitive,GetBlobStreamData(image), + memcpy(draw_info->primitive,GetBlobStreamData(image), GetBlobSize(image)); draw_info->primitive[GetBlobSize(image)]='\0'; } diff --git a/coders/palm.c b/coders/palm.c index 9aa1a41fe..a36296df4 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -473,7 +473,7 @@ static Image *ReadPALMImage(const ImageInfo *image_info, one_row[i+bit]=last_row[i+bit]; } } - (void) CopyMagickMemory(last_row, one_row, bytes_per_row); + (void) memcpy(last_row, one_row, bytes_per_row); } } ptr=one_row; @@ -975,7 +975,7 @@ static MagickBooleanType WritePALMImage(const ImageInfo *image_info, (void) WriteBlobByte(image, byte); (void) WriteBlob(image,tptr-tmpbuf,(unsigned char *) tmpbuf); } - (void) CopyMagickMemory(last_row,one_row,bytes_per_row); + (void) memcpy(last_row,one_row,bytes_per_row); } else (void) WriteBlob(image,bytes_per_row,one_row); diff --git a/coders/pcd.c b/coders/pcd.c index 2f35f0c65..f2a1e9a33 100644 --- a/coders/pcd.c +++ b/coders/pcd.c @@ -464,7 +464,7 @@ static void Upsample(const size_t width,const size_t height, } p=pixels+(2*height-2)*scaled_width; q=pixels+(2*height-1)*scaled_width; - (void) CopyMagickMemory(q,p,(size_t) (2*width)); + (void) memcpy(q,p,(size_t) (2*width)); } static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception) diff --git a/coders/pcl.c b/coders/pcl.c index 077aef119..e94ae4f31 100644 --- a/coders/pcl.c +++ b/coders/pcl.c @@ -943,7 +943,7 @@ static MagickBooleanType WritePCLImage(const ImageInfo *image_info,Image *image, (double) packets); (void) WriteBlobString(image,buffer); (void) WriteBlob(image,packets,compress_pixels); - (void) CopyMagickMemory(previous_pixels,pixels,length* + (void) memcpy(previous_pixels,pixels,length* sizeof(*pixels)); break; } diff --git a/coders/pcx.c b/coders/pcx.c index a8bce1245..0c99a5e6e 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -616,7 +616,7 @@ static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) } case 8: { - (void) CopyMagickMemory(r,p,image->columns); + (void) memcpy(r,p,image->columns); break; } default: diff --git a/coders/pdb.c b/coders/pdb.c index effda78fb..7e1a80e5e 100644 --- a/coders/pdb.c +++ b/coders/pdb.c @@ -708,7 +708,7 @@ static unsigned char *EncodeRLE(unsigned char *destination, { if (literal > 0) *destination++=(unsigned char) (literal-1); - (void) CopyMagickMemory(destination,source,literal); + (void) memcpy(destination,source,literal); destination+=literal; if (repeat > 0) { @@ -798,8 +798,8 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image, pdb_info.modify_number=0; pdb_info.application_info=0; pdb_info.sort_info=0; - (void) CopyMagickMemory(pdb_info.type,"vIMG",4); - (void) CopyMagickMemory(pdb_info.id,"View",4); + (void) memcpy(pdb_info.type,"vIMG",4); + (void) memcpy(pdb_info.id,"View",4); pdb_info.seed=0; pdb_info.next_record=0; comment=GetImageProperty(image,"comment",exception); @@ -916,7 +916,7 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image, if (0x7f < literal) { q=EncodeRLE(q,buffer,(literal < 0x80 ? literal : 0x80),0); - (void) CopyMagickMemory(buffer,buffer+literal+repeat,0x80); + (void) memmove(buffer,buffer+literal+repeat,0x80); literal-=0x80; } } diff --git a/coders/pict.c b/coders/pict.c index 36125ca9c..579477146 100644 --- a/coders/pict.c +++ b/coders/pict.c @@ -485,7 +485,7 @@ static unsigned char *DecodeImage(Image *blob,Image *image, image->filename); break; } - (void) CopyMagickMemory(q,p,(size_t) number_pixels); + (void) memcpy(q,p,(size_t) number_pixels); } scanline=(unsigned char *) RelinquishMagickMemory(scanline); return(pixels); @@ -520,7 +520,7 @@ static unsigned char *DecodeImage(Image *blob,Image *image, number_pixels=length*bytes_per_pixel; p=ExpandBuffer(scanline+j+1,&number_pixels,bits_per_pixel); if ((q-pixels+number_pixels) <= *extent) - (void) CopyMagickMemory(q,p,(size_t) number_pixels); + (void) memcpy(q,p,(size_t) number_pixels); q+=number_pixels; j+=(ssize_t) (length*bytes_per_pixel+1); } @@ -532,7 +532,7 @@ static unsigned char *DecodeImage(Image *blob,Image *image, for (i=0; i < (ssize_t) length; i++) { if ((q-pixels+number_pixels) <= *extent) - (void) CopyMagickMemory(q,p,(size_t) number_pixels); + (void) memcpy(q,p,(size_t) number_pixels); q+=number_pixels; } j+=(ssize_t) bytes_per_pixel+1; diff --git a/coders/png.c b/coders/png.c index c5119e233..2cc4c38ee 100644 --- a/coders/png.c +++ b/coders/png.c @@ -1284,7 +1284,7 @@ static void PNGShort(png_bytep p,png_uint_16 value) static void PNGType(png_bytep p,const png_byte *type) { - (void) CopyMagickMemory(p,type,4*sizeof(png_byte)); + (void) memcpy(p,type,4*sizeof(png_byte)); } static void LogPNGChunk(MagickBooleanType logging, const png_byte *type, @@ -6948,7 +6948,7 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, } n=GetAuthenticPixels(image,0,0,image->columns,1,exception); - (void) CopyMagickMemory(next,n,length); + (void) memcpy(next,n,length); for (y=0; y < (ssize_t) image->rows; y++) { @@ -6975,7 +6975,7 @@ static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, { n=GetAuthenticPixels(image,0,y+1,image->columns,1, exception); - (void) CopyMagickMemory(next,n,length); + (void) memcpy(next,n,length); } for (i=0; i < m; i++, yy++) diff --git a/coders/psd.c b/coders/psd.c index 58d22ed61..02160b288 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -3081,7 +3081,7 @@ static void RemoveICCProfileFromResourceBlock(StringInfo *bim_profile) if ((quantum >= 12) && (quantum < (ssize_t) length)) { if ((q+quantum < (datum+length-16))) - (void) CopyMagickMemory(q,q+quantum,length-quantum-(q-datum)); + (void) memmove(q,q+quantum,length-quantum-(q-datum)); SetStringInfoLength(bim_profile,length-quantum); } break; @@ -3136,7 +3136,7 @@ static void RemoveResolutionFromResourceBlock(StringInfo *bim_profile) if ((id == 0x000003ed) && (cnt < (ssize_t) (length-12)) && ((ssize_t) length-(cnt+12)-(q-datum)) > 0) { - (void) CopyMagickMemory(q,q+cnt+12,length-(cnt+12)-(q-datum)); + (void) memmove(q,q+cnt+12,length-(cnt+12)-(q-datum)); SetStringInfoLength(bim_profile,length-(cnt+12)); break; } @@ -3232,7 +3232,7 @@ static const StringInfo *GetAdditionalInformation(const ImageInfo *image_info, if (found == MagickFalse) { if (remaining_length > 0) - p=(unsigned char *) CopyMagickMemory(p-12,p+size,remaining_length); + p=(unsigned char *) memmove(p-12,p+size,remaining_length); continue; } length+=(size_t) size+12; diff --git a/coders/sfw.c b/coders/sfw.c index ddd503f11..f5a786124 100644 --- a/coders/sfw.c +++ b/coders/sfw.c @@ -279,7 +279,7 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception) } TranslateSFWMarker(header); /* translate soi and app tags */ TranslateSFWMarker(header+2); - (void) CopyMagickMemory(header+6,"JFIF\0\001\0",7); /* JFIF magic */ + (void) memcpy(header+6,"JFIF\0\001\0",7); /* JFIF magic */ /* Translate remaining markers. */ diff --git a/coders/sixel.c b/coders/sixel.c index 417a011c3..b657f2fc9 100644 --- a/coders/sixel.c +++ b/coders/sixel.c @@ -373,7 +373,7 @@ MagickBooleanType sixel_decode(Image *image, } (void) memset(dmbuf, background_color_index, (size_t) dmsx * dmsy); for (y = 0; y < imsy; ++y) { - (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, imsx); + (void) memcpy(dmbuf + dmsx * y, imbuf + imsx * y, imsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; @@ -451,7 +451,7 @@ MagickBooleanType sixel_decode(Image *image, } (void) memset(dmbuf, background_color_index, (size_t) dmsx * dmsy); for (y = 0; y < imsy; ++y) { - (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, imsx); + (void) memcpy(dmbuf + dmsx * y, imbuf + imsx * y, imsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; @@ -549,7 +549,7 @@ MagickBooleanType sixel_decode(Image *image, return (MagickFalse); } for (y = 0; y < dmsy; ++y) { - (void) CopyMagickMemory(dmbuf + dmsx * y, imbuf + imsx * y, dmsx); + (void) memcpy(dmbuf + dmsx * y, imbuf + imsx * y, dmsx); } imbuf = (unsigned char *) RelinquishMagickMemory(imbuf); imsx = dmsx; @@ -596,7 +596,7 @@ static void sixel_advance(sixel_output_t *context, int nwrite) { if ((context->pos += nwrite) >= SIXEL_OUTPUT_PACKET_SIZE) { WriteBlob(context->image,SIXEL_OUTPUT_PACKET_SIZE,context->buffer); - CopyMagickMemory(context->buffer, + memcpy(context->buffer, context->buffer + SIXEL_OUTPUT_PACKET_SIZE, (context->pos -= SIXEL_OUTPUT_PACKET_SIZE)); } diff --git a/coders/sun.c b/coders/sun.c index 1a557c72d..c78fbc0ae 100644 --- a/coders/sun.c +++ b/coders/sun.c @@ -498,7 +498,7 @@ static Image *ReadSUNImage(const ImageInfo *image_info,ExceptionInfo *exception) sun_pixels=(unsigned char *) RelinquishMagickMemory(sun_pixels); ThrowReaderException(ResourceLimitError,"ImproperImageHeader"); } - (void) CopyMagickMemory(sun_pixels,sun_data,sun_info.length); + (void) memcpy(sun_pixels,sun_data,sun_info.length); } sun_data=(unsigned char *) RelinquishMagickMemory(sun_data); /* diff --git a/coders/svg.c b/coders/svg.c index 5f1b61b3d..4ae349775 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -365,7 +365,7 @@ static void StripStyleTokens(char *message) q=message+length-1; while ((isspace((int) ((unsigned char) *q)) != 0) && (q > p)) q--; - (void) CopyMagickMemory(message,p,(size_t) (q-p+1)); + (void) memcpy(message,p,(size_t) (q-p+1)); message[q-p+1]='\0'; StripString(message); } diff --git a/coders/tiff.c b/coders/tiff.c index e194736d9..f9796b5f3 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -3006,7 +3006,7 @@ static int32 TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row, Fill scanlines to tile height. */ i=(ssize_t) (row % tiff_info->tile_geometry.height)*TIFFScanlineSize(tiff); - (void) CopyMagickMemory(tiff_info->scanlines+i,(char *) tiff_info->scanline, + (void) memcpy(tiff_info->scanlines+i,(char *) tiff_info->scanline, (size_t) TIFFScanlineSize(tiff)); if (((size_t) (row % tiff_info->tile_geometry.height) != (tiff_info->tile_geometry.height-1)) && -- 2.40.0