Changed most instances of memcpy() to memmove().
authorDavid Griffith <dave@661.org>
Sat, 25 Aug 2018 22:12:04 +0000 (15:12 -0700)
committerDavid Griffith <dave@661.org>
Sat, 25 Aug 2018 22:12:04 +0000 (15:12 -0700)
The sole remainder is one of _fmemcpy() in the DOS interface code.

src/common/fastmem.c
src/common/quetzal.c
src/curses/ux_audio.c
src/sdl/sf_aiffwav.c
src/sdl/sf_font3.c
src/sdl/sf_fonts.c
src/sdl/sf_images.c
src/sdl/sf_util.c
src/sdl/sf_video.c

index 8ad1ee84db2de0cd02e3ce04d7bc265980c95b48..0f1c39e79918009761ebe47a26364943f136446a 100644 (file)
@@ -33,7 +33,6 @@
 #define malloc(size)   farmalloc (size)
 #define realloc(size,p)        farrealloc (size,p)
 #define free(size)     farfree (size)
-#define memcpy(d,s,n)  _fmemcpy (d,s,n)
 
 #else
 
@@ -476,7 +475,7 @@ void init_undo (void)
     if (undo_mem != NULL) {
        prev_zmp = undo_mem;
        undo_diff = undo_mem + h_dynamic_size;
-       memcpy (prev_zmp, zmp, h_dynamic_size);
+       memmove (prev_zmp, zmp, h_dynamic_size);
     } else
        f_setup.undo_slots = 0;
 
@@ -877,13 +876,13 @@ int restore_undo (void)
 
     /* undo possible */
 
-    memcpy (zmp, prev_zmp, h_dynamic_size);
+    memmove (zmp, prev_zmp, h_dynamic_size);
     SET_PC (curr_undo->pc);
     sp = stack + STACK_SIZE - curr_undo->stack_size;
     fp = stack + curr_undo->frame_offset;
     frame_count = curr_undo->frame_count;
     mem_undiff ((zbyte *) (curr_undo + 1), curr_undo->diff_size, prev_zmp);
