paragui-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[paragui-cvs] CVS: paragui/src/physfs .cvsignore,1.2.2.2,1.2.2.3 CHANGEL


From: Alexander Pipelka <address@hidden>
Subject: [paragui-cvs] CVS: paragui/src/physfs .cvsignore,1.2.2.2,1.2.2.3 CHANGELOG,1.1.1.1.2.2,1.1.1.1.2.3 CREDITS,1.3.2.2,1.3.2.3 TODO,1.1.1.1.2.2,1.1.1.1.2.3 configure.in,1.3.2.2,1.3.2.3 physfs.c,1.2.2.2,1.2.2.3 physfs.h,1.2.2.1,1.2.2.2 physfs_byteorder.c,1.1.4.2,1.1.4.3 physfs_internal.h,1.2.2.2,1.2.2.3 Makefile.am,1.2.2.3,NONE
Date: Mon, 03 Feb 2003 16:04:59 -0500

Update of /cvsroot/paragui/paragui/src/physfs
In directory subversions:/tmp/cvs-serv30594/src/physfs

Modified Files:
      Tag: devel-opengl
        .cvsignore CHANGELOG CREDITS TODO configure.in physfs.c 
        physfs.h physfs_byteorder.c physfs_internal.h 
Removed Files:
      Tag: devel-opengl
        Makefile.am 
Log Message:
- some work on the factory and layout loader
- updated physfs version
- minor automake fixes



Index: .cvsignore
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/.cvsignore,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** .cvsignore  30 Oct 2002 20:15:17 -0000      1.2.2.2
--- .cvsignore  3 Feb 2003 21:04:56 -0000       1.2.2.3
***************
*** 1,51 ****
! depcomp
  Makefile
! .deps
! .libs
  aclocal.m4
! config.status
! ltmain.sh
  configure
! libtool
! physfs.lo
! config.guess
  install-sh
! config.log
! config.sub
  missing
- stamp-h
  mkinstalldirs
! config.h
! Makefile.in
! config.h.in
! libphysfs.la
! stamp-h.in
  stamp-h1
! physfs_byteorder.lo
! ltconfig
! inftrees.lo
! trees.lo
! uncompr.lo
! zutil.lo
! infcodes.lo
! unzip.lo
! inflate.lo
! adler32.lo
! posix.lo
! infblock.lo
! compress.lo
! dir.lo
! inffast.lo
! grp.lo
! test_physfs
! unix.lo
! crc32.lo
! zip.lo
! infutil.lo
! deflate.lo
! beos.lo
! Makefile.am
! config.cache
! autom4te.cache
! configure.lineno
! physfs.spec
--- 1,37 ----
! VisualC.zip
  Makefile
! Makefile.in
! Makefile.am
! libtool
! paragui-config
  aclocal.m4
! config.h.in
  configure
! stamp-h
! stamp-h.in
! *.tar.gz
! *.kdevses
! *.kdevprj
! paragui.pc
! config.*
! depcomp
  install-sh
! ltmain.sh
  missing
  mkinstalldirs
! *.prw
! *.pws
! *.prj
! *.patch
! *.kdevelop
! *.cache
! *.mlz
! *.rtf
! .deps
! .libs
! *.la
! *.lo
! *.ori
! *.spec
  stamp-h1
! 

Index: CHANGELOG
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/CHANGELOG,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** CHANGELOG   30 Oct 2002 20:15:17 -0000      1.1.1.1.2.2
--- CHANGELOG   3 Feb 2003 21:04:56 -0000       1.1.1.1.2.3
***************
*** 3,6 ****
--- 3,20 ----
   */
  
+ 12172002 - Added Apple Project Builder support files (thanks, Eric Wing!).
+ 12112002 - Added Ruby bindings to extras directory (thanks, Ed Sinjiashvili!).
+            Patched win32.c to compile with Mingw32 (thanks, Niels Wagenaar!).
+ 12032002 - Adam updated his extras/abs-file.h for the new buffering API.
+ 12022002 - German translation added, compliments of Michael Renner.
+ 12012002 - Minor fix to configure.in: reported --enable-debug's default
+            setting incorrectly. Added buffering to the API: you can now
+            buffer a file with PHYSFS_setBuffer(), and flush the buffer to
+            disk with PHYSFS_flush(). PhysicsFS file handles are unbuffered
+            by default (as they were before this API addition), so this does
+            not break the API. Other fixes for bugs I stumbled upon during
+            this work are in CVS, too.
+ 11292002 - Minor fix for strange PATH strings in unix.c (thanks, Alexander!)
+ 11222002 - Initial PocketPC port by Corona688.
  10222002 - Fixed segfault in test_physfs.c when user hits CTRL-D (and
             readline() thus returns NULL)...now gracefully exits, as it should.

