mail[Wesnoth-commits] r33522 - in /trunk: configure.ac src/network_worker.cpp src/network_worker.hpp src/util.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 10, 2009 - 14:07:
Author: silene
Date: Tue Mar 10 14:07:19 2009
New Revision: 33522

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33522&view=rev
Log:
Added proper detection of round and sendfile.

Modified:
    trunk/configure.ac
    trunk/src/network_worker.cpp
    trunk/src/network_worker.hpp
    trunk/src/util.hpp

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/configure.ac?rev=33522&r1=33521&r2=33522&view=diff
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Tue Mar 10 14:07:19 2009
@@ -739,7 +739,8 @@
 AC_FUNC_ERROR_AT_LINE
 AC_FUNC_STAT
 AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([floor socket strtoul])
+AC_CHECK_LIB(m, floor)
+AC_CHECK_FUNCS([round socket strtoul sendfile])
 
 
 #######################################################################

Modified: trunk/src/network_worker.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_worker.cpp?rev=33522&r1=33521&r2=33522&view=diff
==============================================================================
--- trunk/src/network_worker.cpp (original)
+++ trunk/src/network_worker.cpp Tue Mar 10 14:07:19 2009
@@ -31,15 +31,15 @@
 #include "serialization/binary_or_text.hpp"
 #include "serialization/binary_wml.hpp"
 #include "serialization/parser.hpp"
+#include "wesconfig.h"
 
 #include <cerrno>
 #include <deque>
 
-#ifdef USE_SENDFILE
+#ifdef HAVE_SENDFILE
 #include <sys/sendfile.h>
 #include <netinet/in.h>
 #include <netinet/tcp.h>
-#define HAVE_POLL_H
 #endif
 
 
@@ -472,7 +472,7 @@
        }
 }
 
-#ifdef USE_SENDFILE
+#ifdef HAVE_SENDFILE
 struct cork_setter {
        cork_setter(int socket) : cork_(1), socket_(socket)
        {
@@ -498,7 +498,7 @@
 {
        size_t upto = 0;
        size_t filesize = file_size(buf->config_error);
-#ifdef USE_SENDFILE
+#ifdef HAVE_SENDFILE
        // implements linux sendfile support
        LOG_NW << "send_file use system sendfile: " << 
(network_use_system_sendfile?"yes":"no") << "\n";
        if (network_use_system_sendfile)

Modified: trunk/src/network_worker.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_worker.hpp?rev=33522&r1=33521&r2=33522&view=diff
==============================================================================
--- trunk/src/network_worker.hpp (original)
+++ trunk/src/network_worker.hpp Tue Mar 10 14:07:19 2009
@@ -14,15 +14,6 @@
 
 #ifndef NETWORK_WORKER_HPP_INCLUDED
 #define NETWORK_WORKER_HPP_INCLUDED
-
-// Check if sendfile function is implemented by glibc
-// It is linux only extension
-#if defined(__linux__) && defined(__GNUC_PREREQ)
-#if __GNUC_PREREQ(2,1)
-#define USE_SENDFILE
-#endif
-#endif
-
 
 #include <map>
 #include <vector>

Modified: trunk/src/util.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/util.hpp?rev=33522&r1=33521&r2=33522&view=diff
==============================================================================
--- trunk/src/util.hpp (original)
+++ trunk/src/util.hpp Tue Mar 10 14:07:19 2009
@@ -21,6 +21,7 @@
 #define UTIL_H_INCLUDED
 
 #include "global.hpp"
+#include "wesconfig.h"
 #include <cmath>
 #include <vector>
 #include <sstream>
@@ -51,7 +52,7 @@
 // not guaranteed to have exactly the same result on different platforms
 inline int round_double(double d) {
 #ifdef HAVE_ROUND
-       return static_cast<int>(std::round(d)); //surprisingly, not 
implemented everywhere
+       return static_cast<int>(round(d)); //surprisingly, not implemented 
everywhere
 #else
        return static_cast<int>((d >= 0.0)? std::floor(d + 0.5) : std::ceil(d 
- 0.5));
 #endif




Related Messages


Powered by MHonArc, Updated Tue Mar 10 15:40:44 2009