myserver-commit
[Top][All Lists]
Advanced

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

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-394-gb


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 0_9-394-gb3ce811
Date: Mon, 09 Nov 2009 12:20:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  b3ce811ebb6c7fbaa1a32e992aed2fcbf525ca0f (commit)
       via  7cf367d44af806b6ffb46d5b9931be7738674161 (commit)
      from  0230b189f7ef5e8b8869c756f3648b081a017816 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit b3ce811ebb6c7fbaa1a32e992aed2fcbf525ca0f
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Nov 9 13:19:35 2009 +0100

    The ReadDirectory class does not expose the inner stat struct.

diff --git a/myserver/include/base/read_directory/read_directory.h 
b/myserver/include/base/read_directory/read_directory.h
index 794cc61..e8552a4 100644
--- a/myserver/include/base/read_directory/read_directory.h
+++ b/myserver/include/base/read_directory/read_directory.h
@@ -63,32 +63,29 @@ public:
   int attrib;
   time_t time_write;
   off_t size;
+# ifdef WIN32
+  u_long st_nlink;
+# else
+  nlink_t st_nlink;
+#endif
+
   int findfirst (const char *directory);
-  int findfirst (string &directory){return findfirst (directory.c_str ());};
+  int findfirst (string &directory) {return findfirst (directory.c_str ());};
   int findnext ();
   int findclose ();
   ReadDirectory ();
   ~ReadDirectory ();
 
-  struct stat* getStatStruct ()
-  {
-# ifndef WIN32
-    return &stats;
-# else
-    return NULL;
-# endif
-  }
-
 private:
   int find (const char *filename);
   string dirName;
+
 # ifdef WIN32
-       _finddata_t fd;
+  _finddata_t fd;
   intptr_t  ff;
 # else
   DIR *dh;
   struct stat stats;
-
 #  ifdef HAVE_READDIR_R
   struct dirent entry;
 #  else
diff --git a/myserver/src/base/read_directory/read_directory.cpp 
b/myserver/src/base/read_directory/read_directory.cpp
index 8b4d984..20d41eb 100644
--- a/myserver/src/base/read_directory/read_directory.cpp
+++ b/myserver/src/base/read_directory/read_directory.cpp
@@ -118,11 +118,13 @@ int ReadDirectory::find (const char *filename)
       name = fd.name;
       attrib = fd.attrib;
       time_write = fd.time_write;
-      size = fd.size ;
+      size = fd.size;
+      st_nlink = 1UL;
     }
-
   return 0;
+
 #else
+
    struct dirent * dirInfo;
 
    if (filename)
@@ -136,7 +138,6 @@ int ReadDirectory::find (const char *filename)
        if (dh == NULL)
          return -1;
      }
-
    errno = 0;
 # ifdef HAVE_READDIR_R
    if (readdir_r (dh, &entry, &dirInfo) || !dirInfo)
@@ -174,6 +175,7 @@ int ReadDirectory::find (const char *filename)
 
    time_write = stats.st_mtime;
    size = stats.st_size;
+   st_nlink = stats.st_nlink;
    return 0;
 #endif
 }
diff --git a/myserver/src/protocol/ftp/ftp.cpp 
b/myserver/src/protocol/ftp/ftp.cpp
index 7596b44..20665ed 100644
--- a/myserver/src/protocol/ftp/ftp.cpp
+++ b/myserver/src/protocol/ftp/ftp.cpp
@@ -1772,12 +1772,7 @@ Ftp::list (const std::string & sParam /*= ""*/ )
             }
 
           char nlinkStr[12];
-          memset (nlinkStr, 0, sizeof (char) * 12);
-#ifndef WIN32
-          nlink_t nlink = 1;
-          nlink = fd.getStatStruct ()->st_nlink;
-          sprintf (nlinkStr, "%lu", (u_long) nlink);
-#endif
+          sprintf (nlinkStr, "%lu", fd.st_nlink);
 
           char fdSizeStr[12];
           sprintf (fdSizeStr, "%li", fd.size);
@@ -1863,12 +1858,7 @@ Ftp::list (const std::string & sParam /*= ""*/ )
             }
 
           char nlinkStr[12];
-          memset (nlinkStr, 0, sizeof (char) * 12);
-#ifndef WIN32
-          nlink_t nlink = 1;
-          nlink = fd.getStatStruct ()->st_nlink;
-          sprintf (nlinkStr, "%lu", (u_long) nlink);
-#endif
+          sprintf (nlinkStr, "%lu", fd.st_nlink);
 
           char fdSizeStr[12];
           sprintf (fdSizeStr, "%li", fd.size);
diff --git a/myserver/src/protocol/protocol.cpp 
b/myserver/src/protocol/protocol.cpp
index fac51e5..e8e79c0 100644
--- a/myserver/src/protocol/protocol.cpp
+++ b/myserver/src/protocol/protocol.cpp
@@ -1,18 +1,18 @@
 /*
-MyServer
-Copyright (C) 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  MyServer
+  Copyright (C) 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "stdafx.h"
diff --git a/myserver/tests/test_read_directory.cpp 
b/myserver/tests/test_read_directory.cpp
index ec1209d..c38d805 100644
--- a/myserver/tests/test_read_directory.cpp
+++ b/myserver/tests/test_read_directory.cpp
@@ -48,6 +48,7 @@ public:
       {
         CPPUNIT_ASSERT (rd.name.length ());
         CPPUNIT_ASSERT (rd.attrib >= 0);
+        CPPUNIT_ASSERT (rd.st_nlink >= 1);
         CPPUNIT_ASSERT (rd.size >= 0);
         CPPUNIT_ASSERT (rd.time_write);
       }



commit 7cf367d44af806b6ffb46d5b9931be7738674161
Author: Giuseppe Scrivano <address@hidden>
Date:   Mon Nov 9 13:18:31 2009 +0100

    Add a comment.

diff --git a/myserver/src/protocol/ftp/ftp_lexer.cpp 
b/myserver/src/protocol/ftp/ftp_lexer.cpp
index d34da81..505ffe3 100644
--- a/myserver/src/protocol/ftp/ftp_lexer.cpp
+++ b/myserver/src/protocol/ftp/ftp_lexer.cpp
@@ -1,2 +1,3 @@
+/* We need this hack to ensure stdafx.h is include before any other file.  */
 #include "stdafx.h"
 #include "ftp_lexer.out.cpp"

-----------------------------------------------------------------------

Summary of changes:
 .../include/base/read_directory/read_directory.h   |   21 ++++++--------
 .../src/base/read_directory/read_directory.cpp     |    8 +++--
 myserver/src/protocol/ftp/ftp.cpp                  |   14 +--------
 myserver/src/protocol/ftp/ftp_lexer.cpp            |    1 +
 myserver/src/protocol/protocol.cpp                 |   28 ++++++++++----------
 myserver/tests/test_read_directory.cpp             |    1 +
 6 files changed, 32 insertions(+), 41 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

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