From c3129fd4a4cfff22fb5f31fadac61ea975d29c7c Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 10 May 2009 16:37:34 +0000 Subject: [PATCH] 2009-05-10 Tatsuhiro Tsujikawa Fixed compile error on Mac OS X * src/HttpServer.cc * src/XmlRpcMethod.h * src/XmlRpcMethodImpl.cc --- ChangeLog | 7 +++++++ src/HttpServer.cc | 4 +++- src/XmlRpcMethod.h | 2 ++ src/XmlRpcMethodImpl.cc | 8 +++++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 251691b2..7f9ae393 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-05-10 Tatsuhiro Tsujikawa + + Fixed compile error on Mac OS X + * src/HttpServer.cc + * src/XmlRpcMethod.h + * src/XmlRpcMethodImpl.cc + 2009-05-10 Tatsuhiro Tsujikawa Use std::binary_search instead of std::find diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 3ab9ad9c..bb4075e7 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -99,7 +99,9 @@ bool HttpServer::receiveBody() } const size_t BUFLEN = 4096; char buf[BUFLEN]; - size_t length = std::min(BUFLEN, _lastContentLength-_lastBody.tellg()); + size_t length = std::min(BUFLEN, + static_cast + (_lastContentLength-_lastBody.tellg())); _socket->readData(buf, length); if(length == 0 && !(_socket->wantRead() || _socket->wantWrite())) { throw DlAbortEx(EX_EOF_FROM_PEER); diff --git a/src/XmlRpcMethod.h b/src/XmlRpcMethod.h index 02118d33..ab8e6e09 100644 --- a/src/XmlRpcMethod.h +++ b/src/XmlRpcMethod.h @@ -66,6 +66,8 @@ protected: public: XmlRpcMethod(); + virtual ~XmlRpcMethod() {} + std::string execute(const XmlRpcRequest& req, DownloadEngine* e); }; diff --git a/src/XmlRpcMethodImpl.cc b/src/XmlRpcMethodImpl.cc index 8160f18c..c0103d0e 100644 --- a/src/XmlRpcMethodImpl.cc +++ b/src/XmlRpcMethodImpl.cc @@ -168,7 +168,9 @@ static void gatherProgressCommon (BDE& entryDict, const SharedHandle& group) { entryDict["gid"] = Util::itos(group->getGID()); + // This is "filtered" total length if --select-file is used. entryDict["totalLength"] = Util::uitos(group->getTotalLength()); + // This is "filtered" total length if --select-file is used. entryDict["completedLength"] = Util::uitos(group->getCompletedLength()); TransferStat stat = group->calculateStat(); entryDict["downloadSpeed"] = Util::uitos(stat.getDownloadSpeed()); @@ -280,12 +282,12 @@ BDE GetFilesXmlRpcMethod::process btctx->getFileEntries(); bool selectAll = fileIndexes.empty() || fileEntries.size() == 1; - - size_t index = 1; + + int32_t index = 1; for(std::deque >::const_iterator i = fileEntries.begin(); i != fileEntries.end(); ++i, ++index) { BDE entry = BDE::dict(); - entry["index"] = Util::uitos(index); + entry["index"] = Util::itos(index); entry["path"] = (*i)->getPath(); if(selectAll || std::binary_search(fileIndexes.begin(), fileIndexes.end(), index)) {