myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [2974] `File::setFilePointer' renamed to `File::seek'.


From: Giuseppe Scrivano
Subject: [myserver-commit] [2974] `File::setFilePointer' renamed to `File::seek'.
Date: Sun, 30 Nov 2008 19:20:26 +0000

Revision: 2974
          http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2974
Author:   gscrivano
Date:     2008-11-30 19:20:22 +0000 (Sun, 30 Nov 2008)

Log Message:
-----------
`File::setFilePointer' renamed to `File::seek'.

Modified Paths:
--------------
    trunk/myserver/include/base/file/file.h
    trunk/myserver/include/base/files_cache/cached_file.h
    trunk/myserver/src/base/file/file.cpp
    trunk/myserver/src/base/files_cache/cached_file.cpp
    trunk/myserver/src/base/files_cache/cached_file_buffer.cpp
    trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
    trunk/myserver/src/http_handler/http_file/http_file.cpp
    trunk/myserver/src/http_handler/isapi/isapi.cpp
    trunk/myserver/src/http_handler/wincgi/wincgi.cpp
    trunk/myserver/src/log/stream/file_stream.cpp
    trunk/myserver/src/protocol/control/control_protocol.cpp
    trunk/myserver/src/protocol/ftp/ftp.cpp
    trunk/myserver/src/protocol/http/http.cpp
    trunk/myserver/src/protocol/http/http_data_read.cpp
    trunk/myserver/tests/test_cached_file.cpp

Modified: trunk/myserver/include/base/file/file.h
===================================================================
--- trunk/myserver/include/base/file/file.h     2008-11-29 18:19:49 UTC (rev 
2973)
+++ trunk/myserver/include/base/file/file.h     2008-11-30 19:20:22 UTC (rev 
2974)
@@ -53,7 +53,7 @@
     {return openFile(file.c_str(), opt);}
 
        virtual u_long getFileSize();
-       virtual int setFilePointer(u_long);
+       virtual int seek (u_long);
 
        virtual time_t getLastModTime();
        virtual time_t getCreationTime();

Modified: trunk/myserver/include/base/files_cache/cached_file.h
===================================================================
--- trunk/myserver/include/base/files_cache/cached_file.h       2008-11-29 
18:19:49 UTC (rev 2973)
+++ trunk/myserver/include/base/files_cache/cached_file.h       2008-11-30 
19:20:22 UTC (rev 2974)
@@ -42,7 +42,7 @@
     {return openFile(file.c_str(), opt);}
 
        virtual u_long getFileSize();
-       virtual int setFilePointer(u_long);
+       virtual int seek (u_long);
 
        virtual int operator =(CachedFile);
        virtual int close();