Index: CREDITS
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/CREDITS,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** CREDITS     30 Oct 2002 20:15:17 -0000      1.3.2.2
--- CREDITS     3 Feb 2003 21:04:56 -0000       1.3.2.3
***************
*** 37,40 ****
--- 37,41 ----
  
  Russian translation,
+ Ruby bindings,
  QPAK archiver:
      Ed Sinjiashvili
***************
*** 51,54 ****
--- 52,64 ----
  "abs-file.h" in "extras" dir:
      Adam D. Moss
+ 
+ WinCE port and other Win32 patches:
+     Corona688
+ 
+ German translation:
+     Michael Renner
+ 
+ Apple Project Builder support:
+     Eric Wing
  
  Other stuff:

Index: TODO
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/TODO,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -C2 -r1.1.1.1.2.2 -r1.1.1.1.2.3
*** TODO        30 Oct 2002 20:15:17 -0000      1.1.1.1.2.2
--- TODO        3 Feb 2003 21:04:56 -0000       1.1.1.1.2.3
***************
*** 1,5 ****
  Stuff that needs to be done and wishlist:
  
! These are in no particular order. A 1.0 release is reliant on doing most of
   this stuff. Some might be dupes, some might be done already.
  
--- 1,5 ----
  Stuff that needs to be done and wishlist:
  
! These are in no particular order. A 1.0 release is reliant on doing some of
   this stuff. Some might be dupes, some might be done already.
  
***************
*** 11,15 ****
    nice for an email program. That's blue sky, unless someone wants to tackle
    it.
- - Need PHYSFS_LANG_GERMAN.
  - I'm a little nervous about the use of linked lists in qpak.c.
  - Add qpak.c and PHYSFS_SUPPORTS_QPAK to mac classic projects.
--- 11,14 ----
***************
*** 23,27 ****
  - We have two different ways to find dir entries in zip.c.
  - Do symlinks in zip archiver work when they point to dirs?
- - Is building internal zlib broken?
  - Enable more warnings?
  - Use __cdecl in physfs.h?
--- 22,25 ----

Index: configure.in
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/configure.in,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -r1.3.2.2 -r1.3.2.3
*** configure.in        30 Oct 2002 20:15:17 -0000      1.3.2.2
--- configure.in        3 Feb 2003 21:04:56 -0000       1.3.2.3
***************
*** 67,71 ****
  
  AC_ARG_ENABLE(debug,
! [  --enable-debug             enable debug mode [default=yes]],
                  , enable_debug=no)
  if test x$enable_debug = xyes; then
--- 67,71 ----
  
  AC_ARG_ENABLE(debug,
! [  --enable-debug             enable debug mode [default=no]],
                  , enable_debug=no)
  if test x$enable_debug = xyes; then
***************
*** 295,298 ****
--- 295,302 ----
  fi
  
+ if test x$physfslang = xgerman; then
+   physfs_valid_lang=yes
+   AC_DEFINE([PHYSFS_LANG], PHYSFS_LANG_GERMAN, [define desired natural 
language])
+ fi
  
  dnl Add other language checks here...
***************
*** 437,441 ****
  # Checks for header files.
  AC_HEADER_STDC
! AC_CHECK_HEADERS([stdlib.h string.h])
  
  # Checks for typedefs, structures, and compiler characteristics.
--- 441,445 ----
  # Checks for header files.
  AC_HEADER_STDC
! AC_CHECK_HEADERS([stdlib.h string.h assert.h])
  
  # Checks for typedefs, structures, and compiler characteristics.

Index: physfs.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/physfs.c,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** physfs.c    30 Oct 2002 20:15:17 -0000      1.2.2.2
--- physfs.c    3 Feb 2003 21:04:56 -0000       1.2.2.3
***************
*** 21,26 ****
  #include <stdlib.h>
  #include <string.h>
- #include <fcntl.h>
- #include <errno.h>
  #include "physfs.h"
  
--- 21,24 ----
***************
*** 1230,1239 ****
              {
                  __PHYSFS_setError(ERR_SYMLINK_DISALLOWED);
!                 retval = 0;
              } /* if */
  
!             /* break out early if path element is missing or it's a symlink. 
*/
              if (!retval)
                  break;
          } /* if */
  
--- 1228,1247 ----
              {
                  __PHYSFS_setError(ERR_SYMLINK_DISALLOWED);
!                 free(str);
!                 return(0); /* insecure. */
              } /* if */
  
!             /* break out early if path element is missing. */
              if (!retval)
+             {
+                 /*
+                  * We need to clear it if it's the last element of the path,
+                  *  since this might be a non-existant file we're opening
+                  *  for writing...
+                  */
+                 if (end == NULL)
+                     retval = 1;
                  break;
+             } /* if */
          } /* if */
  
***************
*** 1572,1575 ****
--- 1580,1586 ----
      else
      {
+         rc->buffer = NULL;  /* just in case. */
+         rc->buffill = rc->bufpos = rc->bufsize = 0;  /* just in case. */
+         rc->forReading = 0;
          list->handle.opaque = (void *) rc;
          list->next = openWriteList;
***************
*** 1618,1628 ****
  
      list = (FileHandleList *) malloc(sizeof (FileHandleList));
!     BAIL_IF_MACRO(!list, ERR_OUT_OF_MEMORY, NULL);
      list->handle.opaque = (void *) rc;
      list->next = openReadList;
      openReadList = list;
      retval = &(list->handle);
- 
      __PHYSFS_platformReleaseMutex(stateLock);
      return(retval);
  } /* PHYSFS_openRead */
--- 1629,1643 ----
  
      list = (FileHandleList *) malloc(sizeof (FileHandleList));
!     BAIL_IF_MACRO_MUTEX(!list, ERR_OUT_OF_MEMORY, stateLock, NULL);
      list->handle.opaque = (void *) rc;
      list->next = openReadList;
      openReadList = list;
      retval = &(list->handle);
      __PHYSFS_platformReleaseMutex(stateLock);
+ 
+     rc->buffer = NULL;  /* just in case. */
+     rc->buffill = rc->bufpos = rc->bufsize = 0;  /* just in case. */
+     rc->forReading = 1;
+ 
      return(retval);
  } /* PHYSFS_openRead */
***************
*** 1634,1638 ****
      FileHandleList *prev = NULL;
      FileHandleList *i;
!     int rc;
  
      for (i = *list; i != NULL; i = i->next)
--- 1649,1653 ----
      FileHandleList *prev = NULL;
      FileHandleList *i;
!     int rc = 1;
  
      for (i = *list; i != NULL; i = i->next)
