mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
C code bug fixes
- fix to buildin.c to prevent compiler from optimizing it out - fix to realpath.c to handle case where 'path' is NULL - fix to emacs.c (I think from dgk) - fix to file.c (I think from gsf) - fix to tail.c (I think from gsf) - fix to code setting the malloc init hook (for vmalloc) - changed memcpy to memmove in several places in sfio because src and dst might overlap - fixes to macros like FILE_defined to fix header file issues - fixes to expr.h to handle macro definition issue
This commit is contained in:
parent
0b36868c8c
commit
e8b3274a65
17 changed files with 62 additions and 36 deletions
|
|
@ -96,7 +96,7 @@ int c; /* if c>=0, c is also written out */
|
|||
isall = SFISALL(f,isall);
|
||||
if((w = SFWR(f,data,n,f->disc)) > 0)
|
||||
{ if((n -= w) > 0) /* save unwritten data, then resume */
|
||||
memcpy((char*)f->data,(char*)data+w,n);
|
||||
memmove((char*)f->data,(char*)data+w,n);
|
||||
written += w;
|
||||
f->next = f->data+n;
|
||||
if(c < 0 && (!isall || n == 0))
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ reg int rc; /* record separator */
|
|||
{ /* move left-over to read stream */
|
||||
if(w > fr->size)
|
||||
w = fr->size;
|
||||
memcpy((Void_t*)fr->data,(Void_t*)cp,w);
|
||||
memmove((Void_t*)fr->data,(Void_t*)cp,w);
|
||||
fr->endb = fr->data+w;
|
||||
if((w = endb - (cp+w)) > 0)
|
||||
(void)SFSK(fr,(Sfoff_t)(-w),SEEK_CUR,fr->disc);
|
||||
|
|
@ -200,7 +200,7 @@ reg int rc; /* record separator */
|
|||
{ if(direct == SF_WRITE)
|
||||
fw->next += r;
|
||||
else if(r <= (fw->endb-fw->next) )
|
||||
{ memcpy((Void_t*)fw->next,(Void_t*)next,r);
|
||||
{ memmove((Void_t*)fw->next,(Void_t*)next,r);
|
||||
fw->next += r;
|
||||
}
|
||||
else if((w = SFWRITE(fw,(Void_t*)next,r)) != r)
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ int n; /* current position in pool */
|
|||
else /* write failed, recover buffer then quit */
|
||||
{ if(w > 0)
|
||||
{ v -= w;
|
||||
memcpy(head->data,(head->data+w),v);
|
||||
memmove(head->data,(head->data+w),v);
|
||||
}
|
||||
head->next = head->data+v;
|
||||
goto done;
|
||||
|
|
@ -147,7 +147,7 @@ int n; /* current position in pool */
|
|||
|
||||
/* move data from head to f */
|
||||
if((head->data+k) != f->data )
|
||||
memcpy(f->data,(head->data+k),v);
|
||||
memmove(f->data,(head->data+k),v);
|
||||
f->next = f->data+v;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ Sfdisc_t* disc;
|
|||
if(buf)
|
||||
{ if(n > (size_t)(r-a))
|
||||
n = (ssize_t)(r-a);
|
||||
memcpy(buf,f->next,n);
|
||||
memmove(buf,f->next,n);
|
||||
f->next += n;
|
||||
}
|
||||
else n = f->endb - f->next;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ size_t n; /* number of bytes to be read. */
|
|||
{ if(r > (ssize_t)n)
|
||||
r = (ssize_t)n;
|
||||
if(s != f->next)
|
||||
memcpy(s, f->next, r);
|
||||
memmove(s, f->next, r);
|
||||
f->next += r;
|
||||
s += r;
|
||||
n -= r;
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ Void_t* mbs; /* multibyte parsing state */
|
|||
/* shift left data so that there will be more room to back up on error.
|
||||
this won't help streams with small buffers - c'est la vie! */
|
||||
if(sc->d > sc->f->data && (n = sc->endd - sc->d) > 0 && n < SFMBMAX)
|
||||
{ memcpy(sc->f->data, sc->d, n);
|
||||
{ memmove(sc->f->data, sc->d, n);
|
||||
if(sc->f->endr == sc->f->endb)
|
||||
sc->f->endr = sc->f->data+n;
|
||||
if(sc->f->endw == sc->f->endb)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue