64 lines
2.1 KiB
Diff
64 lines
2.1 KiB
Diff
diff -up aria2-1.14.2/src/DHTConnection.h.gcc47 aria2-1.14.2/src/DHTConnection.h
|
|
--- aria2-1.14.2/src/DHTConnection.h.gcc47 2012-03-21 16:40:43.254890487 -0400
|
|
+++ aria2-1.14.2/src/DHTConnection.h 2012-03-21 16:40:50.808828820 -0400
|
|
@@ -37,6 +37,7 @@
|
|
|
|
#include "common.h"
|
|
#include <string>
|
|
+#include <unistd.h>
|
|
|
|
namespace aria2 {
|
|
|
|
diff -up aria2-1.14.2/src/util.h.gcc47 aria2-1.14.2/src/util.h
|
|
--- aria2-1.14.2/src/util.h.gcc47 2012-03-21 16:37:18.889559038 -0400
|
|
+++ aria2-1.14.2/src/util.h 2012-03-21 16:37:54.340269569 -0400
|
|
@@ -111,6 +111,24 @@ std::string nativeToUtf8(const std::stri
|
|
|
|
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>
|
|
void divide
|
|
(std::pair<std::pair<InputIterator, InputIterator>,
|
|
@@ -161,24 +179,6 @@ std::string itos(int64_t value, bool com
|
|
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)
|