***************
*** 1640,1647 ****
          if (&i->handle == handle)  /* handle is in this list? */
          {
!             rc = h->funcs->fileClose(h);
              if (!rc)
                  return(-1);
  
              if (prev == NULL)
                  *list = i->next;
--- 1655,1668 ----
          if (&i->handle == handle)  /* handle is in this list? */
          {
!             PHYSFS_uint8 *tmp = h->buffer;
!             rc = PHYSFS_flush(handle);
!             if (rc)
!                 rc = h->funcs->fileClose(h);
              if (!rc)
                  return(-1);
  
+             if (tmp != NULL)  /* free any associated buffer. */
+                 free(tmp);
+ 
              if (prev == NULL)
                  *list = i->next;
***************
*** 1680,1695 ****
--- 1701,1790 ----
  
  
+ static PHYSFS_sint64 doBufferedRead(PHYSFS_file *handle, void *buffer,
+                                     PHYSFS_uint32 objSize,
+                                     PHYSFS_uint32 objCount)
+ {
+     FileHandle *h = (FileHandle *) handle->opaque;
+     PHYSFS_sint64 retval = 0;
+     PHYSFS_uint32 remainder = 0;
+ 
+     while (objCount > 0)
+     {
+         PHYSFS_uint64 buffered = h->buffill - h->bufpos;
+         PHYSFS_uint64 mustread = (objSize * objCount) - remainder;
+         PHYSFS_uint32 copied;
+ 
+         if (buffered == 0) /* need to refill buffer? */
+         {
+             PHYSFS_sint64 rc = h->funcs->read(h, h->buffer, 1, h->bufsize);
+             if (rc <= 0)
+             {
+                 h->bufpos -= remainder;
+                 return(((rc == -1) && (retval == 0)) ? -1 : retval);
+             } /* if */
+ 
+             buffered = h->buffill = rc;
+             h->bufpos = 0;
+         } /* if */
+ 
+         if (buffered > mustread)
+             buffered = mustread;
+ 
+         memcpy(buffer, h->buffer + h->bufpos, (size_t) buffered);
+         buffer = ((PHYSFS_uint8 *) buffer) + buffered;
+         h->bufpos += buffered;
+         buffered += remainder;  /* take remainder into account. */
+         copied = (buffered / objSize);
+         remainder = (buffered % objSize);
+         retval += copied;
+         objCount -= copied;
+     } /* while */
+ 
+     return(retval);
+ } /* doBufferedRead */
+ 
+ 
  PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer,
                            PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  {
      FileHandle *h = (FileHandle *) handle->opaque;
+ 
+     BAIL_IF_MACRO(!h->forReading, ERR_FILE_ALREADY_OPEN_W, -1);
+     if (h->buffer != NULL)
+         return(doBufferedRead(handle, buffer, objSize, objCount));
+ 
      return(h->funcs->read(h, buffer, objSize, objCount));
  } /* PHYSFS_read */
  
  
+ static PHYSFS_sint64 doBufferedWrite(PHYSFS_file *handle, const void *buffer,
+                                      PHYSFS_uint32 objSize,
+                                      PHYSFS_uint32 objCount)
+ {
+     FileHandle *h = (FileHandle *) handle->opaque;
+ 
+     /* whole thing fits in the buffer? */
+     if (h->buffill + (objSize * objCount) < h->bufsize)
+     {
+         memcpy(h->buffer + h->buffill, buffer, objSize * objCount);
+         h->buffill += (objSize * objCount);
+         return(objCount);
+     } /* if */
+ 
+     /* would overflow buffer. Flush and then write the new objects, too. */
+     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, -1);
+     return(h->funcs->write(h, buffer, objSize, objCount));
+ } /* doBufferedWrite */
+ 
+ 
  PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle, const void *buffer,
                             PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
  {
      FileHandle *h = (FileHandle *) handle->opaque;
+ 
+     BAIL_IF_MACRO(h->forReading, ERR_FILE_ALREADY_OPEN_R, -1);
+     if (h->buffer != NULL)
+         return(doBufferedWrite(handle, buffer, objSize, objCount));
+ 
      return(h->funcs->write(h, buffer, objSize, objCount));
  } /* PHYSFS_write */
***************
*** 1699,1703 ****
  {
      FileHandle *h = (FileHandle *) handle->opaque;
!     return(h->funcs->eof(h));
  } /* PHYSFS_eof */
  
--- 1794,1803 ----
  {
      FileHandle *h = (FileHandle *) handle->opaque;
! 
!     if (!h->forReading)  /* never EOF on files opened for write/append. */
!         return(0);
! 
!     /* eof if buffer is empty and archiver says so. */
!     return((h->bufpos == h->buffill) && (h->funcs->eof(h)));
  } /* PHYSFS_eof */
  
***************
*** 1706,1710 ****
  {
      FileHandle *h = (FileHandle *) handle->opaque;
!     return(h->funcs->tell(h));
  } /* PHYSFS_tell */
  
--- 1806,1813 ----
  {
      FileHandle *h = (FileHandle *) handle->opaque;
!     PHYSFS_sint64 retval = h->forReading ?
!                             (h->funcs->tell(h) - h->buffill) + h->bufpos :
!                             (h->funcs->tell(h) + h->buffill);
!     return(retval);
  } /* PHYSFS_tell */
  
***************
*** 1713,1716 ****
--- 1816,1820 ----
  {
      FileHandle *h = (FileHandle *) handle->opaque;
+     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
      return(h->funcs->seek(h, pos));
  } /* PHYSFS_seek */
***************
*** 1722,1725 ****
--- 1826,1888 ----
      return(h->funcs->fileLength(h));
  } /* PHYSFS_filelength */
+ 
+ 
+ int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 bufsize)
+ {
+     FileHandle *h = (FileHandle *) handle->opaque;
+ 
+     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
+ 
+     /*
+      * For reads, we need to move the file pointer to where it would be
+      *  if we weren't buffering, so that the next read will get the
+      *  right chunk of stuff from the file. PHYSFS_flush() handles writes.
+      */
+     if ((h->forReading) && (h->buffill != h->bufpos))
+     {
+         PHYSFS_uint64 pos;
+         PHYSFS_sint64 curpos = h->funcs->tell(h);
+         BAIL_IF_MACRO(curpos == -1, NULL, 0);
+         pos = ((curpos - h->buffill) + h->bufpos);
+         BAIL_IF_MACRO(!h->funcs->seek(h, pos), NULL, 0);
+     } /* if */
+ 
+     if (bufsize == 0)  /* delete existing buffer. */
+     {
+         if (h->buffer != NULL)
+         {
+             free(h->buffer);
+             h->buffer = NULL;
+         } /* if */
+     } /* if */
+ 
+     else
+     {
+         PHYSFS_uint8 *newbuf = realloc(h->buffer, bufsize);
+         BAIL_IF_MACRO(newbuf == NULL, ERR_OUT_OF_MEMORY, 0);
+         h->buffer = newbuf;
+     } /* else */
+ 
+     h->bufsize = bufsize;
+     h->buffill = h->bufpos = 0;
+     return(1);
+ } /* PHYSFS_setBuffer */
+ 
+ 
+ int PHYSFS_flush(PHYSFS_file *handle)
+ {
+     FileHandle *h = (FileHandle *) handle->opaque;
+     PHYSFS_sint64 rc;
+ 
+     if ((h->forReading) || (h->bufpos == h->buffill))
+         return(1);  /* open for read or buffer empty are successful no-ops. */
+ 
+     /* dump buffer to disk. */
+     rc = h->funcs->write(h, h->buffer + h->bufpos, h->buffill - h->bufpos, 1);
+     BAIL_IF_MACRO(rc <= 0, NULL, 0);
+ 
+     h->bufpos = h->buffill = 0;
+     return(1);
+ } /* PHYSFS_flush */
  
  

