diff options
| author | Alan Conway <aconway@apache.org> | 2008-03-25 13:34:44 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-03-25 13:34:44 +0000 |
| commit | b449826a61eaa0a754e55ca8143882216a07d7e0 (patch) | |
| tree | 9743d3b8a0f5479260beea3a7b47ac1fd8be1801 /cpp/src/qpid | |
| parent | bb542cee9af73a016360aa2d00addfee0206cad8 (diff) | |
| download | qpid-python-b449826a61eaa0a754e55ca8143882216a07d7e0.tar.gz | |
Fix compile errors/warnings with gcc 4.3
- added missing #includes that were implicitly included via old headers.
- add namespace-qualifiers to fix "changes meaning of name" warnings.
- ./qpid/ptr_map.h:51: fixed "qualified return value" warning.
- use const char* for "conversion from string constant to ‘char*’" warnings
Applied patch from https://issues.apache.org/jira/browse/QPID-869
remove depenency on boost/date_time, causes warnings with gcc 4.3.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@640806 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/Exception.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/Options.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/Url.cpp | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/amqp_0_10/Frame.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/amqp_0_10/Segment.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/assert.cpp | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Broker.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Queue.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Queue.h | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/SemanticState.cpp | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/cluster/Cpg.h | 1 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/Buffer.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/framing/Invoker.h | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Logger.cpp | 22 | ||||
| -rw-r--r-- | cpp/src/qpid/log/Statement.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/ptr_map.h | 6 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/AggregateOutput.cpp | 3 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/Socket.h | 4 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/epoll/EpollPoller.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/sys/posix/Socket.cpp | 7 |
20 files changed, 52 insertions, 21 deletions
diff --git a/cpp/src/qpid/Exception.cpp b/cpp/src/qpid/Exception.cpp index 17f0d5029c..fbd3f9d2a0 100644 --- a/cpp/src/qpid/Exception.cpp +++ b/cpp/src/qpid/Exception.cpp @@ -24,6 +24,7 @@ #include <typeinfo> #include <errno.h> #include <assert.h> +#include <string.h> namespace qpid { diff --git a/cpp/src/qpid/Options.cpp b/cpp/src/qpid/Options.cpp index 212171b8c5..a5d3b54dd6 100644 --- a/cpp/src/qpid/Options.cpp +++ b/cpp/src/qpid/Options.cpp @@ -93,7 +93,7 @@ void Options::parse(int argc, char** argv, const std::string& configFile, bool a if (allowUnknown) { // This hideous workaround is required because boost 1.33 has a bug // that causes 'allow_unregistered' to not work. - po::command_line_parser clp = po::command_line_parser(argc, argv). + po::command_line_parser clp = po::command_line_parser(argc, const_cast<char**>(argv)). options(*this).allow_unregistered(); po::parsed_options opts = clp.run(); po::parsed_options filtopts = clp.run(); @@ -105,7 +105,7 @@ void Options::parse(int argc, char** argv, const std::string& configFile, bool a po::store(filtopts, vm); } else - po::store(po::parse_command_line(argc, argv, *this), vm); + po::store(po::parse_command_line(argc, const_cast<char**>(argv), *this), vm); } parsing="environment variables"; po::store(po::parse_environment(*this, EnvOptMapper(*this)), vm); diff --git a/cpp/src/qpid/Url.cpp b/cpp/src/qpid/Url.cpp index aa53d5cbe2..090cbb712a 100644 --- a/cpp/src/qpid/Url.cpp +++ b/cpp/src/qpid/Url.cpp @@ -20,10 +20,12 @@ #include "qpid/Exception.h" #include "qpid/Msg.h" -#include <sstream> +#include <limits.h> // NB: must be before boost/spirit headers. #include <boost/spirit.hpp> #include <boost/spirit/actor.hpp> +#include <sstream> + #include <sys/ioctl.h> #include <net/if.h> #include <unistd.h> diff --git a/cpp/src/qpid/amqp_0_10/Frame.h b/cpp/src/qpid/amqp_0_10/Frame.h index 2ae0c75073..f3a99e8004 100644 --- a/cpp/src/qpid/amqp_0_10/Frame.h +++ b/cpp/src/qpid/amqp_0_10/Frame.h @@ -24,6 +24,7 @@ #include "qpid/amqp_0_10/built_in_types.h" #include <boost/shared_array.hpp> +#include <string.h> namespace qpid { namespace amqp_0_10 { diff --git a/cpp/src/qpid/amqp_0_10/Segment.cpp b/cpp/src/qpid/amqp_0_10/Segment.cpp index 0d7c9c55f1..8eebeb276d 100644 --- a/cpp/src/qpid/amqp_0_10/Segment.cpp +++ b/cpp/src/qpid/amqp_0_10/Segment.cpp @@ -29,7 +29,7 @@ namespace amqp_0_10 { Segment::Segment() : missing() {} bool Segment::isComplete() const { - return missing || !frames.empty() && (frames.back().testFlags(Frame::LAST_FRAME)); + return missing || (!frames.empty() && (frames.back().testFlags(Frame::LAST_FRAME))); } Segment::const_iterator Segment::begin() const { diff --git a/cpp/src/qpid/assert.cpp b/cpp/src/qpid/assert.cpp index dba81f3873..5d039da528 100644 --- a/cpp/src/qpid/assert.cpp +++ b/cpp/src/qpid/assert.cpp @@ -24,6 +24,7 @@ #include <sstream> #include <iostream> #include "qpid/framing/reply_exceptions.h" +#include <stdlib.h> namespace qpid { diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index ddd5959343..bbcdb9cbce 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -73,7 +73,7 @@ Broker::Options::Options(const std::string& name) : ack(0) { int c = sys::SystemInfo::concurrency(); - workerThreads=std::max(2,c); + workerThreads=c+1; addOptions() ("data-dir", optValue(dataDir,"DIR"), "Directory to contain persistent data generated by the broker") diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp index 92e87cc9d8..165830151d 100644 --- a/cpp/src/qpid/broker/Queue.cpp +++ b/cpp/src/qpid/broker/Queue.cpp @@ -524,7 +524,7 @@ void Queue::setPolicy(std::auto_ptr<QueuePolicy> _policy) policy = _policy; } -const QueuePolicy* const Queue::getPolicy() +const QueuePolicy* Queue::getPolicy() { return policy.get(); } diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h index deaa0d58a6..e33cd7e5d7 100644 --- a/cpp/src/qpid/broker/Queue.h +++ b/cpp/src/qpid/broker/Queue.h @@ -167,7 +167,7 @@ namespace qpid { */ QueuedMessage dequeue(); - const QueuePolicy* const getPolicy(); + const QueuePolicy* getPolicy(); void setAlternateExchange(boost::shared_ptr<Exchange> exchange); boost::shared_ptr<Exchange> getAlternateExchange(); diff --git a/cpp/src/qpid/broker/SemanticState.cpp b/cpp/src/qpid/broker/SemanticState.cpp index 8c29a4a4ec..1b5bcc2f7e 100644 --- a/cpp/src/qpid/broker/SemanticState.cpp +++ b/cpp/src/qpid/broker/SemanticState.cpp @@ -574,7 +574,8 @@ void SemanticState::ConsumerImpl::addMessageCredit(uint32_t value) void SemanticState::ConsumerImpl::flush() { - while(queue->dispatch(*this)); + while(queue->dispatch(*this)) + ; stop(); } diff --git a/cpp/src/qpid/cluster/Cpg.h b/cpp/src/qpid/cluster/Cpg.h index 09b6996cc0..2a7ec459d3 100644 --- a/cpp/src/qpid/cluster/Cpg.h +++ b/cpp/src/qpid/cluster/Cpg.h @@ -23,6 +23,7 @@ #include "qpid/cluster/Dispatchable.h" #include <cassert> +#include <string.h> extern "C" { #include <openais/cpg.h> diff --git a/cpp/src/qpid/framing/Buffer.cpp b/cpp/src/qpid/framing/Buffer.cpp index 60d67f1b07..81f3456ce1 100644 --- a/cpp/src/qpid/framing/Buffer.cpp +++ b/cpp/src/qpid/framing/Buffer.cpp @@ -21,7 +21,7 @@ #include "Buffer.h" #include "FramingContent.h" #include "FieldTable.h" - +#include <string.h> namespace qpid { namespace framing { diff --git a/cpp/src/qpid/framing/Invoker.h b/cpp/src/qpid/framing/Invoker.h index e6467ab3c4..6c2b972c13 100644 --- a/cpp/src/qpid/framing/Invoker.h +++ b/cpp/src/qpid/framing/Invoker.h @@ -42,7 +42,7 @@ class Invoker: public MethodBodyDefaultVisitor, protected StructHelper public: Result() : handled(false) {} const std::string& getResult() const { return result; } - const bool hasResult() const { return !result.empty(); } + bool hasResult() const { return !result.empty(); } bool wasHandled() const { return handled; } operator bool() const { return handled; } diff --git a/cpp/src/qpid/log/Logger.cpp b/cpp/src/qpid/log/Logger.cpp index b51bb0427b..c0fc8ac959 100644 --- a/cpp/src/qpid/log/Logger.cpp +++ b/cpp/src/qpid/log/Logger.cpp @@ -23,7 +23,6 @@ #include <boost/pool/detail/singleton.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/scoped_ptr.hpp> #include <algorithm> #include <sstream> @@ -31,6 +30,7 @@ #include <iomanip> #include <stdexcept> #include <syslog.h> +#include <time.h> namespace qpid { @@ -111,7 +111,25 @@ void Logger::log(const Statement& s, const std::string& msg) { // Format the message outside the lock. std::ostringstream os; if (flags&TIME) - os << boost::posix_time::second_clock::local_time() << " "; + { + const char * month_abbrevs[] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; + time_t rawtime; + struct tm * timeinfo; + + time ( & rawtime ); + timeinfo = localtime ( &rawtime ); + char time_string[100]; + sprintf ( time_string, + "%d-%s-%02d %02d:%02d:%02d", + 1900 + timeinfo->tm_year, + month_abbrevs[timeinfo->tm_mon], + timeinfo->tm_mday, + timeinfo->tm_hour, + timeinfo->tm_min, + timeinfo->tm_sec + ); + os << time_string << " "; + } if (flags&LEVEL) os << LevelTraits::name(s.level) << " "; if (flags&THREAD) diff --git a/cpp/src/qpid/log/Statement.cpp b/cpp/src/qpid/log/Statement.cpp index 9b6fb7feaf..db5d92c50a 100644 --- a/cpp/src/qpid/log/Statement.cpp +++ b/cpp/src/qpid/log/Statement.cpp @@ -32,7 +32,7 @@ using namespace std; struct NonPrint { bool operator()(unsigned char c) { return !isprint(c); } }; -char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; +const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; std::string quote(const std::string& str) { NonPrint nonPrint; diff --git a/cpp/src/qpid/ptr_map.h b/cpp/src/qpid/ptr_map.h index c33f63767d..e9a1d507a6 100644 --- a/cpp/src/qpid/ptr_map.h +++ b/cpp/src/qpid/ptr_map.h @@ -39,6 +39,9 @@ namespace ptr_map { * * @see http://www.boost.org/libs/ptr_container/doc/ptr_container.html#upgrading-from-boost-v-1-33 */ + +#include <boost/type_traits/remove_const.hpp> + #if (BOOST_VERSION < 103400) template <class PtrMapIter> @@ -48,7 +51,8 @@ typename PtrMapIter::pointer get_pointer(const PtrMapIter& i) #else template <class PtrMapIter> -typename PtrMapIter::value_type::second_type get_pointer(const PtrMapIter& i) +typename boost::remove_const<typename PtrMapIter::value_type::second_type>::type +get_pointer(const PtrMapIter& i) { return i->second; } #endif diff --git a/cpp/src/qpid/sys/AggregateOutput.cpp b/cpp/src/qpid/sys/AggregateOutput.cpp index 74eea5ed08..57cc0c5a33 100644 --- a/cpp/src/qpid/sys/AggregateOutput.cpp +++ b/cpp/src/qpid/sys/AggregateOutput.cpp @@ -21,6 +21,7 @@ #include "qpid/sys/AggregateOutput.h" #include "qpid/log/Statement.h" +#include <algorithm> namespace qpid { namespace sys { @@ -54,7 +55,7 @@ void AggregateOutput::addOutputTask(OutputTask* t) void AggregateOutput::removeOutputTask(OutputTask* t) { - TaskList::iterator i = find(tasks.begin(), tasks.end(), t); + TaskList::iterator i = std::find(tasks.begin(), tasks.end(), t); if (i != tasks.end()) tasks.erase(i); } diff --git a/cpp/src/qpid/sys/Socket.h b/cpp/src/qpid/sys/Socket.h index 1594e89aac..0ebfc0c330 100644 --- a/cpp/src/qpid/sys/Socket.h +++ b/cpp/src/qpid/sys/Socket.h @@ -93,8 +93,8 @@ public: */ std::string getLocalAddress() const; - uint getLocalPort() const; - uint getRemotePort() const; + uint16_t getLocalPort() const; + uint16_t getRemotePort() const; /** Accept a connection from a socket that is already listening diff --git a/cpp/src/qpid/sys/epoll/EpollPoller.cpp b/cpp/src/qpid/sys/epoll/EpollPoller.cpp index 67783fc8c8..8936251f94 100644 --- a/cpp/src/qpid/sys/epoll/EpollPoller.cpp +++ b/cpp/src/qpid/sys/epoll/EpollPoller.cpp @@ -166,7 +166,7 @@ class PollerPrivate { case ::EPOLLOUT: return Poller::WRITABLE; case ::EPOLLIN | ::EPOLLOUT: return Poller::READ_WRITABLE; default: - return (events & ::EPOLLHUP | ::EPOLLERR) ? + return (events & (::EPOLLHUP | ::EPOLLERR)) ? Poller::DISCONNECTED : Poller::INVALID; } } diff --git a/cpp/src/qpid/sys/posix/Socket.cpp b/cpp/src/qpid/sys/posix/Socket.cpp index 028b45d03d..c286ebce27 100644 --- a/cpp/src/qpid/sys/posix/Socket.cpp +++ b/cpp/src/qpid/sys/posix/Socket.cpp @@ -31,6 +31,7 @@ #include <netinet/in.h> #include <netdb.h> #include <cstdlib> +#include <string.h> #include <boost/format.hpp> @@ -160,7 +161,7 @@ void Socket::connect(const std::string& host, int port) const struct hostent* hp = gethostbyname ( host.c_str() ); if (hp == 0) throw Exception(QPID_MSG("Cannot resolve " << host << ": " << h_errstr(h_errno))); - memcpy(&name.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length); + ::memcpy(&name.sin_addr.s_addr, hp->h_addr_list[0], hp->h_length); if (::connect(socket, (struct sockaddr*)(&name), sizeof(name)) < 0) throw qpid::Exception(QPID_MSG(strError(errno) << ": " << host << ":" << port)); } @@ -260,12 +261,12 @@ std::string Socket::getLocalAddress() const return impl->getName(true, true); } -uint Socket::getLocalPort() const +uint16_t Socket::getLocalPort() const { return atoi(impl->getService(true).c_str()); } -uint Socket::getRemotePort() const +uint16_t Socket::getRemotePort() const { return atoi(impl->getService(true).c_str()); } |
