You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2001/07/31 21:51:34 UTC

cvs commit: apr/file_io/win32 seek.c

wrowe       01/07/31 12:51:34

  Modified:    file_io/win32 seek.c
  Log:
    Missing fn
  
  Revision  Changes    Path
  1.19      +23 -1     apr/file_io/win32/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/seek.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- seek.c	2001/06/06 17:07:21	1.18
  +++ seek.c	2001/07/31 19:51:34	1.19
  @@ -89,7 +89,6 @@
   }
   
   
  -
   APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset)
   {
       apr_finfo_t finfo;
  @@ -167,4 +166,27 @@
               *offset = ((apr_off_t)offhi << 32) | offlo;
           return rc;
       }
  +}
  +
  +
  +APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *thefile, apr_off_t offset)
  +{
  +    apr_status_t rv;
  +    DWORD offlo = (DWORD)offset;
  +    DWORD offhi = (DWORD)(offset >> 32);
  +    DWORD rc;
  +
  +    rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN);
  +    if (rc == 0xFFFFFFFF)
  +        if ((rv = apr_get_os_error()) != APR_SUCCESS)
  +            return rv;
  +
  +    if (!SetEndOfFile(thefile->filehand))
  +        return apr_get_os_error();
  +
  +    if (thefile->buffered) {
  +        return setptr(thefile, offset);
  +    }
  +
  +    return APR_SUCCESS;
   }