Index: physfs.h
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/physfs.h,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -C2 -r1.2.2.1 -r1.2.2.2
*** physfs.h    31 Aug 2002 04:01:23 -0000      1.2.2.1
--- physfs.h    3 Feb 2003 21:04:56 -0000       1.2.2.2
***************
*** 259,262 ****
--- 259,264 ----
   * \sa PHYSFS_tell
   * \sa PHYSFS_eof
+  * \sa PHYSFS_setBuffer
+  * \sa PHYSFS_flush
   */
  typedef struct
***************
*** 290,293 ****
--- 292,296 ----
  } PHYSFS_ArchiveInfo;
  
+ 
  /**
   * \struct PHYSFS_Version
***************
*** 316,319 ****
--- 319,325 ----
  #endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
  
+ 
+ /* PhysicsFS state stuff ... */
+ 
  /**
   * \def PHYSFS_VERSION(x)
***************
*** 776,779 ****
--- 782,787 ----
  
  
+ /* Directory management stuff ... */
+ 
  /**
   * \fn int PHYSFS_mkdir(const char *dirName)
***************
*** 857,861 ****
  
  
- 
  /**
   * \fn char **PHYSFS_enumerateFiles(const char *dir)
--- 865,868 ----
***************
*** 958,961 ****
--- 965,986 ----
  
  /**
+  * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
+  * \brief Get the last modification time of a file.
+  *
+  * The modtime is returned as a number of seconds since the epoch
+  *  (Jan 1, 1970). The exact derivation and accuracy of this time depends on
+  *  the particular archiver. If there is no reasonable way to obtain this
+  *  information for a particular archiver, or there was some sort of error,
+  *  this function returns (-1).
+  *
+  *   \param filename filename to check, in platform-independent notation.
+  *  \return last modified time of the file. -1 if it can't be determined.
+  */
+ __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
+ 
+ 
+ /* i/o stuff... */
+ 
+ /**
   * \fn PHYSFS_file *PHYSFS_openWrite(const char *filename)
   * \brief Open a file for writing.
***************
*** 1055,1074 ****
  
  /**
-  * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
-  * \brief Get the last modification time of a file.
-  *
-  * The modtime is returned as a number of seconds since the epoch
-  *  (Jan 1, 1970). The exact derivation and accuracy of this time depends on
-  *  the particular archiver. If there is no reasonable way to obtain this
-  *  information for a particular archiver, or there was some sort of error,
-  *  this function returns (-1).
-  *
-  *   \param filename filename to check, in platform-independent notation.
-  *  \return last modified time of the file. -1 if it can't be determined.
-  */
- __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
- 
- 
- /**
   * \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle, void *buffer, 
PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
   * \brief Read data from a PhysicsFS filehandle
--- 1080,1083 ----
***************
*** 1109,1112 ****
--- 1118,1124 ----
                                        PHYSFS_uint32 objCount);
  
+ 
+ /* File position stuff... */
+ 
  /**
   * \fn int PHYSFS_eof(PHYSFS_file *handle)
***************
*** 1171,1174 ****
--- 1183,1250 ----
   */
  __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_file *handle);