-    memcpy (sp, (zbyte *)(curr_undo + 1) + curr_undo->diff_size,
+    memmove (sp, (zbyte *)(curr_undo + 1) + curr_undo->diff_size,
            curr_undo->stack_size * sizeof (*sp));
 
     curr_undo = curr_undo->prev;
@@ -1040,8 +1039,8 @@ int save_undo (void)
     p->diff_size = diff_size;
     p->stack_size = stack_size;
     p->frame_offset = fp - stack;
-    memcpy (p + 1, undo_diff, diff_size);
-    memcpy ((zbyte *)(p + 1) + diff_size, sp, stack_size * sizeof (*sp));
+    memmove (p + 1, undo_diff, diff_size);
+    memmove ((zbyte *)(p + 1) + diff_size, sp, stack_size * sizeof (*sp));
 
     if (!first_undo) {
        p->prev = NULL;
index e687075973d20bb088e2d4e25ab835f1759f541a..31f3f13c0ebf3432d30a5d7a53708788f2ff2714 100644 (file)
@@ -29,7 +29,6 @@
 #define malloc(size)   farmalloc (size)
 #define realloc(size,p)        farrealloc (size,p)
 #define free(size)     farfree (size)
-#define memcpy(d,s,n)  _fmemcpy (d,s,n)
 
 #else
 
index a4770eb0807e3aa9ee0512be6b9e8f3d799de98a..7b1e2d4a17dbdc0a0464130655e33930349207aa 100644 (file)
@@ -602,7 +602,7 @@ void *playaiff(EFFECT *raw_effect)
             stereoize(bleep_buffer.samples, floatbuffer2, src_data.output_frames_gen);
         } else {
             /* It's already stereo.  Just copy the buffer. */
-            memcpy(bleep_buffer.samples, floatbuffer2, sizeof(float) * src_data.output_frames_gen * 2);
+            memmove(bleep_buffer.samples, floatbuffer2, sizeof(float) * src_data.output_frames_gen * 2);
         }
 
         /* Adjust volume. */
index 8b9c8e39ae3ad0414ebbfc5563d0c4be8c3c1ff0..e14ef44870c9f7daf15e71ac0aab310440ecec80 100644 (file)
@@ -292,11 +292,11 @@ static void writeRIFFheader( unsigned char *f, int freq, int numsamples, int num
        int bytespersample){
        // write header
        // offset 0
-  memcpy(f,"RIFF",4); f += 4;
+  memmove(f,"RIFF",4); f += 4;
        // offset 4
   PCwrite4(f,(36+numsamples*numchannels*bytespersample));
        // offset 8
-  memcpy(f,"WAVEfmt ",8); f += 8;
+  memmove(f,"WAVEfmt ",8); f += 8;
        // offset 16
   PCwrite4(f,16);
        // offset 20
@@ -312,7 +312,7 @@ static void writeRIFFheader( unsigned char *f, int freq, int numsamples, int num
        // offset 34
   PCwrite2(f,(8*bytespersample));
        // offset 36
-  memcpy(f,"data",4); f += 4;
+  memmove(f,"data",4); f += 4;
        // offset 40
   PCwrite4(f,(numsamples*numchannels*bytespersample));
        // offset 44
index 2220993a29d9cf2d9a28fdb4803f342fdee0f47c..053a8907194aa158a3bf17133a579cd2d0f51bbf 100644 (file)
@@ -125,7 +125,7 @@ static SF_glyph * mygetglyph(SFONT *s, word c, int allowdef)
     c = 32;
     }
   src = Zfont3+8*(c-32);
-  memcpy(&(myglyph.bitmap[0]),src,8);
+  memmove(&(myglyph.bitmap[0]),src,8);
   myglyph.h = 8;
   return (SF_glyph *)&myglyph;
   }
index cc9a183befec74f0d10c9f485386196dcfd3b071..2d236a5c4885b48e9328c317cfd555f0fed0beaf 100644 (file)
@@ -165,7 +165,7 @@ static SF_bdffont *sBDXload( FILE *f, int *err, int *size, int MAXCHAR){
   font = calloc(1,totb);
   if (!font) ERRET(-3) // errorexit(99,"malloc()\n");
 //printf("allocated: %p-%p\n",font,((byte *)font)+totb);
-//  memcpy(&(font->magic[0]),"gBDX",4);
+//  memmove(&(font->magic[0]),"gBDX",4);
   font->minchar = minch;
   font->maxchar = maxch;
   font->defchar = defchar;
@@ -174,9 +174,9 @@ static SF_bdffont *sBDXload( FILE *f, int *err, int *size, int MAXCHAR){
   pbeg = (byte *)font;
   po = (byte *)(&(font->glyphs[maxch-minch+1]));
   k = strlen(fontname)+1;
-  memcpy(po,fontname,k); po += k; if (fngot) free(fontname);
+  memmove(po,fontname,k); po += k; if (fngot) free(fontname);
   k = strlen(copyright)+1;
-  memcpy(po,copyright,k); po += k; if (cpgot) free(copyright);
+  memmove(po,copyright,k); po += k; if (cpgot) free(copyright);
   for (i=minch;i<=maxch;i++) font->glyphs[i-minch] = 0;
 
        // second pass
@@ -758,7 +758,7 @@ void sf_initfonts()
   if (!emph) os_fatal("malloc() failure in initfonts()");
   Emph = makefont(emph);
   if (!Emph) os_fatal("malloc() failure in initfonts()");
-  memcpy (emph, norm, size);
+  memmove (emph, norm, size);
        // emphasize (underline)...
   cfont = (byte *)emph;
   for (i = norm->minchar;i <= norm->maxchar;i++){
@@ -773,7 +773,7 @@ void sf_initfonts()
   if (!bold) os_fatal("malloc() failure in initfonts()");
   Bold = makefont(bold);
   if (!Bold) os_fatal("malloc() failure in initfonts()");
-  memcpy (bold, norm, size);
+  memmove (bold, norm, size);
        // boldify...
   cfont = (byte *)bold;
   for (i = norm->minchar;i <= norm->maxchar;i++){
@@ -792,7 +792,7 @@ void sf_initfonts()
   if (!bemp) os_fatal("malloc() failure in initfonts()");
   Bemp = makefont(bemp);
   if (!Bemp) os_fatal("malloc() failure in initfonts()");
-  memcpy (bemp, bold, size);
+  memmove (bemp, bold, size);
        // emphasize (underline)...
   cfont = (byte *)bemp;
   for (i = norm->minchar;i <= norm->maxchar;i++){
index 28b6a1b20cf182439def11aa921404e5a37a5298..d0a2848a564685cb9847bc358c472adad7f13723 100644 (file)
@@ -53,7 +53,7 @@ static void readPNGData(
        png_structp png_ptr, png_bytep data, png_size_t length)
   {
   PNGData* pngData = (PNGData*)png_get_io_ptr(png_ptr);
-  memcpy(data,pngData->gfxData+pngData->offset,length);
+  memmove(data,pngData->gfxData+pngData->offset,length);
   pngData->offset += length;
   }
 
index 4ff43d97d9beb7e163a98ad13b274edfc6fae425..f742dfab406649f8e9a4953455955c500515811f 100644 (file)
@@ -892,7 +892,7 @@ static int myunzip( int csize, byte *cdata, byte *udata)
   unsigned myin( void *d, byte **b){return 0;}
   int myout( void *d, byte *b, unsigned n)
        {
-       memcpy(udata,b,n); udata += n;
+       memmove(udata,b,n); udata += n;
        return 0;
        }
 
index 1a4b047ffdf3ecd1f4b7346015f9354878bc89ae..714588dd8da4c68b87305da5bcc0df7264e5bb7c 100644 (file)
@@ -334,7 +334,7 @@ static void scroll( int x, int y, int w, int h, int n)
     {
     while (nmove--)
        {
-       memcpy(dst,src,w*sizeof(ulong));
+       memmove(dst,src,w*sizeof(ulong));
        dst += step;
        src += step;
        }
@@ -1102,7 +1102,7 @@ ulong * sf_savearea( int x, int y, int w, int h)
   s = sbuffer+x+y*sbpitch;
   for (i=0;i<h;i++)
        {
-       memcpy(p,s,w*sizeof(ulong));
+       memmove(p,s,w*sizeof(ulong));
        p += w;
        s += sbpitch;
        }
@@ -1125,7 +1125,7 @@ void sf_restoreareaandfree( ulong *s)
   d = sbuffer+x+y*sbpitch;
   for (i=0;i<h;i++)
        {
-       memcpy(d,p,w*sizeof(ulong));
+       memmove(d,p,w*sizeof(ulong));
        p += w;
        d += sbpitch;
        }