From: Daniel J. <dan...@us...> - 2012-03-13 13:05:34
|
Update of /cvsroot/fink/dists/10.4/stable/main/finkinfo/net In directory vz-cvs-3.sog:/tmp/cvs-serv9333 Modified Files: aria2.info Added Files: aria2.patch Log Message: New upstream aria2 1.14.2. Add patch for clang from Jack Howarth. Index: aria2.info =================================================================== RCS file: /cvsroot/fink/dists/10.4/stable/main/finkinfo/net/aria2.info,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- aria2.info 28 Dec 2011 00:59:03 -0000 1.3 +++ aria2.info 13 Mar 2012 13:05:31 -0000 1.4 @@ -1,5 +1,5 @@ Package: aria2 -Version: 1.14.0 +Version: 1.14.2 Revision: 1 Description: Downloader for HTTP/FTP/BitTorrent/Metalink Homepage: http://aria2.sourceforge.net/ @@ -31,7 +31,9 @@ << Source: mirror:sourceforge:%n/%n-%v.tar.bz2 -Source-MD5: 577b3b5f19c28de4451cd1a32de76eeb +Source-MD5: 19b1a9f83a09c6ef5c7ab87e4e0f7974 +PatchFile: %n.patch +PatchFile-MD5: 639493a38d4983c247bf61bb36f1eda1 Depends: << ca-bundle, --- NEW FILE: aria2.patch --- >From e73c3c53ffb9ce681fe712142143777eaf50da47 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa <tat...@gm...> Date: Thu, 1 Mar 2012 00:02:29 +0900 Subject: [PATCH] Fixed clang warning and errors. Test for the zero-length array with A2_ARRAY_LEN was commented out since it is only used in unit test code and clang and old gcc 3.4.3 emit error. --- src/AbstractOptionHandler.h | 2 +- src/BitfieldMan.cc | 2 +- src/DefaultBtProgressInfoFile.cc | 3 +- src/DefaultPieceStorage.cc | 2 +- src/DownloadContext.h | 2 +- src/HttpResponse.h | 2 +- src/LpdMessageReceiver.h | 2 +- src/MetalinkParserState.h | 2 +- src/Option.h | 2 +- src/OptionHandler.h | 2 +- src/OptionHandlerException.h | 2 +- src/OptionHandlerImpl.h | 2 +- src/OptionParser.h | 2 +- src/ParserStateMachine.h | 2 +- src/XmlRpcRequestParserState.h | 2 +- src/rpc_helper.h | 2 +- src/util.h | 94 +++++++++++++++++++------------------- test/array_funTest.cc | 8 ++-- 18 files changed, 67 insertions(+), 68 deletions(-) diff --git a/src/AbstractOptionHandler.h b/src/AbstractOptionHandler.h index b13c2b2..c7faf4b 100644 --- a/src/AbstractOptionHandler.h +++ b/src/AbstractOptionHandler.h @@ -44,7 +44,7 @@ namespace aria2 { class Option; -class Pref; +struct Pref; class AbstractOptionHandler : public OptionHandler { protected: diff --git a/src/BitfieldMan.cc b/src/BitfieldMan.cc index 7fde929..bfbc693 100644 --- a/src/BitfieldMan.cc +++ b/src/BitfieldMan.cc @@ -871,7 +871,7 @@ bool BitfieldMan::isBitSetOffsetRange(off_t offset, off_t length) const off_t BitfieldMan::getMissingUnusedLength(size_t startingIndex) const { - if(startingIndex < 0 || blocks_ <= startingIndex) { + if(blocks_ <= startingIndex) { return 0; } off_t length = 0; diff --git a/src/DefaultBtProgressInfoFile.cc b/src/DefaultBtProgressInfoFile.cc index 0698f85..a3efb72 100644 --- a/src/DefaultBtProgressInfoFile.cc +++ b/src/DefaultBtProgressInfoFile.cc @@ -241,8 +241,7 @@ void DefaultBtProgressInfoFile::load() if(version >= 1) { infoHashLength = ntohl(infoHashLength); } - if((infoHashLength < 0) || - ((infoHashLength == 0) && infoHashCheckEnabled)) { + if(infoHashLength == 0 && infoHashCheckEnabled) { throw DL_ABORT_EX(fmt("Invalid info hash length: %d", infoHashLength)); } if(infoHashLength > 0) { diff --git a/src/DefaultPieceStorage.cc b/src/DefaultPieceStorage.cc index 867bb33..a338b6b 100644 --- a/src/DefaultPieceStorage.cc +++ b/src/DefaultPieceStorage.cc @@ -124,7 +124,7 @@ SharedHandle<Piece> DefaultPieceStorage::getPiece(size_t index) { SharedHandle<Piece> piece; - if(0 <= index && index <= bitfieldMan_->getMaxIndex()) { + if(index <= bitfieldMan_->getMaxIndex()) { piece = findUsedPiece(index); if(!piece) { piece.reset(new Piece(index, bitfieldMan_->getBlockLength(index))); diff --git a/src/DownloadContext.h b/src/DownloadContext.h index 4f05431..5bee68a 100644 --- a/src/DownloadContext.h +++ b/src/DownloadContext.h @@ -52,7 +52,7 @@ class RequestGroup; class Signature; class FileEntry; -class ContextAttribute; +struct ContextAttribute; class DownloadContext { diff --git a/src/HttpResponse.h b/src/HttpResponse.h index 7e43cb8..8695b6a 100644 --- a/src/HttpResponse.h +++ b/src/HttpResponse.h @@ -49,7 +49,7 @@ class HttpRequest; class HttpHeader; class StreamFilter; -class MetalinkHttpEntry; +struct MetalinkHttpEntry; class Option; class Checksum; diff --git a/src/LpdMessageReceiver.h b/src/LpdMessageReceiver.h index 757d980..c3061fd 100644 --- a/src/LpdMessageReceiver.h +++ b/src/LpdMessageReceiver.h @@ -42,7 +42,7 @@ namespace aria2 { class SocketCore; -class LpdMessage; +struct LpdMessage; class LpdMessageReceiver { private: diff --git a/src/MetalinkParserState.h b/src/MetalinkParserState.h index 54fce4a..f75c113 100644 --- a/src/MetalinkParserState.h +++ b/src/MetalinkParserState.h @@ -43,7 +43,7 @@ namespace aria2 { class MetalinkParserStateMachine; -class XmlAttr; +struct XmlAttr; class MetalinkParserState { diff --git a/src/Option.h b/src/Option.h index 4d5de42..a1f71e9 100644 --- a/src/Option.h +++ b/src/Option.h @@ -42,7 +42,7 @@ namespace aria2 { -class Pref; +struct Pref; class Option { private: diff --git a/src/OptionHandler.h b/src/OptionHandler.h index 7740b9c..3e17ada 100644 --- a/src/OptionHandler.h +++ b/src/OptionHandler.h @@ -57,7 +57,7 @@ extern const std::string PATH_TO_COMMAND; class Option; -class Pref; +struct Pref; class OptionHandler { public: diff --git a/src/OptionHandlerException.h b/src/OptionHandlerException.h index 946475f..49c456c 100644 --- a/src/OptionHandlerException.h +++ b/src/OptionHandlerException.h @@ -38,7 +38,7 @@ namespace aria2 { -class Pref; +struct Pref; class OptionHandlerException:public RecoverableException { private: diff --git a/src/OptionHandlerImpl.h b/src/OptionHandlerImpl.h index 22e598b..b046cd8 100644 --- a/src/OptionHandlerImpl.h +++ b/src/OptionHandlerImpl.h @@ -44,7 +44,7 @@ namespace aria2 { class Option; -class Pref; +struct Pref; class BooleanOptionHandler : public AbstractOptionHandler { public: diff --git a/src/OptionParser.h b/src/OptionParser.h index 0d05d56..8d28bbe 100644 --- a/src/OptionParser.h +++ b/src/OptionParser.h @@ -47,7 +47,7 @@ class Option; class OptionHandler; -class Pref; +struct Pref; class OptionParser { private: diff --git a/src/ParserStateMachine.h b/src/ParserStateMachine.h index abd07b3..5d0c08d 100644 --- a/src/ParserStateMachine.h +++ b/src/ParserStateMachine.h @@ -42,7 +42,7 @@ namespace aria2 { -class XmlAttr; +struct XmlAttr; class ParserStateMachine { public: diff --git a/src/XmlRpcRequestParserState.h b/src/XmlRpcRequestParserState.h index 6913823..79b421e 100644 --- a/src/XmlRpcRequestParserState.h +++ b/src/XmlRpcRequestParserState.h @@ -42,7 +42,7 @@ namespace aria2 { -class XmlAttr; +struct XmlAttr; namespace rpc { diff --git a/src/rpc_helper.h b/src/rpc_helper.h index a4abae5..f4c2ba6 100644 --- a/src/rpc_helper.h +++ b/src/rpc_helper.h @@ -43,7 +43,7 @@ namespace rpc { -class RpcRequest; +struct RpcRequest; #ifdef ENABLE_XML_RPC RpcRequest xmlParseMemory(const char* xml, size_t size); diff --git a/src/util.h b/src/util.h index 80de4d2..243a2ee 100644 --- a/src/util.h +++ b/src/util.h @@ -71,7 +71,7 @@ class FileEntry; class RequestGroup; class Option; -class Pref; +struct Pref; #define STRTOLL(X) strtoll(X, reinterpret_cast<char**>(0), 10) #define STRTOULL(X) strtoull(X, reinterpret_cast<char**>(0), 10) @@ -111,6 +111,52 @@ inline uint64_t byteswap64(uint64_t x) { namespace util { +extern const std::string DEFAULT_STRIP_CHARSET; + +template<typename InputIterator> +std::pair<InputIterator, InputIterator> stripIter +(InputIterator first, InputIterator last, + const std::string& chars = DEFAULT_STRIP_CHARSET) +{ + for(; first != last && + std::find(chars.begin(), chars.end(), *first) != chars.end(); ++first); + if(first == last) { + return std::make_pair(first, last); + } + InputIterator left = last-1; + for(; left != first && + std::find(chars.begin(), chars.end(), *left) != chars.end(); --left); + return std::make_pair(first, left+1); +} + +template<typename InputIterator> +InputIterator lstripIter +(InputIterator first, InputIterator last, char ch) +{ + for(; first != last && *first == ch; ++first); + return first; +} + +template<typename InputIterator, typename InputIterator2> +InputIterator lstripIter +(InputIterator first, InputIterator last, + InputIterator2 cfirst, InputIterator2 clast) +{ + for(; first != last && std::find(cfirst, clast, *first) != clast; ++first); + return first; +} + +template<typename InputIterator> +InputIterator lstripIter +(InputIterator first, InputIterator last) +{ + return lstripIter(first, last, + DEFAULT_STRIP_CHARSET.begin(), DEFAULT_STRIP_CHARSET.end()); +} + +std::string strip +(const std::string& str, const std::string& chars = DEFAULT_STRIP_CHARSET); + template<typename InputIterator> void divide (std::pair<std::pair<InputIterator, InputIterator>, @@ -161,52 +207,6 @@ inline uint64_t byteswap64(uint64_t x) { int64_t difftv(struct timeval tv1, struct timeval tv2); int32_t difftvsec(struct timeval tv1, struct timeval tv2); -extern const std::string DEFAULT_STRIP_CHARSET; - -template<typename InputIterator> -std::pair<InputIterator, InputIterator> stripIter -(InputIterator first, InputIterator last, - const std::string& chars = DEFAULT_STRIP_CHARSET) -{ - for(; first != last && - std::find(chars.begin(), chars.end(), *first) != chars.end(); ++first); - if(first == last) { - return std::make_pair(first, last); - } - InputIterator left = last-1; - for(; left != first && - std::find(chars.begin(), chars.end(), *left) != chars.end(); --left); - return std::make_pair(first, left+1); -} - -template<typename InputIterator> -InputIterator lstripIter -(InputIterator first, InputIterator last, char ch) -{ - for(; first != last && *first == ch; ++first); - return first; -} - -template<typename InputIterator, typename InputIterator2> -InputIterator lstripIter -(InputIterator first, InputIterator last, - InputIterator2 cfirst, InputIterator2 clast) -{ - for(; first != last && std::find(cfirst, clast, *first) != clast; ++first); - return first; -} - -template<typename InputIterator> -InputIterator lstripIter -(InputIterator first, InputIterator last) -{ - return lstripIter(first, last, - DEFAULT_STRIP_CHARSET.begin(), DEFAULT_STRIP_CHARSET.end()); -} - -std::string strip -(const std::string& str, const std::string& chars = DEFAULT_STRIP_CHARSET); - std::string replace(const std::string& target, const std::string& oldstr, const std::string& newstr); std::string percentEncode(const unsigned char* target, size_t len); diff --git a/test/array_funTest.cc b/test/array_funTest.cc index c361bf2..f922f33 100644 --- a/test/array_funTest.cc +++ b/test/array_funTest.cc @@ -65,11 +65,11 @@ void array_funTest::testArray_and() void array_funTest::testArrayLength() { int64_t ia[] = { 1, 2, 3, 4, 5 }; - int64_t zeroLengthArray[] = {}; - CPPUNIT_ASSERT_EQUAL((size_t)5, A2_ARRAY_LEN(ia)); - // This causes compile error under gcc v3.4.3 opensolaris 5.11 - CPPUNIT_ASSERT_EQUAL((size_t)0, A2_ARRAY_LEN(zeroLengthArray)); + // This causes compile error under clang and gcc v3.4.3 opensolaris + // 5.11 + // int64_t zeroLengthArray[] = {}; + // CPPUNIT_ASSERT_EQUAL((size_t)0, A2_ARRAY_LEN(zeroLengthArray)); } namespace { -- 1.7.5.4 |