+ 
+ 
+ /* Buffering stuff... */
+ 
+ /**
+  * \fn int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 bufsize)
+  * \brief Set up buffering for a PhysicsFS file handle.
+  *
+  * Define an i/o buffer for a file handle. A memory block of (bufsize) bytes
+  *  will be allocated and associated with (handle).
+  *
+  * For files opened for reading, up to (bufsize) bytes are read from (handle)
+  *  and stored in the internal buffer. Calls to PHYSFS_read() will pull
+  *  from this buffer until it is empty, and then refill it for more reading.
+  *  Note that compressed files, like ZIP archives, will decompress while
+  *  buffering, so this can be handy for offsetting CPU-intensive operations.
+  *  The buffer isn't filled until you do your next read.
+  *
+  * For files opened for writing, data will be buffered to memory until the
+  *  buffer is full or the buffer is flushed. Closing a handle implicitly
+  *  causes a flush...check your return values!
+  *
+  * Seeking, etc transparently accounts for buffering.
+  *
+  * You can resize an existing buffer by calling this function more than once
+  *  on the same file. Setting the buffer size to zero will free an existing
+  *  buffer.
+  *
+  * PhysicsFS file handles are unbuffered by default.
+  *
+  * Please check the return value of this function! Failures can include
+  *  not being able to seek backwards in a read-only file when removing the
+  *  buffer, not being able to allocate the buffer, and not being able to
+  *  flush the buffer to disk, among other unexpected problems.
+  *
+  *   \param handle handle returned from PHYSFS_open*().
+  *   \param bufsize size, in bytes, of buffer to allocate.
+  *  \return nonzero if successful, zero on error.
+  *
+  * \sa PHYSFS_flush
+  * \sa PHYSFS_read
+  * \sa PHYSFS_write
+  * \sa PHYSFS_close
+  */
+ __EXPORT__ int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 bufsize);
+ 
+ 
+ /**
+  * \fn int PHYSFS_flush(PHYSFS_file *handle, PHYSFS_uint64 bufsize)
+  * \brief Flush a buffered PhysicsFS file handle.
+  *
+  * For buffered files opened for writing, this will put the current contents
+  *  of the buffer to disk and flag the buffer as empty if possible.
+  *
+  * For buffered files opened for reading or unbuffered files, this is a safe
+  *  no-op, and will report success.
+  *
+  *   \param handle handle returned from PHYSFS_open*().
+  *  \return nonzero if successful, zero on error.
+  *
+  * \sa PHYSFS_setBuffer
+  * \sa PHYSFS_close
+  */
+ __EXPORT__ int PHYSFS_flush(PHYSFS_file *handle);
  
  

Index: physfs_byteorder.c
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/physfs_byteorder.c,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -C2 -r1.1.4.2 -r1.1.4.3
*** physfs_byteorder.c  30 Oct 2002 20:15:17 -0000      1.1.4.2
--- physfs_byteorder.c  3 Feb 2003 21:04:56 -0000       1.1.4.3
***************
*** 15,19 ****
  #include <stdio.h>
  #include <stdlib.h>
- #include <assert.h>
  
  #define __PHYSICSFS_INTERNAL__
--- 15,18 ----

Index: physfs_internal.h
===================================================================
RCS file: /cvsroot/paragui/paragui/src/physfs/physfs_internal.h,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -C2 -r1.2.2.2 -r1.2.2.3
*** physfs_internal.h   30 Oct 2002 20:15:17 -0000      1.2.2.2
--- physfs_internal.h   3 Feb 2003 21:04:56 -0000       1.2.2.3
***************
*** 17,20 ****
--- 17,26 ----
  #include "physfs.h"
  
