Change ptr arg to psf_write() to const void*.

This commit is contained in:
Erik de Castro Lopo 2004-11-07 00:26:14 +00:00
parent 90d0ee803b
commit b935e188f3
3 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2004-11-07 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/file_io.c src/common.h
Change the ptr argument to psf_write() from "void*" to a "const void*".
Thanks to Tobias Gehrig for suggesting this.
2004-10-31 Erik de Castro Lopo <erikd AT mega-nerd DOT com> 2004-10-31 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/file_io.c src/common.h * src/file_io.c src/common.h

View File

@ -554,7 +554,7 @@ void psf_set_file (SF_PRIVATE *psf, int fd) ;
sf_count_t psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) ; sf_count_t psf_fseek (SF_PRIVATE *psf, sf_count_t offset, int whence) ;
sf_count_t psf_fread (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; sf_count_t psf_fread (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ;
sf_count_t psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ; sf_count_t psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t count, SF_PRIVATE *psf) ;
sf_count_t psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) ; sf_count_t psf_fgets (char *buffer, sf_count_t bufsize, SF_PRIVATE *psf) ;
sf_count_t psf_ftell (SF_PRIVATE *psf) ; sf_count_t psf_ftell (SF_PRIVATE *psf) ;
sf_count_t psf_get_filelen (SF_PRIVATE *psf) ; sf_count_t psf_get_filelen (SF_PRIVATE *psf) ;

View File

@ -324,7 +324,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
} /* psf_fread */ } /* psf_fread */
sf_count_t sf_count_t
psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ; { sf_count_t total = 0 ;
ssize_t count ; ssize_t count ;
@ -338,7 +338,7 @@ psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ /* Break the writes down to a sensible size. */ { /* Break the writes down to a sensible size. */
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ; count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ;
count = write (psf->filedes, ((char*) ptr) + total, count) ; count = write (psf->filedes, ((const char*) ptr) + total, count) ;
if (count == -1) if (count == -1)
{ if (errno == EINTR) { if (errno == EINTR)
@ -746,7 +746,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
} /* psf_fread */ } /* psf_fread */
/* Win32 */ sf_count_t /* Win32 */ sf_count_t
psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ; { sf_count_t total = 0 ;
ssize_t count ; ssize_t count ;
DWORD dwNumberOfBytesWritten ; DWORD dwNumberOfBytesWritten ;
@ -761,7 +761,7 @@ psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ /* Break the writes down to a sensible size. */ { /* Break the writes down to a sensible size. */
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
if (WriteFile ((HANDLE) psf->filedes, ((char*) ptr) + total, count, &dwNumberOfBytesWritten, 0) == 0) if (WriteFile ((HANDLE) psf->filedes, ((const char*) ptr) + total, count, &dwNumberOfBytesWritten, 0) == 0)
{ psf_log_syserr (psf, GetLastError ()) ; { psf_log_syserr (psf, GetLastError ()) ;
break ; break ;
} }
@ -1059,7 +1059,7 @@ psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
} /* psf_fread */ } /* psf_fread */
/* Win32 */ sf_count_t /* Win32 */ sf_count_t
psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) psf_fwrite (const void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ sf_count_t total = 0 ; { sf_count_t total = 0 ;
ssize_t count ; ssize_t count ;
@ -1073,7 +1073,7 @@ psf_fwrite (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf)
{ /* Break the writes down to a sensible size. */ { /* Break the writes down to a sensible size. */
count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ; count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : items ;
count = write (psf->filedes, ((char*) ptr) + total, count) ; count = write (psf->filedes, ((const char*) ptr) + total, count) ;
if (count == -1) if (count == -1)
{ if (errno == EINTR) { if (errno == EINTR)