Modified: trunk/myserver/src/base/file/file.cpp
===================================================================
--- trunk/myserver/src/base/file/file.cpp       2008-11-29 18:19:49 UTC (rev 
2973)
+++ trunk/myserver/src/base/file/file.cpp       2008-11-30 19:20:22 UTC (rev 
2974)
@@ -171,9 +171,9 @@
   else/*! Open the file. */
   {
     if(opt & File::MYSERVER_OPEN_APPEND)
-      ret = setFilePointer(getFileSize ());
+      ret = seek (getFileSize ());
     else
-      ret = setFilePointer(0);
+      ret = seek (0);
       if(ret)
       {
         close();
@@ -396,17 +396,17 @@
  *Change the position of the pointer to the file.
  *\param initialByte The new file pointer position.
  */
-int File::setFilePointer(u_long initialByte)
+int File::seek (u_long initialByte)
 {
   u_long ret;
 #ifdef WIN32
-  ret=SetFilePointer((HANDLE)handle,initialByte,NULL,FILE_BEGIN);
+  ret = SetFilePointer ((HANDLE)handle, initialByte, NULL, FILE_BEGIN);
   /*! SetFilePointer returns INVALID_SET_FILE_POINTER on an error.  */
   return (ret == INVALID_SET_FILE_POINTER) ? 1 : 0;
 #endif
 #ifdef NOT_WIN
-  ret = lseek((long)handle, initialByte, SEEK_SET);
-  return (ret!=initialByte)?1:0;
+  ret = lseek ((long)handle, initialByte, SEEK_SET);
+  return (ret != initialByte ) ? 1 : 0;
 #endif
 }
 
@@ -490,7 +490,7 @@
   u_long size = buf->getRealLength ();
   *nbw = 0;
 
-       if (setFilePointer (firstByte))
+       if (seek (firstByte))
     return 0;
 
   for (;;)

Modified: trunk/myserver/src/base/files_cache/cached_file.cpp
===================================================================
--- trunk/myserver/src/base/files_cache/cached_file.cpp 2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/base/files_cache/cached_file.cpp 2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -165,16 +165,16 @@
  *Returns the file size in bytes.
  *Returns -1 on errors.
  */
-u_long CachedFile::getFileSize()
+u_long CachedFile::getFileSize ()
 {
-  return buffer->getFileSize();
+  return buffer->getFileSize ();
 }
 
 /*!
  *Change the position of the pointer to the file.
  *\param initialByte The new file pointer position.
  */
-int CachedFile::setFilePointer(u_long initialByte)
+int CachedFile::seek (u_long initialByte)
 {
   if(initialByte <= buffer->getFileSize())
     fseek = initialByte;
@@ -187,7 +187,7 @@
 /*!
  *Inherited from Stream.
  */
-int CachedFile::write(const char* buffer, u_long len, u_long *nbw)
+int CachedFile::write (const char* buffer, u_long len, u_long *nbw)
 {
   return -1;
 }

Modified: trunk/myserver/src/base/files_cache/cached_file_buffer.cpp
===================================================================
--- trunk/myserver/src/base/files_cache/cached_file_buffer.cpp  2008-11-29 
18:19:49 UTC (rev 2973)
+++ trunk/myserver/src/base/files_cache/cached_file_buffer.cpp  2008-11-30 
19:20:22 UTC (rev 2974)
@@ -129,7 +129,7 @@
   fileSize = size;
   this->buffer = new char[size];
 
-  memcpy(this->buffer, buffer, size);
+  memcpy (this->buffer, buffer, size);
 }
 
 /*!
@@ -141,11 +141,11 @@
   u_long nbr;
   factoryToNotify = 0;
   refCounter = 0;
-  fileSize = file->getFileSize();
+  fileSize = file->getFileSize ();
   buffer = new char[fileSize];
-  filename.assign(file->getFilename());
-  file->setFilePointer(0);
-  file->read(buffer, fileSize, &nbr);
+  filename.assign (file->getFilename());
+  file->seek (0);
+  file->read (buffer, fileSize, &nbr);
 }
 
 /*!

Modified: trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp 2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/http_handler/fastcgi/fastcgi.cpp 2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -629,7 +629,7 @@
     td->buffer->setLength(0);
 
 
-    if(td->inputData.setFilePointer(0))
+    if(td->inputData.seek (0))
       if(Server::getInstance()->getVerbosity() > 2)
       {
         *td->buffer << "FastCGI: Error sending POST data" << '\0';

Modified: trunk/myserver/src/http_handler/http_file/http_file.cpp
===================================================================
--- trunk/myserver/src/http_handler/http_file/http_file.cpp     2008-11-29 
18:19:49 UTC (rev 2973)
+++ trunk/myserver/src/http_handler/http_file/http_file.cpp     2008-11-30 
19:20:22 UTC (rev 2974)
@@ -132,7 +132,7 @@
     /*
      * If fail to set the file pointer returns an internal server error.  
      */
-    ret = file->setFilePointer(firstByte);
+    ret = file->seek (firstByte);
     if(ret)
     {
       file->close();

Modified: trunk/myserver/src/http_handler/isapi/isapi.cpp
===================================================================
--- trunk/myserver/src/http_handler/isapi/isapi.cpp     2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/http_handler/isapi/isapi.cpp     2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -776,7 +776,7 @@
   if (!(td->permissions & MYSERVER_PERMISSION_EXECUTE))
     return td->http->sendAuth();
 
-  td->inputData.setFilePointer(0);
+  td->inputData.seek (0);
 
   EnterCriticalSection(&GetTableEntryCritSec);
   connIndex = 0;

Modified: trunk/myserver/src/http_handler/wincgi/wincgi.cpp
===================================================================
--- trunk/myserver/src/http_handler/wincgi/wincgi.cpp   2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/http_handler/wincgi/wincgi.cpp   2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -120,7 +120,7 @@
   
   strcpy(outFilePath,td->outputDataPath.c_str());
   strcat(outFilePath,"WC");
-  td->inputData.setFilePointer(0);
+  td->inputData.seek (0);
 
   chain.setProtocol(td->http);
   chain.setProtocolData(td);

Modified: trunk/myserver/src/log/stream/file_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/file_stream.cpp       2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/log/stream/file_stream.cpp       2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -71,7 +71,7 @@
           delete [] secondaryBuffer;
           return 1;
         }
-      if (currentFile->setFilePointer (0))
+      if (currentFile->seek (0))
         {
           delete [] buffer;
           delete [] secondaryBuffer;

Modified: trunk/myserver/src/protocol/control/control_protocol.cpp
===================================================================
--- trunk/myserver/src/protocol/control/control_protocol.cpp    2008-11-29 
18:19:49 UTC (rev 2973)
+++ trunk/myserver/src/protocol/control/control_protocol.cpp    2008-11-30 
19:20:22 UTC (rev 2974)
@@ -371,7 +371,7 @@
   }
   if(Ifile)
   {
-    Ifile->setFilePointer(0);
+    Ifile->seek (0);
   }
 
   if(strcmpi(version, "CONTROL/1.0"))
@@ -525,7 +525,7 @@
   if(knownCommand)
   {
     char *connection;
-    Ofile->setFilePointer(0);
+    Ofile->seek (0);
     if(ret)
     {
       sendResponse(b2, bs2, a, CONTROL_INTERNAL, header, 0);

Modified: trunk/myserver/src/protocol/ftp/ftp.cpp
===================================================================
--- trunk/myserver/src/protocol/ftp/ftp.cpp     2008-11-29 18:19:49 UTC (rev 
2973)
+++ trunk/myserver/src/protocol/ftp/ftp.cpp     2008-11-30 19:20:22 UTC (rev 
2974)
@@ -991,7 +991,7 @@
     u_long nbr, nBufferSize = 0;
     if ( pWt->m_bAppend && pFtpUserData->m_nRestartOffset < filesize )
     {
-      file->setFilePointer(pFtpUserData->m_nRestartOffset);
+      file->seek (pFtpUserData->m_nRestartOffset);
       filesize -= pFtpUserData->m_nRestartOffset;
     }
 

Modified: trunk/myserver/src/protocol/http/http.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http.cpp   2008-11-29 18:19:49 UTC (rev 
2973)
+++ trunk/myserver/src/protocol/http/http.cpp   2008-11-30 19:20:22 UTC (rev 
2974)
@@ -279,12 +279,12 @@
         /*! Return an internal server error. */
         return raiseHTTPError(500);
       }
-      file.setFilePointer(firstByte);
+      file.seek (firstByte);
       for(;;)
       {
         u_long nbr = 0, nbw = 0;
-        if(td->inputData.read(td->buffer->getBuffer(),
-                                     td->buffer->getRealLength(), &nbr))
+        if(td->inputData.read (td->buffer->getBuffer(),
+                               td->buffer->getRealLength(), &nbr))
         {
           file.close();
           /*! Return an internal server error.  */

Modified: trunk/myserver/src/protocol/http/http_data_read.cpp
===================================================================
--- trunk/myserver/src/protocol/http/http_data_read.cpp 2008-11-29 18:19:49 UTC 
(rev 2973)
+++ trunk/myserver/src/protocol/http/http_data_read.cpp 2008-11-30 19:20:22 UTC 
(rev 2974)
@@ -403,6 +403,6 @@
       break;
   }
 
-  td->inputData.setFilePointer(0);
+  td->inputData.seek (0);
   return 0;
 }

Modified: trunk/myserver/tests/test_cached_file.cpp
===================================================================
--- trunk/myserver/tests/test_cached_file.cpp   2008-11-29 18:19:49 UTC (rev 
2973)
+++ trunk/myserver/tests/test_cached_file.cpp   2008-11-30 19:20:22 UTC (rev 
2974)
@@ -60,8 +60,8 @@
 
   void testFilePointer()
   {
-    CPPUNIT_ASSERT_EQUAL(cf->setFilePointer(3), 0);
-    CPPUNIT_ASSERT(cf->setFilePointer(100000));
+    CPPUNIT_ASSERT_EQUAL(cf->seek (3), 0);
+    CPPUNIT_ASSERT(cf->seek (100000));
   }
 
 






reply via email to

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