+ #ifdef HAVE_ASSERT_H
+ #include <assert.h>
+ #else
+ #define assert(x)
+ #endif
+ 
  #ifdef __cplusplus
  extern "C" {
***************
*** 36,39 ****
--- 42,46 ----
  #define PHYSFS_LANG_SPANISH            6  /* Spanish by Pedro J. Pérez  */
  #define PHYSFS_LANG_FRENCH             7  /*  French by Stéphane Peter  */
+ #define PHYSFS_LANG_GERMAN             8  /*  German by Michael Renner  */
  
  #if (PHYSFS_LANG == PHYSFS_LANG_ENGLISH)
***************
*** 131,134 ****
--- 138,235 ----
   #define ERR_BROKEN_PIPE          "Broken pipe"
  
+ #elif (PHYSFS_LANG == PHYSFS_LANG_GERMAN)
+  #define DIR_ARCHIVE_DESCRIPTION  "Kein Archiv, direkte Ein/Ausgabe in das 
Dateisystem"
+  #define GRP_ARCHIVE_DESCRIPTION  "Build engine Groupfile Format"
+  #define ZIP_ARCHIVE_DESCRIPTION  "PkZip/WinZip/Info-Zip kompatibel"
+ 
+  #define ERR_IS_INITIALIZED       "Bereits initialisiert"
+  #define ERR_NOT_INITIALIZED      "Nicht initialisiert"
+  #define ERR_INVALID_ARGUMENT     "Ungültiges Argument"
+  #define ERR_FILES_STILL_OPEN     "Dateien noch immer geöffnet"
+  #define ERR_NO_DIR_CREATE        "Fehler beim Erzeugen der Verzeichnisse"
+  #define ERR_OUT_OF_MEMORY        "Kein Speicher mehr frei"
+  #define ERR_NOT_IN_SEARCH_PATH   "Eintrag nicht im Suchpfad enthalten"
+  #define ERR_NOT_SUPPORTED        "Befehl nicht unterstützt"
+  #define ERR_UNSUPPORTED_ARCHIVE  "Archiv-Typ nicht unterstützt"
+  #define ERR_NOT_A_HANDLE         "Ist kein Dateideskriptor"
+  #define ERR_INSECURE_FNAME       "Unsicherer Dateiname"
+  #define ERR_SYMLINK_DISALLOWED   "Symbolische Verweise deaktiviert"
+  #define ERR_NO_WRITE_DIR         "Schreibverzeichnis ist nicht gesetzt"
+  #define ERR_NO_SUCH_FILE         "Datei nicht gefunden"
+  #define ERR_NO_SUCH_PATH         "Pfad nicht gefunden"
+  #define ERR_NO_SUCH_VOLUME       "Datencontainer nicht gefunden"
+  #define ERR_PAST_EOF             "Hinter dem Ende der Datei"
+  #define ERR_ARC_IS_READ_ONLY     "Archiv ist schreibgeschützt"
+  #define ERR_IO_ERROR             "Ein/Ausgabe Fehler"
+  #define ERR_CANT_SET_WRITE_DIR   "Kann Schreibverzeichnis nicht setzen"
+  #define ERR_SYMLINK_LOOP         "Endlosschleife durch symbolische Verweise"
+  #define ERR_COMPRESSION          "(De)Kompressionsfehler"
+  #define ERR_NOT_IMPLEMENTED      "Nicht implementiert"
+  #define ERR_OS_ERROR             "Betriebssystem meldete Fehler"
+  #define ERR_FILE_EXISTS          "Datei existiert bereits"
+  #define ERR_NOT_A_FILE           "Ist keine Datei"
+  #define ERR_NOT_A_DIR            "Ist kein Verzeichnis"
+  #define ERR_NOT_AN_ARCHIVE       "Ist kein Archiv"
+  #define ERR_CORRUPTED            "Beschädigtes Archiv"
+  #define ERR_SEEK_OUT_OF_RANGE    "Suche war ausserhalb der Reichweite"
+  #define ERR_BAD_FILENAME         "Unzulässiger Dateiname"
+  #define ERR_PHYSFS_BAD_OS_CALL   "(BUG) PhysicsFS verursachte einen 
ungültigen Systemaufruf"
+  #define ERR_ARGV0_IS_NULL        "argv0 ist NULL"
+  #define ERR_ZLIB_NEED_DICT       "zlib: brauche Wörterbuch"
+  #define ERR_ZLIB_DATA_ERROR      "zlib: Datenfehler"
+  #define ERR_ZLIB_MEMORY_ERROR    "zlib: Speicherfehler"
+  #define ERR_ZLIB_BUFFER_ERROR    "zlib: Bufferfehler"
+  #define ERR_ZLIB_VERSION_ERROR   "zlib: Versionskonflikt"
+  #define ERR_ZLIB_UNKNOWN_ERROR   "zlib: Unbekannter Fehler"
+  #define ERR_SEARCHPATH_TRUNC     "Suchpfad war abgeschnitten"
+  #define ERR_GETMODFN_TRUNC       "GetModuleFileName() war abgeschnitten"
+  #define ERR_GETMODFN_NO_DIR      "GetModuleFileName() bekam kein Verzeichnis"
+  #define ERR_DISK_FULL            "Laufwerk ist voll"
+  #define ERR_DIRECTORY_FULL       "Verzeichnis ist voll"
+  #define ERR_MACOS_GENERIC        "MacOS meldete Fehler (%d)"
+  #define ERR_OS2_GENERIC          "OS/2 meldete Fehler (%d)"
+  #define ERR_VOL_LOCKED_HW        "Datencontainer ist durch Hardware gesperrt"
+  #define ERR_VOL_LOCKED_SW        "Datencontainer ist durch Software gesperrt"
+  #define ERR_FILE_LOCKED          "Datei ist gesperrt"
+  #define ERR_FILE_OR_DIR_BUSY     "Datei/Verzeichnis ist beschäftigt"
+  #define ERR_FILE_ALREADY_OPEN_W  "Datei schon im Schreibmodus geöffnet"
+  #define ERR_FILE_ALREADY_OPEN_R  "Datei schon im Lesemodus geöffnet"
+  #define ERR_INVALID_REFNUM       "Ungültige Referenznummer"
+  #define ERR_GETTING_FILE_POS     "Fehler beim Finden der Dateiposition"
+  #define ERR_VOLUME_OFFLINE       "Datencontainer ist offline"
+  #define ERR_PERMISSION_DENIED    "Zugriff verweigert"
+  #define ERR_VOL_ALREADY_ONLINE   "Datencontainer ist bereits online"
+  #define ERR_NO_SUCH_DRIVE        "Laufwerk nicht vorhanden"
+  #define ERR_NOT_MAC_DISK         "Ist kein Macintosh Laufwerk"
+  #define ERR_VOL_EXTERNAL_FS      "Datencontainer liegt auf einem externen 
Dateisystem"
+  #define ERR_PROBLEM_RENAME       "Fehler beim Umbenennen"
+  #define ERR_BAD_MASTER_BLOCK     "Beschädigter Hauptverzeichnisblock"
+  #define ERR_CANT_MOVE_FORBIDDEN  "Verschieben nicht erlaubt"
+  #define ERR_WRONG_VOL_TYPE       "Falscher Datencontainer-Typ"
+  #define ERR_SERVER_VOL_LOST      "Datencontainer am Server wurde getrennt"
+  #define ERR_FILE_ID_NOT_FOUND    "Dateikennung nicht gefunden"
+  #define ERR_FILE_ID_EXISTS       "Dateikennung existiert bereits"
+  #define ERR_SERVER_NO_RESPOND    "Server antwortet nicht"
+  #define ERR_USER_AUTH_FAILED     "Benutzerauthentifizierung fehlgeschlagen"
+  #define ERR_PWORD_EXPIRED        "Passwort am Server ist abgelaufen"
+  #define ERR_ACCESS_DENIED        "Zugriff verweigert"
+  #define ERR_NOT_A_DOS_DISK       "Ist kein DOS-Laufwerk"
+  #define ERR_SHARING_VIOLATION    "Zugriffsverletzung"
+  #define ERR_CANNOT_MAKE          "Kann nicht erzeugen"
+  #define ERR_DEV_IN_USE           "Gerät wird bereits benutzt"
+  #define ERR_OPEN_FAILED          "Öffnen fehlgeschlagen"
+  #define ERR_PIPE_BUSY            "Pipeverbindung ist belegt"
+  #define ERR_SHARING_BUF_EXCEEDED "Zugriffsbuffer überschritten"
+  #define ERR_TOO_MANY_HANDLES     "Zu viele offene Dateien"
+  #define ERR_SEEK_ERROR           "Fehler beim Suchen"
+  #define ERR_DEL_CWD              "Aktuelles Arbeitsverzeichnis darf nicht 
gelöscht werden"
+  #define ERR_WRITE_PROTECT_ERROR  "Schreibschutzfehler"
+  #define ERR_WRITE_FAULT          "Schreibfehler"
+  #define ERR_LOCK_VIOLATION       "Sperrverletzung"
+  #define ERR_GEN_FAILURE          "Allgemeiner Fehler"
+  #define ERR_UNCERTAIN_MEDIA      "Unsicheres Medium"
+  #define ERR_PROT_VIOLATION       "Schutzverletzung"
+  #define ERR_BROKEN_PIPE          "Pipeverbindung unterbrochen"
+ 
  #elif (PHYSFS_LANG == PHYSFS_LANG_RUSSIAN_KOI8_R)
   #define DIR_ARCHIVE_DESCRIPTION  "îÅ ÁÒÈÉ×, ÎÅÐÏÓÒÅÄÓÔ×ÅÎÎÙÊ ××ÏÄ/×Ù×ÏÄ 
ÆÁÊÌÏ×ÏÊ ÓÉÓÔÅÍÙ"
***************
*** 718,721 ****
--- 819,847 ----
           */
      void *opaque;
+ 
+         /*
+          * Non-zero if file opened for reading, zero if write/append.
+          */
+     PHYSFS_uint8 forReading;
+ 
+         /*
+          * This is the buffer, if one is set (NULL otherwise). Don't touch.
+          */
+     PHYSFS_uint8 *buffer;
+ 
+         /*
+          * This is the buffer size, if one is set (0 otherwise). Don't touch.
+          */
+     PHYSFS_uint64 bufsize;
+ 
+         /*
+          * This is the buffer fill size. Don't touch.
+          */
+     PHYSFS_uint64 buffill;
+ 
+         /*
+          * This is the buffer position. Don't touch.
+          */
+     PHYSFS_uint64 bufpos;
  
          /*

--- Makefile.am DELETED ---





reply via email to

[Prev in Thread] Current Thread [Next in Thread]