You can subscribe to this list here.
2006 |
Jan
|
Feb
(24) |
Mar
(9) |
Apr
(4) |
May
(7) |
Jun
(13) |
Jul
(19) |
Aug
(1) |
Sep
(12) |
Oct
(20) |
Nov
(1) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(6) |
Mar
(24) |
Apr
(1) |
May
(10) |
Jun
(30) |
Jul
(46) |
Aug
(20) |
Sep
(12) |
Oct
(27) |
Nov
(51) |
Dec
(58) |
2008 |
Jan
(40) |
Feb
(40) |
Mar
(78) |
Apr
(138) |
May
(4) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(2) |
Jul
(10) |
Aug
(1) |
Sep
(11) |
Oct
(31) |
Nov
(7) |
Dec
(1) |
2011 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
2013 |
Jan
(3) |
Feb
(5) |
Mar
(1) |
Apr
|
May
|
Jun
(11) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2014 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <arn...@us...> - 2008-01-01 15:28:57
|
Revision: 119 http://adchpp.svn.sourceforge.net/adchpp/?rev=119&view=rev Author: arnetheduck Date: 2008-01-01 07:28:48 -0800 (Tue, 01 Jan 2008) Log Message: ----------- Remove socketmanager from swig interface Modified Paths: -------------- adchpp/trunk/Doxyfile adchpp/trunk/swig/adchpp.i Modified: adchpp/trunk/Doxyfile =================================================================== --- adchpp/trunk/Doxyfile 2007-12-31 20:15:30 UTC (rev 118) +++ adchpp/trunk/Doxyfile 2008-01-01 15:28:48 UTC (rev 119) @@ -91,7 +91,7 @@ # Doxygen will generate a detailed section even if there is only a brief # description. -ALWAYS_DETAILED_SEC = NO +ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those @@ -476,7 +476,7 @@ # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) -WARN_FORMAT = "$file:$line: $text " +WARN_FORMAT = "$file:$line: $text " # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written @@ -750,7 +750,7 @@ # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. -HHC_LOCATION = "C:\Program Files\HTML Help Workshop\hhc.exe " +HHC_LOCATION = "C:\Program Files\HTML Help Workshop\hhc.exe " # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that @@ -1071,8 +1071,8 @@ # instead of the = operator. PREDEFINED = _REENTRANT \ - "GETSETREF(a,b,c)=private: a b; public: const a& get##c() const {}; void set##c(const a&) {}; " \ - "GETSET(a,b,c)=private: a b; public: a get##c() const {}; void set##c(a) {}; " + "GETSETREF(a,b,c)=private: a b; public: const a& get##c() const {}; void set##c(const a&) {}; " \ + "GETSET(a,b,c)=private: a b; public: a get##c() const {}; void set##c(a) {}; " # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-31 20:15:30 UTC (rev 118) +++ adchpp/trunk/swig/adchpp.i 2008-01-01 15:28:48 UTC (rev 119) @@ -12,7 +12,6 @@ #include <adchpp/Exception.h> #include <adchpp/PluginManager.h> #include <adchpp/TigerHash.h> -#include <adchpp/SocketManager.h> using namespace adchpp; @@ -64,7 +63,6 @@ %nodefaultdtor SettingsManager; %nodefaultdtor Util; %nodefaultdtor PluginManager; -%nodefaultdtor SocketManager; namespace adchpp { class Client; @@ -513,10 +511,6 @@ } } -class SocketManager { - public: -}; - class ClientManager { public: @@ -744,6 +738,5 @@ LogManager* getLM() { return LogManager::getInstance(); } SettingsManager* getSM() { return SettingsManager::getInstance(); } PluginManager* getPM() { return PluginManager::getInstance(); } - SocketManager* getSocketManager() { return SocketManager::getInstance(); } } %} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-31 20:15:40
|
Revision: 118 http://adchpp.svn.sourceforge.net/adchpp/?rev=118&view=rev Author: arnetheduck Date: 2007-12-31 12:15:30 -0800 (Mon, 31 Dec 2007) Log Message: ----------- Use memory pool again Modified Paths: -------------- adchpp/trunk/adchpp/Buffer.h adchpp/trunk/adchpp/ManagedSocket.cpp adchpp/trunk/adchpp/PluginManager.cpp adchpp/trunk/adchpp/PluginManager.h adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/Util.cpp adchpp/trunk/adchpp/Util.h adchpp/trunk/swig/adchpp.i adchpp/trunk/swig/lua.i adchpp/trunk/swig/python.i Added Paths: ----------- adchpp/trunk/adchpp/Buffer.cpp Added: adchpp/trunk/adchpp/Buffer.cpp =================================================================== --- adchpp/trunk/adchpp/Buffer.cpp (rev 0) +++ adchpp/trunk/adchpp/Buffer.cpp 2007-12-31 20:15:30 UTC (rev 118) @@ -0,0 +1,18 @@ +#include "adchpp.h" + +#include "Buffer.h" +#include "SettingsManager.h" + +namespace adchpp { + +Pool<ByteVector, Buffer::Clear> Buffer::free; + +void Buffer::Clear::operator()(ByteVector& v) { + if(v.capacity() > static_cast<size_t>(SETTING(BUFFER_SIZE))) { + ByteVector().swap(v); + } else { + v.clear(); + } +} + +} Modified: adchpp/trunk/adchpp/Buffer.h =================================================================== --- adchpp/trunk/adchpp/Buffer.h 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/Buffer.h 2007-12-31 20:15:30 UTC (rev 118) @@ -1,6 +1,8 @@ #ifndef BUFFER_H_ #define BUFFER_H_ +#include "Pool.h" +#include "Util.h" #include "FastAlloc.h" namespace adchpp { @@ -10,29 +12,36 @@ */ class Buffer : public intrusive_ptr_base, public FastAlloc<Buffer> { public: - Buffer(const std::string& str) : buf((uint8_t*)str.data(), (uint8_t*)str.data() + str.size()) { } - Buffer(const void* ptr, const size_t size) : buf((uint8_t*) ptr, ((uint8_t*)ptr)+size) { } - Buffer(const size_t size) : buf(size) { } + Buffer(const std::string& str) : bufp(free) { append((uint8_t*)str.data(), (uint8_t*)str.data() + str.size()); } + Buffer(const void* ptr, const size_t size) : bufp(free) { append((uint8_t*) ptr, ((uint8_t*)ptr)+size); } + Buffer(const size_t size) : bufp(free) { resize(size); } + ~Buffer() { free = bufp; } - operator const ByteVector&() const { return buf; } - operator ByteVector&() { return buf; } + operator const ByteVector&() const { return buf(); } + operator ByteVector&() { return buf(); } - void resize(size_t new_size) { buf.resize(new_size); } - size_t size() const { return buf.size(); } - const uint8_t* data() const { return &buf[0]; } - uint8_t* data() { return &buf[0]; } + void resize(size_t new_size) { buf().resize(new_size); } + size_t size() const { return buf().size(); } + const uint8_t* data() const { return &buf()[0]; } + uint8_t* data() { return &buf()[0]; } /** Erase the first n bytes */ - void erase_first(size_t n) { - buf.erase(buf.begin(), buf.begin() + n); - } + void erase_first(size_t n) { buf().erase(buf().begin(), buf().begin() + n); } template<typename InputIterator> - void append(InputIterator start, InputIterator end) { - buf.insert(buf.end(), start, end); - } + void append(InputIterator start, InputIterator end) { buf().insert(buf().end(), start, end); } private: - ByteVector buf; + + const ByteVector& buf() const { return *bufp; } + ByteVector& buf() { return *bufp; } + + ByteVector* bufp; + + struct Clear { + ADCHPP_DLL void operator()(ByteVector& x); + }; + + ADCHPP_DLL static Pool<ByteVector, Clear> free; }; typedef boost::intrusive_ptr<Buffer> BufferPtr; Modified: adchpp/trunk/adchpp/ManagedSocket.cpp =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-31 20:15:30 UTC (rev 118) @@ -42,19 +42,6 @@ ManagedSocket::~ManagedSocket() throw() { dcdebug("ManagedSocket deleted\n"); -#if 0 - if(outBuf) { - dcdebug("Left (%d): %.*s\n", outBuf->size(), outBuf->size(), &(*outBuf)[0]); - Util::freeBuf = outBuf; - } - -#ifdef _WIN32 - if(writeBuf) { - dcdebug("Left2 (%d): %.*s\n", writeBuf->size(), writeBuf->size(), &(*writeBuf)[0]); - Util::freeBuf = writeBuf; - } -#endif -#endif } void ManagedSocket::write(const BufferPtr& buf) throw() { Modified: adchpp/trunk/adchpp/PluginManager.cpp =================================================================== --- adchpp/trunk/adchpp/PluginManager.cpp 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/PluginManager.cpp 2007-12-31 20:15:30 UTC (rev 118) @@ -52,6 +52,7 @@ namespace adchpp { using namespace std; +using namespace std::tr1; using namespace std::tr1::placeholders; PluginManager* PluginManager::instance = 0; @@ -65,6 +66,10 @@ } +void PluginManager::attention(const function<void()>& f) { + SocketManager::getInstance()->addJob(f); +} + bool PluginManager::loadPlugin(const string& file) { if(file.length() < 3) { return false; Modified: adchpp/trunk/adchpp/PluginManager.h =================================================================== --- adchpp/trunk/adchpp/PluginManager.h 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/PluginManager.h 2007-12-31 20:15:30 UTC (rev 118) @@ -22,7 +22,7 @@ * * ADCH++ contains a rather powerful plugin API that can be used to create advanced * plugins that change or add to ADCH++'s behaviour. Most plugins will need - * PluginManager.h, ClientManager. and Client.h included to work, even though the + * PluginManager.h, ClientManager.h and Client.h included to work, even though the * other header files are available as well (they're more likely to change in future * versions though). You can use any method that is declared as DLL or is inline, the * others are meant to be internal to ADCH++, very likely to change/disappear and will @@ -36,13 +36,7 @@ * of the ADCH++ plugin API. This version usually follows the main ADCH++ version, * unless a small update is made that I judge shouldn't affect plugins in any way. * Most of the time, recompiling the plugin should be enough, unless any major changes - * have been made, and your plugin doesn't rely on the nasty internals. As to compilers, - * the windows version is compiled using Visual C++ 7.1 (.NET), with various optimizations - * enabled. In theory, VC6 should work as well, as I haven't seen any information about - * changes in the name mangling scheme, but if you get strange linker errors, don't - * blame me. For best results, make sure you have the same settings. The Linux version - * is compiled with G++ 3.4.x, and I don't have a clue if older versions will work - * (probably not...). + * have been made, and your plugin doesn't rely on the nasty internals. * * @section Threads Threads * @@ -50,19 +44,16 @@ * communication while the other does all other work (handle protocol data and * so on). All plugins are run in the worker thread, which is the only thread * visible to the API. You are only allowed to interact with ADCH++ from this - * thread, as none of the API is thread safe (this is a performance issue, this way - * no locks are taken), unless otherwise noted. This has a few important - * consequences. First off, you can assume that your plugin will only be called - * by this thread, which means that you don't have to worry about multithreading - * issues unless you start threads by yourself. Second, any work you do in a plugin - * halts <b>all</b> of ADCH++'s processing (apart from receiving/sending buffered - * data), in other words, don't do any lengthy processing in the on methods, as - * the whole of ADCH++ will suffer. Third, if you indeed start another thread, make + * thread, as none of the API is thread safe, unless otherwise noted. This has a + * few important consequences. First off, you can assume that your plugin will + * only be called by this thread, which means that you don't have to worry about + * multithreading issues unless you start threads by yourself. Second, any work you + * do in a plugin halts <b>all</b> of ADCH++'s processing (apart from receiving/sending + * buffered data), in other words, don't do any lengthy processing in the on methods, + * as the whole of ADCH++ will suffer. Third, if you indeed start another thread, make * sure you don't use any API functions from it apart from those explicitly marked * as thread safe. To indicate from a plugin that you have work to do in the main - * worker thread, call PluginManager::attention(). This will generate an - * Attention event in the near future, where your thread can do its work (be - * careful though, the Attention event might be raised by other plugins). + * worker thread, call PluginManager::attention(). */ #ifndef ADCHPP_PLUGINMANAGER_H @@ -147,6 +138,13 @@ typedef Registry::iterator RegistryIter; /** + * This is a thread-safe method to call when you need to perform some work + * in the main ADCH++ worker thread. Your job will be executed once, when + * time permits. + */ + ADCHPP_DLL void attention(const std::tr1::function<void()>& f); + + /** * Get a list of currently loaded plugins */ const StringList& getPluginList() const { @@ -174,7 +172,7 @@ * @return false if name was already registered and call fails */ bool registerPlugin(const std::string& name, Plugin* ptr) { - return registry.insert(std::make_pair(name, ptr)).second; + return registry.insert(std::make_pair(name, ptr)).second; } /** @return True if the plugin existed and was thus unregistered */ @@ -193,7 +191,7 @@ /** * The full map of registered plugins. */ - const Registry& getPlugins() { + const Registry& getPlugins() const { return registry; } Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-12-31 20:15:30 UTC (rev 118) @@ -578,7 +578,6 @@ ms->completeWrite(buffers, 0); return; } - //Util::freeBuf = writeBuf; disconnect(ms, error); return; } @@ -650,7 +649,7 @@ bool stop; - typedef unordered_set<ManagedSocketPtr, PointerHash<ManagedSocket> > SocketSet; + typedef unordered_set<ManagedSocketPtr> SocketSet; /** Sockets that have a pending read */ SocketSet active; /** Sockets that are being written to but should be disconnected if timeout it reached */ Modified: adchpp/trunk/adchpp/Util.cpp =================================================================== --- adchpp/trunk/adchpp/Util.cpp 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/Util.cpp 2007-12-31 20:15:30 UTC (rev 118) @@ -63,7 +63,6 @@ string Util::cfgPath; size_t Util::reasons[REASON_LAST]; -Pool<ByteVector, Util::Clear> Util::freeBuf; static void sgenrand(unsigned long seed); @@ -74,14 +73,6 @@ setCfgPath(configPath); } -void Util::Clear::operator()(ByteVector& v) { - if(v.capacity() > static_cast<size_t>(SETTING(BUFFER_SIZE))) { - ByteVector().swap(v); - } else { - v.clear(); - } -} - /** * Decodes a URL the best it can... * Default ports: Modified: adchpp/trunk/adchpp/Util.h =================================================================== --- adchpp/trunk/adchpp/Util.h 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/adchpp/Util.h 2007-12-31 20:15:30 UTC (rev 118) @@ -22,6 +22,15 @@ #include "Pool.h" #include "Mutex.h" +namespace std { namespace tr1 { + +template<typename T> +struct hash<boost::intrusive_ptr<T> > { + size_t operator()(const boost::intrusive_ptr<T>& t) const { return hash<T*>()(t.get()); } +}; + +} } + namespace adchpp { struct intrusive_ptr_base { @@ -81,24 +90,6 @@ void operator()(T* ptr) { delete ptr; } }; -/** A generic hash for pointers */ -template<class T> -struct PointerHash { -#if _MSC_VER >= 1300 - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; -#endif - size_t operator()(const T* a) const { return ((size_t)a)/sizeof(T); } - bool operator()(const T* a, const T* b) { return a < b; } - - size_t operator()(const boost::intrusive_ptr<T>& a) const { return ((size_t)a.get())/sizeof(T); } - bool operator()(const boost::intrusive_ptr<T>& a, const boost::intrusive_ptr<T>& b) { return a.get() < b.get(); } -}; -template<> -struct PointerHash<void> { - size_t operator()(const void* a) const { return ((size_t)a)>>2; } -}; - /** * Compares two values * @return -1 if v1 < v2, 0 if v1 == v2 and 1 if v1 > v2 @@ -307,12 +298,6 @@ /** Avoid this! Use the one of a connected socket instead... */ ADCHPP_DLL static std::string getLocalIp(); - struct Clear { - void operator()(ByteVector& x); - }; - /** Pool of free buffers */ - ADCHPP_DLL static Pool<ByteVector, Clear> freeBuf; - ADCHPP_DLL static uint32_t rand(); static uint32_t rand(uint32_t high) { return rand() % high; } static uint32_t rand(uint32_t low, uint32_t high) { return rand(high-low) + low; } Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/swig/adchpp.i 2007-12-31 20:15:30 UTC (rev 118) @@ -718,6 +718,8 @@ class PluginManager { public: + void attention(const std::tr1::function<void()>& f); + //typedef HASH_MAP<std::string, Plugin*> Registry; //typedef Registry::iterator RegistryIter; Modified: adchpp/trunk/swig/lua.i =================================================================== --- adchpp/trunk/swig/lua.i 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/swig/lua.i 2007-12-31 20:15:30 UTC (rev 118) @@ -42,6 +42,11 @@ LuaFunction(const LuaFunction& rhs) : L(rhs.L), registryItem(rhs.registryItem) { } LuaFunction& operator=(const LuaFunction& rhs) { L = rhs.L; registryItem = rhs.registryItem; return *this; } + void operator()() { + pushFunction(); + docall(0, 0); + } + void operator()(adchpp::Client& c) { pushFunction(); @@ -144,6 +149,10 @@ lua_pushnumber(L, (lua_Number)$1); SWIG_arg++; } +%typemap(in) std::tr1::function<void () > { + $1 = LuaFunction(L); +} + %typemap(in) std::tr1::function<void (adchpp::Client &) > { $1 = LuaFunction(L); } Modified: adchpp/trunk/swig/python.i =================================================================== --- adchpp/trunk/swig/python.i 2007-12-30 21:41:46 UTC (rev 117) +++ adchpp/trunk/swig/python.i 2007-12-31 20:15:30 UTC (rev 118) @@ -5,6 +5,9 @@ #undef socklen_t %} +%typemap(in) std::tr1::function<void ()> { + $1 = PyHandle($input, false); +} %typemap(in) std::tr1::function<void (adchpp::Client&)> { $1 = PyHandle($input, false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-30 21:41:50
|
Revision: 117 http://adchpp.svn.sourceforge.net/adchpp/?rev=117&view=rev Author: arnetheduck Date: 2007-12-30 13:41:46 -0800 (Sun, 30 Dec 2007) Log Message: ----------- Use ref-counted buffer to save some memory Modified Paths: -------------- adchpp/trunk/adchpp/AdcCommand.cpp adchpp/trunk/adchpp/AdcCommand.h adchpp/trunk/adchpp/Client.cpp adchpp/trunk/adchpp/Client.h adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/adchpp/ClientManager.h adchpp/trunk/adchpp/ManagedSocket.cpp adchpp/trunk/adchpp/ManagedSocket.h adchpp/trunk/adchpp/Socket.cpp adchpp/trunk/adchpp/Socket.h adchpp/trunk/adchpp/SocketManager.cpp adchpp/trunk/adchpp/SocketManager.h adchpp/trunk/swig/adchpp.i adchpp/trunk/test/PyClient.py Added Paths: ----------- adchpp/trunk/adchpp/Buffer.h Modified: adchpp/trunk/adchpp/AdcCommand.cpp =================================================================== --- adchpp/trunk/adchpp/AdcCommand.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/AdcCommand.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -24,9 +24,9 @@ using namespace std; -AdcCommand::AdcCommand() : cmdInt(0), str(0), from(0), type(0) { } +AdcCommand::AdcCommand() : cmdInt(0), from(0), type(0) { } -AdcCommand::AdcCommand(Severity sev, Error err, const string& desc, char aType /* = TYPE_INFO */) : cmdInt(CMD_STA), str(&tmp), from(HUB_SID), type(aType) { +AdcCommand::AdcCommand(Severity sev, Error err, const string& desc, char aType /* = TYPE_INFO */) : cmdInt(CMD_STA), from(HUB_SID), type(aType) { addParam(Util::toString(sev * 100 + err)); addParam(desc); } @@ -44,28 +44,30 @@ } } -void AdcCommand::parse(const string& aLine) throw(ParseException) { - if(aLine.length() < 5) { +void AdcCommand::parse(const char* buf, size_t len) throw(ParseException) { + if(len < 5) { throw ParseException("Command too short"); } - type = aLine[0]; + type = buf[0]; if(type != TYPE_BROADCAST && type != TYPE_CLIENT && type != TYPE_DIRECT && type != TYPE_ECHO && type != TYPE_FEATURE && type != TYPE_INFO && type != TYPE_HUB && type != TYPE_UDP) { throw ParseException("Invalid type"); } - cmd[0] = aLine[1]; - cmd[1] = aLine[2]; - cmd[2] = aLine[3]; + cmd[0] = buf[1]; + cmd[1] = buf[2]; + cmd[2] = buf[3]; - if(aLine[4] != ' ') { + if(buf[4] != ' ') { throw ParseException("Missing space after command"); } - string::size_type len = aLine.length() - 1; // aLine contains trailing LF + // Skip trailing LF + len--; - const char* buf = aLine.c_str(); + parameters.reserve(8); + string cur; cur.reserve(64); @@ -158,10 +160,19 @@ } } -const string& AdcCommand::toString() const { - if(!str->empty()) - return *str; +const BufferPtr& AdcCommand::getBuffer() const { + if(!buffer) { + buffer = BufferPtr(new Buffer(toString())); + } + return buffer; +} +string AdcCommand::toString() const { + if(buffer) { + return string((char*)buffer->data(), buffer->size()); + } + string tmp; + tmp.reserve(128); tmp += type; @@ -206,7 +217,7 @@ for(string::size_type i = start; i < getParameters().size(); ++i) { if(toCode(name) == toCode(getParameters()[i].c_str())) { getParameters().erase(getParameters().begin() + i); - resetString(); + resetBuffer(); return true; } } Modified: adchpp/trunk/adchpp/AdcCommand.h =================================================================== --- adchpp/trunk/adchpp/AdcCommand.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/AdcCommand.h 2007-12-30 21:41:46 UTC (rev 117) @@ -22,6 +22,7 @@ #include "common.h" #include "Exception.h" #include "Util.h" +#include "Buffer.h" namespace adchpp { @@ -108,33 +109,37 @@ ADCHPP_DLL AdcCommand(); ADCHPP_DLL explicit AdcCommand(Severity sev, Error err, const std::string& desc, char aType = TYPE_INFO); - explicit AdcCommand(uint32_t cmd, char aType = TYPE_INFO, uint32_t aFrom = HUB_SID) : cmdInt(cmd), str(&tmp), from(aFrom), type(aType) { } - explicit AdcCommand(const std::string& aLine) throw(ParseException) : cmdInt(0), str(&aLine), type(0) { parse(aLine); } - AdcCommand(const AdcCommand& rhs) : parameters(rhs.parameters), cmdInt(rhs.cmdInt), str(&tmp), from(rhs.from), to(rhs.to), type(rhs.type) { } + explicit AdcCommand(uint32_t cmd, char aType = TYPE_INFO, uint32_t aFrom = HUB_SID) : cmdInt(cmd), from(aFrom), type(aType) { } + explicit AdcCommand(const std::string& aLine) throw(ParseException) : cmdInt(0), type(0) { parse(aLine); } + explicit AdcCommand(const BufferPtr& buffer_) throw(ParseException) : buffer(buffer_), cmdInt(0), type(0) { parse((const char*)buffer->data(), buffer->size()); } + AdcCommand(const AdcCommand& rhs) : parameters(rhs.parameters), cmdInt(rhs.cmdInt), from(rhs.from), to(rhs.to), type(rhs.type) { } - ADCHPP_DLL void parse(const std::string& aLine) throw(ParseException); + void parse(const std::string& str) throw(ParseException) { parse(str.data(), str.size()); } + ADCHPP_DLL void parse(const char* buf, size_t len) throw(ParseException); uint32_t getCommand() const { return cmdInt; } char getType() const { return type; } - + std::string getFourCC() const { std::string tmp(4, 0); tmp[0] = type; tmp[1] = cmd[0]; tmp[2] = cmd[1]; tmp[3] = cmd[2]; return tmp; } StringList& getParameters() { return parameters; } const StringList& getParameters() const { return parameters; } + ADCHPP_DLL std::string toString() const; - ADCHPP_DLL const std::string& toString() const; - void resetString() { tmp.clear(); str = &tmp; } - AdcCommand& addParam(const std::string& name, const std::string& value) { parameters.push_back(name); parameters.back() += value; return *this; } + AdcCommand& addParam(const std::string& param) { parameters.push_back(param); return *this; } + const std::string& getParam(size_t n) const { return getParameters().size() > n ? getParameters()[n] : Util::emptyString; } + void resetBuffer() { buffer = BufferPtr(); } + const std::string& getFeatures() const { return features; } /** Return a named parameter where the name is a two-letter code */ @@ -148,6 +153,8 @@ ADCHPP_DLL static void escape(const std::string& s, std::string& out); + ADCHPP_DLL const BufferPtr& getBuffer() const; + uint32_t getTo() const { return to; } void setTo(uint32_t aTo) { to = aTo; } uint32_t getFrom() const { return from; } @@ -161,14 +168,15 @@ StringList parameters; std::string features; + + mutable BufferPtr buffer; + union { char cmdChar[4]; uint8_t cmd[4]; uint32_t cmdInt; }; - const std::string* str; - mutable std::string tmp; - + uint32_t from; uint32_t to; char type; Added: adchpp/trunk/adchpp/Buffer.h =================================================================== --- adchpp/trunk/adchpp/Buffer.h (rev 0) +++ adchpp/trunk/adchpp/Buffer.h 2007-12-30 21:41:46 UTC (rev 117) @@ -0,0 +1,43 @@ +#ifndef BUFFER_H_ +#define BUFFER_H_ + +#include "FastAlloc.h" + +namespace adchpp { + +/** + * Reference-counted buffer + */ +class Buffer : public intrusive_ptr_base, public FastAlloc<Buffer> { +public: + Buffer(const std::string& str) : buf((uint8_t*)str.data(), (uint8_t*)str.data() + str.size()) { } + Buffer(const void* ptr, const size_t size) : buf((uint8_t*) ptr, ((uint8_t*)ptr)+size) { } + Buffer(const size_t size) : buf(size) { } + + operator const ByteVector&() const { return buf; } + operator ByteVector&() { return buf; } + + void resize(size_t new_size) { buf.resize(new_size); } + size_t size() const { return buf.size(); } + const uint8_t* data() const { return &buf[0]; } + uint8_t* data() { return &buf[0]; } + + /** Erase the first n bytes */ + void erase_first(size_t n) { + buf.erase(buf.begin(), buf.begin() + n); + } + + template<typename InputIterator> + void append(InputIterator start, InputIterator end) { + buf.insert(buf.end(), start, end); + } +private: + ByteVector buf; +}; + +typedef boost::intrusive_ptr<Buffer> BufferPtr; +typedef std::vector<BufferPtr> BufferList; + +} + +#endif /*BUFFER_H_*/ Modified: adchpp/trunk/adchpp/Client.cpp =================================================================== --- adchpp/trunk/adchpp/Client.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/Client.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -43,19 +43,19 @@ // Lightweight call forwarders, instead of tr1::bind struct Handler { Handler(void (Client::*f)(), Client* c_) : c(c_), f0(f) { } - Handler(void (Client::*f)(const ByteVector&), Client* c_) : c(c_), f1(f) { } + Handler(void (Client::*f)(const BufferPtr&), Client* c_) : c(c_), f1(f) { } void operator()() throw() { (c->*f0)(); } - void operator()(const ByteVector& bv) throw() { + void operator()(const BufferPtr& bv) throw() { (c->*f1)(bv); } Client* c; union { void (Client::*f0)(); - void (Client::*f1)(const ByteVector&); + void (Client::*f1)(const BufferPtr&); }; }; } @@ -90,43 +90,59 @@ return (i != psd.end()) ? i->second : 0; } -void Client::onData(const ByteVector& data) throw() { - dcdebug("In (%d): %.*s\n", data.size(), data.size(), &data[0]); - +void Client::onData(const BufferPtr& buf) throw() { + uint8_t* data = buf->data(); size_t done = 0; - size_t len = data.size(); + size_t len = buf->size(); while(!disconnecting && done < len) { if(dataBytes > 0) { size_t n = (size_t)min(dataBytes, (int64_t)(len - done)); - dataHandler(*this, &data[done], n); + dataHandler(*this, data + done, n); dataBytes -= n; done += n; } else { size_t j = done; while(j < len && data[j] != '\n') ++j; - + if(j == len) { - line.append((char*)&data[done], j - done); + if(!buffer) { + if(done == 0) { + buffer = buf; + } else { + buffer = BufferPtr(new Buffer(data + done, len - done)); + } + } else { + buffer->append(data + done, data + len); + } return; + } else if(!buffer) { + if(done == 0 && j == len-1) { + buffer = buf; + } else { + buffer = BufferPtr(new Buffer(data + done, j - done + 1)); + } + } else { + buffer->append(data + done, data + j + 1); } - line.append((char*)&data[done], j - done + 1); // include LF done = j + 1; + + size_t max_cmd_size = static_cast<size_t>(SETTING(MAX_COMMAND_SIZE)); - if(SETTING(MAX_COMMAND_SIZE) > 0 && line.size() > (size_t)SETTING(MAX_COMMAND_SIZE)) { + if(max_cmd_size > 0 && buffer->size() > max_cmd_size) { send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_GENERIC, "Command too long")); disconnect(Util::REASON_MAX_COMMAND_SIZE); return; } - if(line.size() == 1) { - line.clear(); + if(buffer->size() == 1) { + buffer = BufferPtr(); continue; } try { - AdcCommand cmd(line); + AdcCommand cmd(buffer); if(cmd.getType() == 'H') { cmd.setFrom(getSID()); @@ -136,9 +152,9 @@ } ClientManager::getInstance()->onReceive(*this, cmd); } catch(const ParseException&) { - ClientManager::getInstance()->onBadLine(*this, line); + ClientManager::getInstance()->onBadLine(*this, string((char*)buffer->data(), buffer->size())); } - line.clear(); + buffer = BufferPtr(); } } } @@ -157,7 +173,7 @@ info[code] = value; } changed[code] = value; - INF.clear(); + INF = BufferPtr(); } bool Client::getChangedFields(AdcCommand& cmd) const throw() { @@ -172,11 +188,11 @@ return !info.empty(); } -const string& Client::getINF() const throw() { - if(INF.empty()) { +const BufferPtr& Client::getINF() const throw() { + if(!INF) { AdcCommand cmd(AdcCommand::CMD_INF, AdcCommand::TYPE_BROADCAST, getSID()); getAllFields(cmd); - INF = cmd.toString(); + INF = cmd.getBuffer(); } return INF; } @@ -243,7 +259,6 @@ void Client::disconnect(Util::Reason reason) throw() { if(socket && !disconnecting) { disconnecting = true; - line.clear(); socket->disconnect(reason); } } Modified: adchpp/trunk/adchpp/Client.h =================================================================== --- adchpp/trunk/adchpp/Client.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/Client.h 2007-12-30 21:41:46 UTC (rev 117) @@ -68,16 +68,14 @@ const StringList& getSupportList() const throw() { return supportList; } bool supports(const std::string& feat) const throw() { return find(supportList.begin(), supportList.end(), feat) != supportList.end(); } - void send(const char* command, size_t len) throw() { - dcassert(socket != NULL); - socket->write(command, len); - } - void send(const AdcCommand& cmd) throw() { send(cmd.toString()); } + void send(const char* command, size_t len) throw() { send(BufferPtr(new Buffer(command, len))); } + + void send(const AdcCommand& cmd) throw() { send(cmd.getBuffer()); } void send(const std::string& command) throw() { send(command.c_str(), command.length()); } - void send(const char* command) throw() { socket->write(command, strlen(command)); } - - void fastSend(const std::string& command, bool lowPrio = false) throw() { - socket->fastWrite(command.c_str(), command.length(), lowPrio); + void send(const BufferPtr& command) throw() { socket->write(command); } + + void fastSend(const BufferPtr& command, bool lowPrio = false) throw() { + socket->fastWrite(command, lowPrio); } size_t getQueuedBytes() throw() { return socket->getQueuedBytes(); } @@ -97,7 +95,7 @@ /** Add any flags that have been updated to the AdcCommand (type etc is not set) */ ADCHPP_DLL bool getChangedFields(AdcCommand& cmd) const throw(); ADCHPP_DLL bool getAllFields(AdcCommand& cmd) const throw(); - ADCHPP_DLL const std::string& getINF() const throw(); + ADCHPP_DLL const BufferPtr& getINF() const throw(); void resetChanged() { changed.clear(); } @@ -169,20 +167,21 @@ bool disconnecting; PSDList psd; - std::string line; + BufferPtr buffer; ManagedSocketPtr socket; int64_t dataBytes; time_t floodTimer; /** Latest INF cached */ - mutable std::string INF; + mutable BufferPtr INF; DataFunction dataHandler; void setSocket(const ManagedSocketPtr& aSocket) throw(); void onConnected() throw(); - void onData(const ByteVector&) throw(); + void onData(const BufferPtr&) throw(); void onFailed() throw(); + }; } Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/ClientManager.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -49,7 +49,7 @@ } void ClientManager::send(const AdcCommand& cmd, bool lowPrio /* = false */) throw() { - const string& txt = cmd.toString(); + const BufferPtr& buf = cmd.getBuffer(); bool all = false; switch (cmd.getType()) { @@ -61,21 +61,20 @@ int override = 0; signalSend_(*i->second, cmd, override); if(!(override & DONT_SEND)) { - i->second->fastSend(txt, lowPrio); + i->second->fastSend(buf, lowPrio); } } } - SocketManager::getInstance()->addAllWriters(); } break; case AdcCommand::TYPE_DIRECT: // Fallthrough case AdcCommand::TYPE_ECHO: { ClientIter i = clients.find(cmd.getTo()); if (i != clients.end()) { - i->second->send(txt); + i->second->send(buf); if (COMPATIBILITY || cmd.getType() == AdcCommand::TYPE_ECHO) { i = clients.find(cmd.getFrom()); if (i != clients.end()) { - i->second->send(txt); + i->second->send(buf); } } } @@ -83,14 +82,11 @@ } } -void ClientManager::sendToAll(const string& cmd) throw() { - { - FastMutex::Lock l(ManagedSocket::getWriteMutex()); - for (ClientIter i = clients.begin(); i != clients.end(); ++i) { - i->second->fastSend(cmd); - } +void ClientManager::sendToAll(const BufferPtr& buf) throw() { + FastMutex::Lock l(ManagedSocket::getWriteMutex()); + for (ClientIter i = clients.begin(); i != clients.end(); ++i) { + i->second->fastSend(buf); } - SocketManager::getInstance()->addAllWriters(); } size_t ClientManager::getQueuedBytes() throw() { @@ -106,7 +102,7 @@ void ClientManager::sendTo(const AdcCommand& cmd, const uint32_t& to) throw() { ClientIter i = clients.find(to); if (i != clients.end()) { - i->second->send(cmd.toString()); + i->second->send(cmd.getBuffer()); } } @@ -115,7 +111,7 @@ AdcCommand s(AdcCommand::CMD_SUP); for (StringIter i = supports.begin(); i != supports.end(); ++i) s.addParam("AD" + *i); - strings.sup = s.toString(); + strings.sup = s.getBuffer(); strings.inf = AdcCommand(AdcCommand::CMD_INF) .addParam("NI", SETTING(HUB_NAME)) @@ -124,7 +120,7 @@ .addParam("VE", versionString) .addParam("CT5") .addParam("HU1") // ADC <=0.13 - .toString(); + .getBuffer(); } bool ClientManager::checkFlooding(Client& c, const AdcCommand& cmd) throw() { @@ -202,7 +198,7 @@ } void ClientManager::badState(Client& c, const AdcCommand& cmd) throw() { - c.send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_BAD_STATE, "Invalid state for command").addParam("FC", cmd.toString().substr(0, 4))); + c.send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_BAD_STATE, "Invalid state for command").addParam("FC", cmd.getFourCC())); c.disconnect(Util::REASON_BAD_STATE); } @@ -323,7 +319,7 @@ } else if (j->compare(2, j->size()-2, "0.0.0.0") == 0) { c.setField("I4", c.getIp()); *j = "I4" + c.getIp(); - cmd.resetString(); + cmd.resetBuffer(); } else if (j->size()-2 != c.getIp().size() || j->compare(2, j->size()-2, c.getIp()) != 0) { c.send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_BAD_IP, "Your ip is " + c.getIp()).addParam("IP", c.getIp())); c.disconnect(Util::REASON_INVALID_IP); @@ -453,13 +449,11 @@ dcassert(c.getState() == Client::STATE_IDENTIFY || c.getState() == Client::STATE_VERIFY); dcdebug("%s entering NORMAL\n", AdcCommand::fromSID(c.getSID()).c_str()); - if (sendData) { - string str; - for (ClientIter i = clients.begin(); i != clients.end(); ++i) { - str += i->second->getINF(); + if(sendData) { + for(ClientIter i = clients.begin(); i != clients.end(); ++i) { + c.send(i->second->getINF()); } - c.send(str); - if (sendOwnInf) { + if(sendOwnInf) { sendToAll(c.getINF()); c.send(c.getINF()); } Modified: adchpp/trunk/adchpp/ClientManager.h =================================================================== --- adchpp/trunk/adchpp/ClientManager.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/ClientManager.h 2007-12-30 21:41:46 UTC (rev 117) @@ -69,9 +69,10 @@ /** Send a command to the clients according to its type */ ADCHPP_DLL void send(const AdcCommand& cmd, bool lowPrio = false) throw(); + void sendToAll(const AdcCommand& cmd) throw() { sendToAll(cmd.getBuffer()); } /** Send command to all regardless of type */ - void sendToAll(const AdcCommand& cmd) throw() { sendToAll(cmd.toString()); } - ADCHPP_DLL void sendToAll(const std::string& cmd) throw(); + void sendToAll(const std::string& cmd) throw() { sendToAll(BufferPtr(new Buffer(cmd))); } + ADCHPP_DLL void sendToAll(const BufferPtr& buffer) throw(); /** Send command to a single client regardless of type */ ADCHPP_DLL void sendTo(const AdcCommand& cmd, const uint32_t& to) throw(); @@ -188,8 +189,8 @@ // Strings used in various places along the pipeline...rebuilt in updateCache()... struct Strings { - std::string sup; - std::string inf; + BufferPtr sup; + BufferPtr inf; } strings; friend class Singleton<ClientManager>; Modified: adchpp/trunk/adchpp/ManagedSocket.cpp =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/ManagedSocket.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -31,7 +31,7 @@ FastMutex ManagedSocket::writeMutex; -ManagedSocket::ManagedSocket() throw() : outBuf(0), overFlow(0), disc(0) +ManagedSocket::ManagedSocket() throw() : overFlow(0), disc(0) #ifdef _WIN32 , writeBuf(0) #else @@ -42,6 +42,7 @@ ManagedSocket::~ManagedSocket() throw() { dcdebug("ManagedSocket deleted\n"); +#if 0 if(outBuf) { dcdebug("Left (%d): %.*s\n", outBuf->size(), outBuf->size(), &(*outBuf)[0]); Util::freeBuf = outBuf; @@ -53,105 +54,118 @@ Util::freeBuf = writeBuf; } #endif +#endif } -void ManagedSocket::write(const char* buf, size_t len) throw() { - bool add = false; - { - FastMutex::Lock l(writeMutex); - add = fastWrite(buf, len); +void ManagedSocket::write(const BufferPtr& buf) throw() { + FastMutex::Lock l(writeMutex); + fastWrite(buf); +} + +static size_t sum(const BufferList& l) { + size_t bytes = 0; + for(BufferList::const_iterator i = l.begin(); i != l.end(); ++i) { + bytes += (*i)->size(); } - if(add) { - SocketManager::getInstance()->addWriter(this); - } + return bytes; } -bool ManagedSocket::fastWrite(const char* buf, size_t len, bool lowPrio /* = false */) throw() { - if((len == 0) || (disc > 0)) - return false; +size_t ManagedSocket::getQueuedBytes() const { + return sum(outBuf); +} + +void ManagedSocket::fastWrite(const BufferPtr& buf, bool lowPrio /* = false */) throw() { + if((buf->size() == 0) || (disc > 0)) + return; - bool add = false; - if(outBuf == 0) { - add = true; - outBuf = Util::freeBuf; - } + size_t queued = getQueuedBytes(); - if(outBuf->size() + len > (uint32_t)SETTING(MAX_BUFFER_SIZE)) { + if(queued + buf->size() > (size_t)SETTING(MAX_BUFFER_SIZE)) { if(lowPrio && SETTING(KEEP_SLOW_USERS)) { - return false; + return; } else if(overFlow > 0 && overFlow + SETTING(OVERFLOW_TIMEOUT) < GET_TICK()) { disconnect(Util::REASON_WRITE_OVERFLOW); - return false; + return; } else { overFlow = GET_TICK(); } } - Stats::queueBytes += len; + Stats::queueBytes += buf->size(); Stats::queueCalls++; - outBuf->insert(outBuf->end(), buf, buf + len); - return add; + outBuf.push_back(buf); } -ByteVector* ManagedSocket::prepareWrite() { +void ManagedSocket::prepareWrite(BufferList& buffers) { if(isBlocked()) { - return 0; + return; } - - ByteVector* buffer = 0; - { - FastMutex::Lock l(writeMutex); - - if(outBuf == 0) { - return 0; - } - - if(SETTING(MAX_SEND_SIZE) > 0 && (outBuf->size() > (size_t)SETTING(MAX_SEND_SIZE))) { - // Damn, we take a copy and leave the rest... - buffer = Util::freeBuf; - buffer->insert(buffer->end(), outBuf->begin(), outBuf->begin() + SETTING(MAX_SEND_SIZE)); - outBuf->erase(outBuf->begin(), outBuf->begin() + SETTING(MAX_SEND_SIZE)); - } else { - buffer = outBuf; - outBuf = 0; + FastMutex::Lock l(writeMutex); + size_t queued = getQueuedBytes(); + if(queued == 0) { + return; + } + + size_t max_send = static_cast<size_t>(SETTING(MAX_SEND_SIZE)); + + if((max_send > 0) && (queued > max_send)) { + // Copy as many buffers as possible + // TODO The last copied buffer should be split... + size_t done = 0; + BufferList::iterator i; + for(i = outBuf.begin(); i != outBuf.end(); ++i) { + buffers.push_back(*i); + done += (*i)->size(); + if(done > max_send) { + break; + } } + outBuf.erase(outBuf.begin(), i); + } else { + buffers.swap(outBuf); } - return buffer; } -bool ManagedSocket::completeWrite(ByteVector* buf, size_t written) throw() { +bool ManagedSocket::completeWrite(BufferList& buffers, size_t written) throw() { Stats::sendBytes += written; Stats::sendCalls++; - bool moreData; - { - FastMutex::Lock l(writeMutex); + size_t done = 0; + BufferList::iterator i = buffers.begin(); + for(; i != buffers.end(); ++i) { + if(done + (*i)->size() > written) { + break; + } + done += (*i)->size(); + } + + FastMutex::Lock l(writeMutex); + + if(done != written) { + // i points to the first not fully written buffer.. + size_t diff = written - done; + if(diff != 0) { + (*i)->erase_first(diff); + } - if(written != buf->size()) { - if(outBuf == 0) { - buf->erase(buf->begin(), buf->begin() + written); - outBuf = buf; - buf = 0; - } else { - outBuf->insert(outBuf->begin(), buf->begin() + written, buf->end()); - } - } - moreData = (outBuf != 0) || disc > 0; - if( !outBuf || (outBuf->size() < (size_t)SETTING(MAX_BUFFER_SIZE)) ) - overFlow = 0; - + outBuf.insert(outBuf.begin(), i, buffers.end()); } + + buffers.clear(); - if(buf) { - Util::freeBuf = buf; + size_t left = getQueuedBytes(); + if(overFlow > 0) { + if(left < static_cast<size_t>(SETTING(MAX_BUFFER_SIZE))) { + overFlow = 0; + } } - return moreData; + return left > 0 || disc > 0; } -bool ManagedSocket::completeRead(ByteVector* buf) throw() { +bool ManagedSocket::completeRead(const BufferPtr& buf) throw() { Stats::recvBytes += buf->size(); Stats::recvCalls++; SocketManager::getInstance()->addJob(std::tr1::bind(&ManagedSocket::processData, this, buf)); @@ -163,6 +177,7 @@ } void ManagedSocket::failSocket(int) throw() { + sock.disconnect(); SocketManager::getInstance()->addJob(failedHandler); } @@ -173,12 +188,10 @@ disc = GET_TICK() + SETTING(DISCONNECT_TIMEOUT); Util::reasons[reason]++; - SocketManager::getInstance()->addDisconnect(this); } -void ManagedSocket::processData(ByteVector* buf) throw() { - dataHandler(*buf); - Util::freeBuf = buf; +void ManagedSocket::processData(const BufferPtr& buf) throw() { + dataHandler(buf); } } Modified: adchpp/trunk/adchpp/ManagedSocket.h =================================================================== --- adchpp/trunk/adchpp/ManagedSocket.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/ManagedSocket.h 2007-12-30 21:41:46 UTC (rev 117) @@ -26,9 +26,10 @@ #include "Mutex.h" #include "Signal.h" #include "Util.h" +#include "Buffer.h" namespace adchpp { - + /** * An asynchronous socket managed by SocketManager. */ @@ -37,16 +38,16 @@ void create() throw(SocketException) { sock.create(); } /** Asynchronous write */ - ADCHPP_DLL void write(const char* buf, size_t len) throw(); + ADCHPP_DLL void write(const BufferPtr& buf) throw(); /** Asynchronous write, assumes that buffers are locked */ - ADCHPP_DLL bool fastWrite(const char* buf, size_t len, bool lowPrio = false) throw(); + ADCHPP_DLL void fastWrite(const BufferPtr& buf, bool lowPrio = false) throw(); /** Returns the lock used for the write buffers */ static FastMutex& getWriteMutex() { return writeMutex; } /** Returns the number of bytes in the output buffer; buffers must be locked */ - size_t getQueuedBytes() { return outBuf ? outBuf->size() : 0; } + size_t getQueuedBytes() const; /** Asynchronous disconnect. Pending data will be written, but no more data will be read. */ ADCHPP_DLL void disconnect(Util::Reason reason) throw(); @@ -56,7 +57,7 @@ typedef std::tr1::function<void()> ConnectedHandler; void setConnectedHandler(const ConnectedHandler& handler) { connectedHandler = handler; } - typedef std::tr1::function<void(const ByteVector&)> DataHandler; + typedef std::tr1::function<void(const BufferPtr&)> DataHandler; void setDataHandler(const DataHandler& handler) { dataHandler = handler; } typedef std::tr1::function<void()> FailedHandler; void setFailedHandler(const FailedHandler& handler) { failedHandler = handler; } @@ -69,17 +70,17 @@ ~ManagedSocket() throw(); // Functions for Writer (called from Writer thread) - ByteVector* prepareWrite(); + void prepareWrite(BufferList& buffers); void completeAccept() throw(); - bool completeWrite(ByteVector* buf, size_t written) throw(); - bool completeRead(ByteVector* buf) throw(); + bool completeWrite(BufferList& buffers, size_t written) throw(); + bool completeRead(const BufferPtr& buf) throw(); void failSocket(int error) throw(); void shutdown() { sock.shutdown(); } void close() { sock.disconnect(); } // Functions processing events - void processData(ByteVector* buf) throw(); + void processData(const BufferPtr& buf) throw(); // No copies ManagedSocket(const ManagedSocket&); @@ -88,8 +89,9 @@ friend class Writer; Socket sock; + /** Output buffer, for storing data that's waiting to be transmitted */ - ByteVector* outBuf; + BufferList outBuf; /** Overflow timer, the buffer is allowed to overflow for 1 minute, then disconnect */ uint32_t overFlow; /** Disconnection scheduled for this socket */ @@ -98,11 +100,11 @@ std::string ip; #ifdef _WIN32 /** Data currently being sent by WSASend, 0 if not sending */ - ByteVector* writeBuf; - /** WSABUF for data being sent */ - WSABUF wsabuf; + BufferList writeBuf; + /** Buffer containing WSABUF's for data being sent */ + BufferPtr wsabuf; - bool isBlocked() { return writeBuf != 0; } + bool isBlocked() { return !writeBuf.empty(); } #else bool blocked; bool isBlocked() { return blocked; } Modified: adchpp/trunk/adchpp/Socket.cpp =================================================================== --- adchpp/trunk/adchpp/Socket.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/Socket.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -163,15 +163,6 @@ return len; } -void Socket::write(const char* aBuffer, size_t aLen) throw(SocketException) { - size_t pos = writeNB(aBuffer, aLen); - while(pos < aLen) { - // Try once every second at least, you never know... - wait(1000, WAIT_WRITE); - pos += writeNB(aBuffer + pos, aLen - pos); - } -} - #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0 #endif @@ -187,13 +178,13 @@ * @return 0 if socket would block, otherwise the number of bytes written * @throw SocketExcpetion Send failed. */ -int Socket::writeNB(const char* aBuffer, size_t aLen) throw(SocketException) { +int Socket::write(const void* aBuffer, size_t aLen) throw(SocketException) { dcdebug("Writing %db: %.100s\n", aLen, aBuffer); dcassert(aLen > 0); - int i = ::send(sock, aBuffer, (int)aLen, MSG_NOSIGNAL | MSG_DONTWAIT); + int i = ::send(sock,(char*)aBuffer, (int)aLen, MSG_NOSIGNAL | MSG_DONTWAIT); if(i == SOCKET_ERROR) { - if(socket_errno == EWOULDBLOCK) { + if(socket_errno == EWOULDBLOCK || socket_errno == EINTR || socket_errno == EAGAIN) { return 0; } checksockerr(i); @@ -211,7 +202,7 @@ * @param aLen Data length * @throw SocketExcpetion Send failed. */ -void Socket::writeTo(const string& aIp, short aPort, const char* aBuffer, size_t aLen) throw(SocketException) { +void Socket::writeTo(const string& aIp, short aPort, const void* aBuffer, size_t aLen) throw(SocketException) { if(sock == INVALID_SOCKET) { create(TYPE_UDP); } @@ -238,7 +229,7 @@ serv_addr.sin_addr.s_addr = *((uint32_t*)host->h_addr); } - int i = ::sendto(sock, aBuffer, (int)aLen, 0, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); + int i = ::sendto(sock, (char*)aBuffer, (int)aLen, 0, (struct sockaddr*)&serv_addr, sizeof(serv_addr)); checksockerr(i); } Modified: adchpp/trunk/adchpp/Socket.h =================================================================== --- adchpp/trunk/adchpp/Socket.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/Socket.h 2007-12-30 21:41:46 UTC (rev 117) @@ -107,12 +107,11 @@ virtual void bind(short aPort) throw(SocketException); virtual void connect(const std::string& aIp, short aPort) throw(SocketException); void connect(const std::string& aIp, const std::string& aPort) throw(SocketException) { connect(aIp, (short)Util::toInt(aPort)); } + int read(void* aBuffer, size_t aBufLen) throw(SocketException); virtual std::string accept(const Socket& aSocket) throw(SocketException); - virtual void write(const char* aBuffer, size_t aLen) throw(SocketException); + virtual int write(const void* aBuffer, size_t aLen) throw(SocketException); void write(const std::string& aData) throw(SocketException) { write(aData.data(), aData.length()); } - virtual int writeNB(const char* aBuffer, size_t aLen) throw(SocketException); - int writeNB(const std::string& aData) throw(SocketException) { return writeNB(aData.data(), aData.length()); } - virtual void writeTo(const std::string& aIp, short aPort, const char* aBuffer, size_t aLen) throw(SocketException); + virtual void writeTo(const std::string& aIp, short aPort, const void* aBuffer, size_t aLen) throw(SocketException); void writeTo(const std::string& aIp, short aPort, const std::string& aData) throw(SocketException) { writeTo(aIp, aPort, aData.data(), aData.length()); } virtual void disconnect() throw(); @@ -120,7 +119,6 @@ void shutdown() { ::shutdown(sock, SD_BOTH); } - int read(void* aBuffer, size_t aBufLen) throw(SocketException); int wait(uint32_t millis, int waitFor) throw(SocketException); static std::string resolve(const std::string& aDns); Modified: adchpp/trunk/adchpp/SocketManager.cpp =================================================================== --- adchpp/trunk/adchpp/SocketManager.cpp 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/SocketManager.cpp 2007-12-30 21:41:46 UTC (rev 117) @@ -321,13 +321,13 @@ DWORD x = 0; - ms->writeBuf = Util::freeBuf; - ms->writeBuf->resize(ACCEPT_BUF_SIZE); + ms->writeBuf.push_back(BufferPtr(new Buffer(ACCEPT_BUF_SIZE))); + ms->writeBuf.back()->resize(ACCEPT_BUF_SIZE); MSOverlapped* overlapped = pool.get(); *overlapped = MSOverlapped(MSOverlapped::ACCEPT_DONE, ms); - if(!::AcceptEx(srv.getSocket(), ms->getSocket(), &(*ms->writeBuf)[0], 0, ACCEPT_BUF_SIZE/2, ACCEPT_BUF_SIZE/2, &x, overlapped)) { + if(!::AcceptEx(srv.getSocket(), ms->getSocket(), ms->writeBuf.back()->data(), 0, ACCEPT_BUF_SIZE/2, ACCEPT_BUF_SIZE/2, &x, overlapped)) { int error = ::WSAGetLastError(); if(error != ERROR_IO_PENDING) { if(!stop) { @@ -348,12 +348,11 @@ struct sockaddr_in *local, *remote; int sz1 = sizeof(local), sz2 = sizeof(remote); - ::GetAcceptExSockaddrs(&(*ms->writeBuf)[0], 0, ACCEPT_BUF_SIZE/2, ACCEPT_BUF_SIZE/2, reinterpret_cast<sockaddr**>(&local), &sz1, reinterpret_cast<sockaddr**>(&remote), &sz2); + ::GetAcceptExSockaddrs(ms->writeBuf.back()->data(), 0, ACCEPT_BUF_SIZE/2, ACCEPT_BUF_SIZE/2, reinterpret_cast<sockaddr**>(&local), &sz1, reinterpret_cast<sockaddr**>(&remote), &sz2); ms->setIp(inet_ntoa(remote->sin_addr)); - Util::freeBuf = ms->writeBuf; - ms->writeBuf = 0; + ms->writeBuf.clear(); active.insert(ms); accepting.erase(ms); @@ -393,18 +392,14 @@ } void handleReadDone(const ManagedSocketPtr& ms) throw() { - ByteVector* readBuf = Util::freeBuf; + BufferPtr readBuf(new Buffer(SETTING(BUFFER_SIZE))); - if(readBuf->size() < (size_t)SETTING(BUFFER_SIZE)) - readBuf->resize(SETTING(BUFFER_SIZE)); + WSABUF wsa = { (u_long)readBuf->size(), (char*)readBuf->data() }; - WSABUF wsa = { (u_long)readBuf->size(), (char*)&(*readBuf)[0] }; - DWORD bytes = 0; DWORD flags = 0; if(::WSARecv(ms->getSocket(), &wsa, 1, &bytes, &flags, 0, 0) == SOCKET_ERROR) { - Util::freeBuf = readBuf; int error = ::WSAGetLastError(); if(error != WSAEWOULDBLOCK) { // Socket failed... @@ -417,7 +412,6 @@ } if(bytes == 0) { - Util::freeBuf = readBuf; disconnect(ms, 0); return; } @@ -429,13 +423,13 @@ } void write(const ManagedSocketPtr& ms) throw() { - if(stop || !(*ms)) { + if(stop || !(*ms) || !ms->writeBuf.empty()) { return; } - ms->writeBuf = ms->prepareWrite(); + ms->prepareWrite(ms->writeBuf); - if(!ms->writeBuf) { + if(ms->writeBuf.empty()) { uint32_t now = GET_TICK(); if(ms->disc || (ms->isBlocked() && ms->disc < now)) { @@ -444,14 +438,17 @@ return; } - ms->wsabuf.len = ms->writeBuf->size(); - ms->wsabuf.buf = reinterpret_cast<char*>(&(*ms->writeBuf)[0]); - + ms->wsabuf->resize(sizeof(WSABUF) * ms->writeBuf.size()); + for(size_t i = 0; i < ms->writeBuf.size(); ++i) { + WSABUF wsa = { (u_long)ms->writeBuf[i]->size(), (char*)ms->writeBuf[i]->data() }; + memcpy(ms->wsabuf->data() + i * sizeof(WSABUF), &wsa, sizeof(WSABUF)); + } + MSOverlapped* overlapped = pool.get(); *overlapped = MSOverlapped(MSOverlapped::WRITE_DONE, ms); DWORD x = 0; - if(::WSASend(ms->getSocket(), &ms->wsabuf, 1, &x, 0, reinterpret_cast<LPWSAOVERLAPPED>(overlapped), 0) != 0) { + if(::WSASend(ms->getSocket(), (WSABUF*)ms->wsabuf->data(), ms->writeBuf.size(), &x, 0, reinterpret_cast<LPWSAOVERLAPPED>(overlapped), 0) != 0) { int error = ::WSAGetLastError(); if(error != WSA_IO_PENDING) { pool.put(overlapped); @@ -461,19 +458,10 @@ } void handleWriteDone(const ManagedSocketPtr& ms, DWORD bytes) throw() { - ByteVector* buf = ms->writeBuf; - ms->writeBuf = 0; - - if(!buf) { - dcdebug("No buffer in handleWriteDone??\n"); - return; - } - ms->completeWrite(buf, bytes); + ms->completeWrite(ms->writeBuf, bytes); } void failWrite(const ManagedSocketPtr& ms, int error) throw() { - Util::freeBuf = ms->writeBuf; - ms->writeBuf = 0; disconnect(ms, error); } @@ -516,6 +504,7 @@ ManagedSocketPtr ms(new ManagedSocket()); try { ms->setIp(ms->sock.accept(srv)); + ms->sock.setBlocking(false); if(!poller.associate(ms)) { LOG(SocketManager::className, "Unable to associate EPoll: " + Util::translateError(errno)); @@ -540,14 +529,10 @@ return false; for(;;) { - ByteVector* readBuf = Util::freeBuf; - if(readBuf->size() < (size_t)SETTING(BUFFER_SIZE)) - readBuf->resize(SETTING(BUFFER_SIZE)); - - ssize_t bytes = ::recv(ms->getSocket(), &(*readBuf)[0], readBuf->size(), MSG_DONTWAIT); + BufferPtr buf(new Buffer(SETTING(BUFFER_SIZE))); + + ssize_t bytes = ::recv(ms->getSocket(), buf->data(), buf->size(), MSG_DONTWAIT); if(bytes == -1) { - Util::freeBuf = readBuf; - int error = errno; if(error != EAGAIN && error != EINTR) { ms->close(); @@ -556,14 +541,13 @@ } break; } else if(bytes == 0) { - Util::freeBuf = readBuf; ms->close(); disconnect(ms, 0); return false; } - readBuf->resize(bytes); - ms->completeRead(readBuf); + buf->resize(bytes); + ms->completeRead(buf); } return true; } @@ -572,30 +556,33 @@ if(stop || !(*ms)) { return; } - + BufferList buffers; while(true) { - ByteVector* writeBuf = ms->prepareWrite(); - - if(!writeBuf) { + ms->prepareWrite(buffers); + if(buffers.empty()) { uint32_t now = GET_TICK(); if(ms->disc || (ms->isBlocked() && ms->disc < now)) { disconnect(ms, 0); } return; } - - ssize_t bytes = ::send(ms->getSocket(), &(*writeBuf)[0], writeBuf->size(), MSG_NOSIGNAL | MSG_DONTWAIT); + std::vector<iovec> iov(buffers.size()); + for(size_t i = 0; i < buffers.size(); ++i) { + iov[i].iov_base = buffers[i]->data(); + iov[i].iov_len = buffers[i]->size(); + } + ssize_t bytes = ::writev(ms->getSocket(), &iov[0], iov.size()); if(bytes == -1) { int error = errno; if(error == EAGAIN) { - ms->completeWrite(writeBuf, 0); + ms->completeWrite(buffers, 0); return; } - Util::freeBuf = writeBuf; + //Util::freeBuf = writeBuf; disconnect(ms, error); return; } - if(!ms->completeWrite(writeBuf, bytes)) { + if(!ms->completeWrite(buffers, bytes)) { break; } } @@ -717,15 +704,6 @@ return 0; } -void SocketManager::addWriter(const ManagedSocketPtr& ms) throw() { -} - -void SocketManager::addAllWriters() throw() { -} - -void SocketManager::addDisconnect(const ManagedSocketPtr& ms) throw() { -} - void SocketManager::addJob(const Callback& callback) throw() { FastMutex::Lock l(processMutex); Modified: adchpp/trunk/adchpp/SocketManager.h =================================================================== --- adchpp/trunk/adchpp/SocketManager.h 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/adchpp/SocketManager.h 2007-12-30 21:41:46 UTC (rev 117) @@ -37,10 +37,6 @@ void startup() throw(ThreadException) { start(); } void shutdown(); - void addWriter(const ManagedSocketPtr& ms) throw(); - void addDisconnect(const ManagedSocketPtr& ms) throw(); - void addAllWriters() throw(); - typedef std::tr1::function<void (const ManagedSocketPtr&)> IncomingHandler; void setIncomingHandler(const IncomingHandler& handler) { incomingHandler = handler; } Modified: adchpp/trunk/swig/adchpp.i =================================================================== --- adchpp/trunk/swig/adchpp.i 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/swig/adchpp.i 2007-12-30 21:41:46 UTC (rev 117) @@ -327,8 +327,8 @@ StringList& getParameters(); //const StringList& getParameters() const; - const std::string& toString() const; - void resetString(); + std::string toString() const; + void resetBuffer(); AdcCommand& addParam(const std::string& name, const std::string& value); AdcCommand& addParam(const std::string& str); Modified: adchpp/trunk/test/PyClient.py =================================================================== --- adchpp/trunk/test/PyClient.py 2007-12-28 15:35:31 UTC (rev 116) +++ adchpp/trunk/test/PyClient.py 2007-12-30 21:41:46 UTC (rev 117) @@ -1,159 +1,157 @@ -#!/usr/bin/python -import sys - -sys.path.append('../build/debug-default/bin') - -CLIENTS = 100 - -import socket, threading, time - -from pyadchpp import ParseException, Util_initialize, CID, CID_generate, Encoder_toBase32, Encoder_fromBase32, AdcCommand, AdcCommand_toSID, TigerHash, CID - -Util_initialize("") - -class Client(object): - def __init__(self, n): - self.sock = socket.socket() - self.pid = CID_generate() - tiger = TigerHash() - tiger.update(self.pid.data()) - self.cid = CID(Encoder_toBase32(tiger.finalize())) - self.nick = "user_" + str(n) + "_" + self.cid.toBase32() - self.running = True - self.line = "" - - def connect(self, ipport): - self.sock.connect(ipport) - - def command(self, cmd): - s = cmd.toString() - print self.nick, "sending", s - self.sock.send(cmd.toString()) - - def get_command(self): - index = self.line.find('\n') - while index == -1: - line = self.sock.recv(4096) - if len(line) == 0: - return None - - self.line += line - index = self.line.find('\n') - if index==0: - self.line = self.line[index+1:] - index = -1 - - self.lastline = self.line[:index + 1] - self.line = self.line[index+1:] - return AdcCommand(self.lastline) - - def expect(self, command): - cmd = self.get_command() - if not cmd or cmd.getCommand() != command: - if not cmd: - error = "expect: connection closed" - else: - error = "expect: " + cmd.getCommandString() - raise Exception, error - return cmd - - def login(self, ipport): - self.connect(ipport) - cmd = AdcCommand(AdcCommand.CMD_SUP, AdcCommand.TYPE_HUB, 0) - cmd.addParam("ADBASE").addParam("ADTIGR") - self.command(cmd) - self.expect(AdcCommand.CMD_SUP) - sid = self.expect(AdcCommand.CMD_SID) - self.sid = AdcCommand_toSID(sid.getParam(0)) - - cmd = AdcCommand(AdcCommand.CMD_INF, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("ID" + self.cid.toBase32()) - cmd.addParam("PD" + self.pid.toBase32()) - cmd.addParam("NI" + self.nick) - self.command(cmd) - -# def test_close(self): -# self.sock.close() - - def test_error(self): - cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("+error") - self.command(cmd) - - def test_test(self): - cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("+test") - self.command(cmd) - - def test_msg(self): - cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("hello from " + self.nick) - self.command(cmd) - - def test_nick(self): - self.nick = "user_" + str(CID_generate()) - cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("renaming myself to " + self.nick) - self.command(cmd) - cmd = AdcCommand(AdcCommand.CMD_INF, AdcCommand.TYPE_BROADCAST, self.sid) - cmd.addParam("NI", self.nick) - self.command(cmd) - - def __call__(self): - try: - while self.get_command(): - pass - self.sock.close() - except Exception, e: - print "Client " + self.nick + " died:", e - except ParseException, e: - print "Client " + self.nick + " died, line was:", self.lastline - self.running = False -try: - import sys - if len(sys.argv) > 2: - ip = sys.argv[1] - port = int(sys.argv[2]) - else: - ip = "127.0.0.1" - port = 2780 - - clients = [] - for i in range(CLIENTS): - if i > 0 and i % 10 == 0: - #time.sleep(3) - pass - print "Logging in", i - client = Client(i) - clients.append(client) - client.login((ip,port)) - t = threading.Thread(target = client, name = client.nick) - t.setDaemon(True) - t.start() - - time.sleep(5) - import random - tests = [] - for k,v in Client.__dict__.iteritems(): - if len(k) < 4 or k[0:4] != "test": - continue - tests.append(v) - print tests - while len(clients) > 0: - time.sleep(1) - for c in clients: - if not c.running: - clients.remove(c) - - if len(clients) == 0: - break - - if random.random() > (5./len(clients)): - continue - try: - random.choice(tests)(c) - except Exception, e: - pass - print "No more clients" -except Exception, e: - print e +#!/usr/bin/python +import sys + +sys.path.append('../build/debug-default/bin') + +CLIENTS = 100 + +import socket, threading, time, random, sys + +from pyadchpp import ParseException, Util_initialize, CID, CID_generate, Encoder_toBase32, Encoder_fromBase32, AdcCommand, AdcCommand_toSID, TigerHash, CID + +Util_initialize("") + +class Client(object): + def __init__(self, n): + self.sock = socket.socket() + self.pid = CID_generate() + tiger = TigerHash() + tiger.update(self.pid.data()) + self.cid = CID(Encoder_toBase32(tiger.finalize())) + self.nick = "user_" + str(n) + "_" + self.cid.toBase32() + self.running = True + self.line = "" + + def connect(self, ipport): + self.sock.connect(ipport) + + def command(self, cmd): + s = cmd.toString() + print self.nick, "sending", len(s), s + self.sock.send(s) + + def get_command(self): + index = self.line.find('\n') + while index == -1: + line = self.sock.recv(4096) + if len(line) == 0: + return None + + self.line += line + index = self.line.find('\n') + if index==0: + self.line = self.line[index+1:] + index = -1 + + self.lastline = self.line[:index + 1] + self.line = self.line[index+1:] + return AdcCommand(self.lastline) + + def expect(self, command): + cmd = self.get_command() + if not cmd or cmd.getCommand() != command: + if not cmd: + error = "expect: connection closed" + else: + error = "expect: " + cmd.getCommandString() + raise Exception, error + return cmd + + def login(self, ipport): + self.connect(ipport) + cmd = AdcCommand(AdcCommand.CMD_SUP, AdcCommand.TYPE_HUB, 0) + cmd.addParam("ADBASE").addParam("ADTIGR") + self.command(cmd) + self.expect(AdcCommand.CMD_SUP) + sid = self.expect(AdcCommand.CMD_SID) + self.sid = AdcCommand_toSID(sid.getParam(0)) + + cmd = AdcCommand(AdcCommand.CMD_INF, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("ID" + self.cid.toBase32()) + cmd.addParam("PD" + self.pid.toBase32()) + cmd.addParam("NI" + self.nick) + self.command(cmd) + +# def test_close(self): +# self.sock.close() + + def test_error(self): + cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("+error") + self.command(cmd) + + def test_test(self): + cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("+test") + self.command(cmd) + + def test_msg(self): + cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("hello from " + self.nick) + self.command(cmd) + + def test_nick(self): + self.nick = "user_" + str(CID_generate()) + cmd = AdcCommand(AdcCommand.CMD_MSG, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("renaming myself to " + self.nick) + self.command(cmd) + cmd = AdcCommand(AdcCommand.CMD_INF, AdcCommand.TYPE_BROADCAST, self.sid) + cmd.addParam("NI", self.nick) + self.command(cmd) + + def __call__(self): + try: + while self.get_command(): + pass + self.sock.close() + except Exception, e: + print "Client " + self.nick + " died:", e + except ParseException, e: + print "Client " + self.nick + " died, line was:", self.lastline + self.running = False +try: + if len(sys.argv) > 2: + ip = sys.argv[1] + port = int(sys.argv[2]) + else: + ip = "127.0.0.1" + port = 2780 + + clients = [] + for i in range(CLIENTS): + if i > 0 and i % 10 == 0: + #time.sleep(3) + pass + print "Logging in", i + client = Client(i) + clients.append(client) + client.login((ip,port)) + t = threading.Thread(target = client, name = client.nick) + t.setDaemon(True) + t.start() + + time.sleep(5) + tests = [] + for k,v in Client.__dict__.iteritems(): + if len(k) < 4 or k[0:4] != "test": + continue + tests.append(v) + print tests + while len(clients) > 0: + #time.sleep(1) + for c in clients: + if not c.running: + clients.remove(c) + + if len(clients) == 0: + break + + if random.random() > (5./len(clients)): + continue + try: + random.choice(tests)(c) + except Exception, e: + pass + print "No more clients" +except Exception, e: + print e This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-29 22:04:07
|
Revision: 954 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=954&view=rev Author: arnetheduck Date: 2007-12-29 14:04:05 -0800 (Sat, 29 Dec 2007) Log Message: ----------- Fix language selector Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/DCPlusPlus.cpp dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/File.cpp dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/Util.cpp dcplusplus/trunk/dcpp/Util.h dcplusplus/trunk/win32/AppearancePage.cpp dcplusplus/trunk/win32/AppearancePage.h dcplusplus/trunk/win32/DCPlusPlus.rc dcplusplus/trunk/win32/stdafx.h Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/SConstruct 2007-12-29 22:04:05 UTC (rev 954) @@ -158,7 +158,7 @@ pot_args = ['xgettext','--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE', '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcp...@li...', - '--no-wrap', '--keyword=_', '--output=$TARGET', '$SOURCES'] + '--no-wrap', '--keyword=_', '--keyword=T_', '--output=$TARGET', '$SOURCES'] pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES')) env.Append(BUILDERS = {'PotBuild' : pot_bld}) Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/changelog.txt 2007-12-29 22:04:05 UTC (rev 954) @@ -6,7 +6,8 @@ * [ADC] Searches filtered by token if available so that each search window only gets its own results * [ADC] Implemented test version of bloom filters which will dramatically reduce hub bandwidth usage for TTH searches * Fixed a crash with partial list browsing - +* Replaced homegrown i18n solution with gettext +§ -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) Modified: dcplusplus/trunk/dcpp/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2007-12-29 22:04:05 UTC (rev 954) @@ -89,12 +89,10 @@ _nl_msg_cat_cntr++; } - printf(_("test")); + //if(!SETTING(LANGUAGE_FILE).empty()) { + //ResourceManager::getInstance()->loadLanguage(SETTING(LANGUAGE_FILE)); + //} - if(!SETTING(LANGUAGE_FILE).empty()) { - ResourceManager::getInstance()->loadLanguage(SETTING(LANGUAGE_FILE)); - } - FavoriteManager::getInstance()->load(); CryptoManager::getInstance()->loadCertificates(); Modified: dcplusplus/trunk/dcpp/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-29 22:04:05 UTC (rev 954) @@ -170,7 +170,7 @@ #ifdef BUILDING_DCPP #define PACKAGE "dcpp" -#define LOCALEDIR (Util::getDataPath() + "/locale/").c_str() +#define LOCALEDIR Util::getLocalePath().c_str() #define _(String) dgettext(PACKAGE, String) #endif Modified: dcplusplus/trunk/dcpp/File.cpp =================================================================== --- dcplusplus/trunk/dcpp/File.cpp 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/File.cpp 2007-12-29 22:04:05 UTC (rev 954) @@ -419,7 +419,8 @@ hFind = ::FindFirstFile(Text::toT(path + pattern).c_str(), &data); if(hFind != INVALID_HANDLE_VALUE) { do { - ret.push_back(path + Text::fromT(data.cFileName)); + const char* extra = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? "\\" : ""; + ret.push_back(path + Text::fromT(data.cFileName) + extra); } while(::FindNextFile(hFind, &data)); ::FindClose(hFind); @@ -429,7 +430,8 @@ if (dir) { while (struct dirent* ent = readdir(dir)) { if (fnmatch(pattern.c_str(), ent->d_name, 0) == 0) { - ret.push_back(path + Text::toUtf8(ent->d_name)); + const char* extra = (ent->d_type & DT_DIR) ? "/" : ""; + ret.push_back(path + Text::toUtf8(ent->d_name) + extra); } } closedir(dir); Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-29 22:04:05 UTC (rev 954) @@ -37,7 +37,7 @@ // Strings "Nick", "UploadSpeed", "Description", "DownloadDirectory", "EMail", "ExternalIp", "Font", "MainFrameOrder", "MainFrameWidths", "HubFrameOrder", "HubFrameWidths", - "LanguageFile", "SearchFrameOrder", "SearchFrameWidths", "FavHubsFrameOrder", "FavHubsFrameWidths", + "SearchFrameOrder", "SearchFrameWidths", "FavHubsFrameOrder", "FavHubsFrameWidths", "HublistServers", "QueueFrameOrder", "QueueFrameWidths", "PublicHubsFrameOrder", "PublicHubsFrameWidths", "UsersFrameOrder", "UsersFrameWidths", "HttpProxy", "LogDirectory", "LogFormatPostDownload", "LogFormatPostUpload", "LogFormatMainChat", "LogFormatPrivateChat", "FinishedOrder", "FinishedWidths", @@ -335,11 +335,14 @@ xml.stepOut(); } + if(SETTING(PRIVATE_ID).length() != 39 || CID(SETTING(PRIVATE_ID)).isZero()) { + set(PRIVATE_ID, CID::generate().toBase32()); + } + double v = Util::toDouble(SETTING(CONFIG_VERSION)); // if(v < 0.x) { // Fix old settings here } - if(v <= 0.674 || SETTING(PRIVATE_ID).length() != 39 || CID(SETTING(PRIVATE_ID)).isZero()) { - set(PRIVATE_ID, CID::generate().toBase32()); + if(v <= 0.674) { // Formats changed, might as well remove these... set(LOG_FORMAT_POST_DOWNLOAD, Util::emptyString); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-29 22:04:05 UTC (rev 954) @@ -48,7 +48,7 @@ enum StrSetting { STR_FIRST, NICK = STR_FIRST, UPLOAD_SPEED, DESCRIPTION, DOWNLOAD_DIRECTORY, EMAIL, EXTERNAL_IP, TEXT_FONT, MAINFRAME_ORDER, MAINFRAME_WIDTHS, HUBFRAME_ORDER, HUBFRAME_WIDTHS, - LANGUAGE_FILE, SEARCHFRAME_ORDER, SEARCHFRAME_WIDTHS, FAVHUBSFRAME_ORDER, FAVHUBSFRAME_WIDTHS, + SEARCHFRAME_ORDER, SEARCHFRAME_WIDTHS, FAVHUBSFRAME_ORDER, FAVHUBSFRAME_WIDTHS, HUBLIST_SERVERS, QUEUEFRAME_ORDER, QUEUEFRAME_WIDTHS, PUBLICHUBSFRAME_ORDER, PUBLICHUBSFRAME_WIDTHS, USERSFRAME_ORDER, USERSFRAME_WIDTHS, HTTP_PROXY, LOG_DIRECTORY, LOG_FORMAT_POST_DOWNLOAD, LOG_FORMAT_POST_UPLOAD, LOG_FORMAT_MAIN_CHAT, LOG_FORMAT_PRIVATE_CHAT, FINISHED_ORDER, FINISHED_WIDTHS, Modified: dcplusplus/trunk/dcpp/Util.cpp =================================================================== --- dcplusplus/trunk/dcpp/Util.cpp 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/Util.cpp 2007-12-29 22:04:05 UTC (rev 954) @@ -63,6 +63,7 @@ string Util::configPath; string Util::systemPath; string Util::dataPath; +string Util::localePath; static void sgenrand(unsigned long seed); @@ -88,12 +89,14 @@ systemPath = Util::getFilePath(Text::fromT(buf)); configPath = systemPath; dataPath = systemPath; + localePath = dataPath + "locale\\"; #else systemPath = "/etc/"; char* home = getenv("HOME"); configPath = home ? Text::toUtf8(home) + "/.dc++/" : "/tmp/"; dataPath = configPath; // dataPath in linux is usually prefix + /share/app_name, so we can't represent it here + localePath = dataPath; // TODO no good default here either, fix #endif // Load boot settings Modified: dcplusplus/trunk/dcpp/Util.h =================================================================== --- dcplusplus/trunk/dcpp/Util.h 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/dcpp/Util.h 2007-12-29 22:04:05 UTC (rev 954) @@ -127,6 +127,7 @@ static const string& getConfigPath() { return configPath; } static const string& getDataPath() { return dataPath; } static const string& getSystemPath() { return systemPath; } + static const string& getLocalePath() { return localePath; } /** Path of file lists */ static string getListPath() { return getConfigPath() + "FileLists" PATH_SEPARATOR_STR; } @@ -379,6 +380,8 @@ static string systemPath; /** Various resources (help files etc) */ static string dataPath; + /** Translations */ + static string localePath; static bool away; static bool manualAway; Modified: dcplusplus/trunk/win32/AppearancePage.cpp =================================================================== --- dcplusplus/trunk/win32/AppearancePage.cpp 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/win32/AppearancePage.cpp 2007-12-29 22:04:05 UTC (rev 954) @@ -23,6 +23,8 @@ #include "AppearancePage.h" #include <dcpp/SettingsManager.h> +#include <dcpp/File.h> + #include "WinUtil.h" PropPage::TextItem AppearancePage::texts[] = { @@ -30,7 +32,6 @@ { IDC_SETTINGS_DEFAULT_AWAY_MSG, ResourceManager::SETTINGS_DEFAULT_AWAY_MSG }, { IDC_SETTINGS_TIME_STAMPS_FORMAT, ResourceManager::SETTINGS_TIME_STAMPS_FORMAT }, { IDC_SETTINGS_LANGUAGE_FILE, ResourceManager::SETTINGS_LANGUAGE_FILE }, - { IDC_BROWSE, ResourceManager::BROWSE_ACCEL }, { IDC_SETTINGS_REQUIRES_RESTART, ResourceManager::SETTINGS_REQUIRES_RESTART }, { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; @@ -38,7 +39,6 @@ PropPage::Item AppearancePage::items[] = { { IDC_DEFAULT_AWAY_MESSAGE, SettingsManager::DEFAULT_AWAY_MESSAGE, PropPage::T_STR }, { IDC_TIME_STAMPS_FORMAT, SettingsManager::TIME_STAMPS_FORMAT, PropPage::T_STR }, - { IDC_LANGUAGE, SettingsManager::LANGUAGE_FILE, PropPage::T_STR }, { 0, 0, PropPage::T_END } }; @@ -57,13 +57,44 @@ { 0, ResourceManager::SETTINGS_AUTO_AWAY } }; -AppearancePage::AppearancePage(SmartWin::Widget* parent) : PropPage(parent) { +AppearancePage::AppearancePage(SmartWin::Widget* parent) : PropPage(parent), languages(0) { createDialog(IDD_APPEARANCEPAGE); PropPage::translate(handle(), texts); PropPage::read(handle(), items, listItems, ::GetDlgItem(handle(), IDC_APPEARANCE_BOOLEANS)); - attachButton(IDC_BROWSE)->onClicked(std::tr1::bind(&AppearancePage::handleBrowse, this)); + languages = attachComboBox(IDC_LANGUAGE); + + StringList dirs = File::findFiles(Util::getLocalePath(), "*"); + + TStringList langs; + + langs.push_back(_T("en")); + + for(StringList::const_iterator i = dirs.begin(); i != dirs.end(); ++i) { + string dir = *i + "LC_MESSAGES" PATH_SEPARATOR_STR; + StringList files = File::findFiles(dir, "*.mo"); + if(find(files.begin(), files.end(), dir + "dcpp.mo") == files.end() && find(files.begin(), files.end(), dir + "dcpp-win32.mo") == files.end()) { + continue; + } + // TODO Convert to real language name? + langs.push_back(Text::toT(Util::getLastDir(*i))); + } + + std::sort(langs.begin(), langs.end(), noCaseStringLess()); + + languages->addValue(T_("Default")); + + int selected = 0, j = 1; + const tstring cur = Text::toT(SETTING(LANGUAGE)); + for(TStringList::const_iterator i = langs.begin(); i != langs.end(); ++i, ++j) { + languages->addValue(*i); + if(selected != 0 && *i == cur || (*i == _T("en") && cur == _T("C"))) { + selected = j; + } + } + + languages->setSelectedIndex(selected); } AppearancePage::~AppearancePage() { @@ -72,16 +103,14 @@ void AppearancePage::write() { PropPage::write(handle(), items, listItems, ::GetDlgItem(handle(), IDC_APPEARANCE_BOOLEANS)); -} -void AppearancePage::handleBrowse() { - TCHAR buf[MAX_PATH]; - static const TCHAR types[] = _T("Language Files\0*.xml\0All Files\0*.*\0"); - - ::GetDlgItemText(handle(), IDC_LANGUAGE, buf, MAX_PATH); - tstring x = buf; - - if(WinUtil::browseFile(x, handle(), false, Text::toT(Util::getDataPath()), types) == IDOK) { - ::SetDlgItemText(handle(), IDC_LANGUAGE, x.c_str()); + tstring lang = languages->getText(); + + if(lang == T_("Default")) { + SettingsManager::getInstance()->set(SettingsManager::LANGUAGE, ""); + } else if(lang == _T("en")) { + SettingsManager::getInstance()->set(SettingsManager::LANGUAGE, "C"); + } else { + SettingsManager::getInstance()->set(SettingsManager::LANGUAGE, Text::fromT(lang)); } } Modified: dcplusplus/trunk/win32/AppearancePage.h =================================================================== --- dcplusplus/trunk/win32/AppearancePage.h 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/win32/AppearancePage.h 2007-12-29 22:04:05 UTC (rev 954) @@ -35,7 +35,7 @@ static TextItem texts[]; static ListItem listItems[]; - void handleBrowse(); + WidgetComboBox* languages; }; #endif // !defined(DCPLUSPLUS_WIN32_APPEARANCE_PAGE_H) Modified: dcplusplus/trunk/win32/DCPlusPlus.rc =================================================================== --- dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/win32/DCPlusPlus.rc 2007-12-29 22:04:05 UTC (rev 954) @@ -188,9 +188,8 @@ EDITTEXT IDC_DEFAULT_AWAY_MESSAGE,16,152,145,14,ES_MULTILINE | ES_AUTOHSCROLL | WS_VSCROLL GROUPBOX "Set timestamps",IDC_SETTINGS_TIME_STAMPS_FORMAT,174,141,96,32 EDITTEXT IDC_TIME_STAMPS_FORMAT,180,152,80,15,ES_AUTOHSCROLL - GROUPBOX "Language file",IDC_SETTINGS_LANGUAGE_FILE,7,174,261,32 - EDITTEXT IDC_LANGUAGE,16,185,188,14,ES_AUTOHSCROLL - PUSHBUTTON "&Browse...",IDC_BROWSE,210,185,50,14 + GROUPBOX "Language",IDC_SETTINGS_LANGUAGE_FILE,7,174,261,32 + COMBOBOX IDC_LANGUAGE,16,185,238,14,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP LTEXT "Note; most of these options require that you restart DC++",IDC_SETTINGS_REQUIRES_RESTART,7,210,253,8 END Modified: dcplusplus/trunk/win32/stdafx.h =================================================================== --- dcplusplus/trunk/win32/stdafx.h 2007-12-29 14:47:58 UTC (rev 953) +++ dcplusplus/trunk/win32/stdafx.h 2007-12-29 22:04:05 UTC (rev 954) @@ -44,8 +44,9 @@ using std::tr1::placeholders::_1; using std::tr1::placeholders::_2; -#define LOCALEDIR (dcpp::Util::getDataPath() + "/locale/").c_str() +#define LOCALEDIR dcpp::Util::getLocalePath().c_str() #define PACKAGE "dcpp-win32" #define _(String) gettext(String) +#define T_(String) Text::toT(gettext(String)) #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-29 14:48:03
|
Revision: 953 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=953&view=rev Author: arnetheduck Date: 2007-12-29 06:47:58 -0800 (Sat, 29 Dec 2007) Log Message: ----------- libintl support Modified Paths: -------------- dcplusplus/trunk/SConstruct dcplusplus/trunk/build_util.py dcplusplus/trunk/dcpp/DCPlusPlus.cpp dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/SConscript dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/stdinc.h dcplusplus/trunk/win32/SConscript dcplusplus/trunk/win32/main.cpp dcplusplus/trunk/win32/stdafx.h Added Paths: ----------- dcplusplus/trunk/dcpp/po/ dcplusplus/trunk/dcpp/po/dcpp.pot dcplusplus/trunk/intl/ dcplusplus/trunk/intl/COPYING.LIB-2.0 dcplusplus/trunk/intl/COPYING.LIB-2.1 dcplusplus/trunk/intl/SConscript dcplusplus/trunk/intl/bindtextdom.c dcplusplus/trunk/intl/config.h dcplusplus/trunk/intl/dcgettext.c dcplusplus/trunk/intl/dcigettext.c dcplusplus/trunk/intl/dcngettext.c dcplusplus/trunk/intl/dgettext.c dcplusplus/trunk/intl/dngettext.c dcplusplus/trunk/intl/eval-plural.h dcplusplus/trunk/intl/explodename.c dcplusplus/trunk/intl/finddomain.c dcplusplus/trunk/intl/gettext.c dcplusplus/trunk/intl/gettextP.h dcplusplus/trunk/intl/gmo.h dcplusplus/trunk/intl/hash-string.c dcplusplus/trunk/intl/hash-string.h dcplusplus/trunk/intl/intl-compat.c dcplusplus/trunk/intl/l10nflist.c dcplusplus/trunk/intl/langprefs.c dcplusplus/trunk/intl/libgnuintl.h dcplusplus/trunk/intl/libgnuintl.h.in dcplusplus/trunk/intl/libintl.h dcplusplus/trunk/intl/loadinfo.h dcplusplus/trunk/intl/loadmsgcat.c dcplusplus/trunk/intl/localcharset.c dcplusplus/trunk/intl/localcharset.h dcplusplus/trunk/intl/locale.alias dcplusplus/trunk/intl/localealias.c dcplusplus/trunk/intl/localename.c dcplusplus/trunk/intl/lock.c dcplusplus/trunk/intl/lock.h dcplusplus/trunk/intl/log.c dcplusplus/trunk/intl/ngettext.c dcplusplus/trunk/intl/plural-exp.c dcplusplus/trunk/intl/plural-exp.h dcplusplus/trunk/intl/plural.c dcplusplus/trunk/intl/plural.y dcplusplus/trunk/intl/printf-args.c dcplusplus/trunk/intl/printf-args.h dcplusplus/trunk/intl/printf-parse.c dcplusplus/trunk/intl/printf-parse.h dcplusplus/trunk/intl/printf.c dcplusplus/trunk/intl/relocatable.c dcplusplus/trunk/intl/relocatable.h dcplusplus/trunk/intl/textdomain.c dcplusplus/trunk/intl/vasnprintf.c dcplusplus/trunk/intl/vasnprintf.h dcplusplus/trunk/intl/vasnwprintf.h dcplusplus/trunk/intl/version.c dcplusplus/trunk/intl/wprintf-parse.h dcplusplus/trunk/intl/xsize.h dcplusplus/trunk/win32/po/ Modified: dcplusplus/trunk/SConstruct =================================================================== --- dcplusplus/trunk/SConstruct 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/SConstruct 2007-12-29 14:47:58 UTC (rev 953) @@ -91,7 +91,7 @@ env.SConsignFile() env.Tool("gch", toolpath=".") -env.Append(CPPPATH = ["#/boost/boost/tr1/tr1/", "#/boost/", "#/htmlhelp/include/"]) +env.Append(CPPPATH = ["#/boost/boost/tr1/tr1/", "#/boost/", "#/htmlhelp/include/", "#/intl/"]) env.Append(LIBPATH = ["#/htmlhelp/lib/"]) if not env['nativestl']: @@ -144,6 +144,25 @@ ) env.Append(SCANNERS=[SWIGScanner]) +# +# internationalization (ardour.org provided the initial idea) +# + +po_args = ['msgmerge', '-q', '--update', '$TARGET', '$SOURCE'] +po_bld = Builder (action = Action([po_args], 'Updating translation $TARGET from $SOURCES')) +env.Append(BUILDERS = {'PoBuild' : po_bld}) + +mo_args = ['msgfmt', '-c', '-o', '$TARGET', '$SOURCE'] +mo_bld = Builder (action = Action([mo_args], 'Compiling message catalog $TARGET from $SOURCES')) +env.Append(BUILDERS = {'MoBuild' : mo_bld}) + +pot_args = ['xgettext','--from-code=UTF-8', '--foreign-user', '--package-name=$PACKAGE', + '--copyright-holder=Jacek Sieka', '--msgid-bugs-address=dcp...@li...', + '--no-wrap', '--keyword=_', '--output=$TARGET', '$SOURCES'] + +pot_bld = Builder (action = Action([pot_args], 'Extracting messages to $TARGET from $SOURCES')) +env.Append(BUILDERS = {'PotBuild' : pot_bld}) + from makedefs import convert env.Command('dcpp/StringDefs.cpp', 'dcpp/StringDefs.h', lambda target, source, env: convert()) env.Depends('dcpp/StringDefs.cpp', 'dcpp/StringDefs.h') @@ -151,6 +170,7 @@ dev.zlib = dev.build('zlib/') dev.bzip2 = dev.build('bzip2/') +dev.intl = dev.build('intl/') dev.boost = dev.build('boost/') dev.client = dev.build('dcpp/') env.Depends(dev.client, 'dcpp/StringDefs.cpp') Modified: dcplusplus/trunk/build_util.py =================================================================== --- dcplusplus/trunk/build_util.py 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/build_util.py 2007-12-29 14:47:58 UTC (rev 953) @@ -1,5 +1,6 @@ import glob import sys +import os class Dev: def __init__(self, mode, tools, env): @@ -40,6 +41,10 @@ self.env['PROGSUFFIX'] = '.exe' self.env['LIBPREFIX'] = 'lib' self.env['LIBSUFFIX'] = '.a' + self.env['SHLIBSUFFIX'] = '.dll' + + def is_win32(self): + return sys.platform == 'win32' or 'mingw' in self.env['TOOLS'] def get_build_root(self): return '#/build/' + self.mode + '-' + self.tools + '/' @@ -69,6 +74,25 @@ full_path = local_env.Dir('.').path + '/' + source_path return local_env.SConscript(source_path + 'SConscript', exports={'dev' : self, 'source_path' : full_path }) + def i18n (self, source_path, buildenv, sources, name): + p_oze = glob.glob('po/*.po') + languages = [ os.path.basename(po).replace ('.po', '') for po in p_oze ] + potfile = 'po/' + name + '.pot' + buildenv['PACKAGE'] = name + ret = buildenv.PotBuild(potfile, sources) + + for po_file in p_oze: + buildenv.Precious(buildenv.PoBuild(po_file, [potfile])) + lang = os.path.basename(po)[:-3] + mo_file = self.get_target(source_path, "locale/" + lang + "/LC_MESSAGES/" + name + ".mo", True) + buildenv.MoBuild (mo_file, po_file) + +# for lang in languages: +# modir = (os.path.join (install_prefix, 'share/locale/' + lang + '/LC_MESSAGES/')) +# moname = domain + '.mo' +# installenv.Alias('install', installenv.InstallAs (os.path.join (modir, moname), lang + '.mo')) + return ret + def CheckPKGConfig(context, version): context.Message( 'Checking for pkg-config... ' ) ret = context.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0] Modified: dcplusplus/trunk/dcpp/DCPlusPlus.cpp =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/DCPlusPlus.cpp 2007-12-29 14:47:58 UTC (rev 953) @@ -43,6 +43,8 @@ } #endif +extern "C" int _nl_msg_cat_cntr; + namespace dcpp { void startup(void (*f)(void*, const string&), void* p) { @@ -57,6 +59,8 @@ #endif Util::initialize(); + + bindtextdomain(PACKAGE, LOCALEDIR); ResourceManager::newInstance(); SettingsManager::newInstance(); @@ -77,6 +81,15 @@ ADLSearchManager::newInstance(); SettingsManager::getInstance()->load(); + + if(!SETTING(LANGUAGE).empty()) { + string language = "LANGUAGE=" + SETTING(LANGUAGE); + putenv(language.c_str()); + // Apparently this is supposted to make gettext reload the message catalog... + _nl_msg_cat_cntr++; + } + + printf(_("test")); if(!SETTING(LANGUAGE_FILE).empty()) { ResourceManager::getInstance()->loadLanguage(SETTING(LANGUAGE_FILE)); Modified: dcplusplus/trunk/dcpp/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-29 14:47:58 UTC (rev 953) @@ -20,8 +20,10 @@ #define DCPP_DCPLUSPLUS_H #ifdef _WIN32 +#ifndef snprintf #define snprintf _snprintf #endif +#endif #ifdef _DEBUG @@ -166,6 +168,12 @@ extern void startup(void (*f)(void*, const string&), void* p); extern void shutdown(); +#ifdef BUILDING_DCPP +#define PACKAGE "dcpp" +#define LOCALEDIR (Util::getDataPath() + "/locale/").c_str() +#define _(String) dgettext(PACKAGE, String) +#endif + } // namespace dcpp #endif // !defined(DC_PLUS_PLUS_H) Modified: dcplusplus/trunk/dcpp/SConscript =================================================================== --- dcplusplus/trunk/dcpp/SConscript 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/SConscript 2007-12-29 14:47:58 UTC (rev 953) @@ -37,6 +37,10 @@ if 'gcc' in env['TOOLS']: env['Gch'] = env.Gch('stdinc.h')[0] +env.Append(CPPDEFINES=["BUILDING_DCPP=1"]) + +dev.i18n(source_path, env, sources, 'dcpp') + ret = env.StaticLibrary(target, sources) Return('ret') Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-29 14:47:58 UTC (rev 953) @@ -47,6 +47,7 @@ "LogFilePrivateChat", "LogFileStatus", "LogFileUpload", "LogFileDownload", "LogFileSystem", "LogFormatSystem", "LogFormatStatus", "DirectoryListingFrameOrder", "DirectoryListingFrameWidths", "TLSPrivateKeyFile", "TLSCertificateFile", "TLSTrustedCertificatesPath", "BeepFile", + "Language", "SENTRY", // Ints "IncomingConnections", "InPort", "Slots", "AutoFollow", "ClearSearch", Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-29 14:47:58 UTC (rev 953) @@ -58,6 +58,7 @@ LOG_FILE_PRIVATE_CHAT, LOG_FILE_STATUS, LOG_FILE_UPLOAD, LOG_FILE_DOWNLOAD, LOG_FILE_SYSTEM, LOG_FORMAT_SYSTEM, LOG_FORMAT_STATUS, DIRECTORLISTINGFRAME_ORDER, DIRECTORLISTINGFRAME_WIDTHS, TLS_PRIVATE_KEY_FILE, TLS_CERTIFICATE_FILE, TLS_TRUSTED_CERTIFICATES_PATH, BEEPFILE, + LANGUAGE, STR_LAST }; enum IntSetting { INT_FIRST = STR_LAST + 1, Added: dcplusplus/trunk/dcpp/po/dcpp.pot =================================================================== --- dcplusplus/trunk/dcpp/po/dcpp.pot (rev 0) +++ dcplusplus/trunk/dcpp/po/dcpp.pot 2007-12-29 14:47:58 UTC (rev 953) @@ -0,0 +1,22 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Jacek Sieka +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: dcpp\n" +"Report-Msgid-Bugs-To: dcp...@li...\n" +"POT-Creation-Date: 2007-12-29 13:55+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL...@li...>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: dcpp/DCPlusPlus.cpp:92 +#, c-format +msgid "test" +msgstr "" Modified: dcplusplus/trunk/dcpp/stdinc.h =================================================================== --- dcplusplus/trunk/dcpp/stdinc.h 2007-12-28 13:17:28 UTC (rev 952) +++ dcplusplus/trunk/dcpp/stdinc.h 2007-12-29 14:47:58 UTC (rev 953) @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(STDINC_H) -#define STDINC_H +#ifndef DCPLUSPLUS_DCPP_STDINC_H +#define DCPLUSPLUS_DCPP_STDINC_H // This enables stlport's debug mode (and slows it down to a crawl...) //#define _STLP_DEBUG 1 @@ -117,6 +117,7 @@ #include <memory> #include <numeric> #include <limits> +#include <libintl.h> #ifdef _STLPORT_VERSION Added: dcplusplus/trunk/intl/COPYING.LIB-2.0 =================================================================== --- dcplusplus/trunk/intl/COPYING.LIB-2.0 (rev 0) +++ dcplusplus/trunk/intl/COPYING.LIB-2.0 2007-12-29 14:47:58 UTC (rev 953) @@ -0,0 +1,482 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! Added: dcplusplus/trunk/intl/COPYING.LIB-2.1 =================================================================== --- dcplusplus/trunk/intl/COPYING.LIB-2.1 (rev 0) +++ dcplusplus/trunk/intl/COPYING.LIB-2.1 2007-12-29 14:47:58 UTC (rev 953) @@ -0,0 +1,516 @@ + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations +below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +^L + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it +becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +^L + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control +compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +^L + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +^L + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +^L + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +^L + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply, and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License +may add an explicit geographical distribution limitation excluding those +countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Suc... [truncated message content] |
From: <arn...@us...> - 2007-12-28 15:35:36
|
Revision: 116 http://adchpp.svn.sourceforge.net/adchpp/?rev=116&view=rev Author: arnetheduck Date: 2007-12-28 07:35:31 -0800 (Fri, 28 Dec 2007) Log Message: ----------- Don't disable msg by default Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:53:35 UTC (rev 115) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 15:35:31 UTC (rev 116) @@ -15,7 +15,7 @@ -- Users with level lower than the specified will not be allowed to run command at all local command_min_levels = { - [adchpp.AdcCommand_CMD_MSG] = 2 +-- [adchpp.AdcCommand_CMD_MSG] = 2 } -- Regexes for the various fields. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-28 14:53:39
|
Revision: 115 http://adchpp.svn.sourceforge.net/adchpp/?rev=115&view=rev Author: arnetheduck Date: 2007-12-28 06:53:35 -0800 (Fri, 28 Dec 2007) Log Message: ----------- Access example fix Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:51:53 UTC (rev 114) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:53:35 UTC (rev 115) @@ -15,7 +15,7 @@ -- Users with level lower than the specified will not be allowed to run command at all local command_min_levels = { --- [adchpp.AdcCommand.CMD_MSG] = 2 + [adchpp.AdcCommand_CMD_MSG] = 2 } -- Regexes for the various fields. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-28 14:51:56
|
Revision: 114 http://adchpp.svn.sourceforge.net/adchpp/?rev=114&view=rev Author: arnetheduck Date: 2007-12-28 06:51:53 -0800 (Fri, 28 Dec 2007) Log Message: ----------- More script fixes Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:27:54 UTC (rev 113) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:51:53 UTC (rev 114) @@ -96,6 +96,8 @@ local cm = adchpp.getCM() +function hasbit(x, p) return x % (p + p) >= p end + local function load_users() users.cids = { } users.nicks = { } @@ -424,7 +426,7 @@ local function onMSG(c, cmd) msg = cmd:getParam(0) local command, parameters = msg:match("^%+(%a+) ?(.*)") - + if not command then return 0 end @@ -514,8 +516,8 @@ str = str .. "\nDisconnect reasons: \n" for k, v in pairs(adchpp) do - if k:sub(1, 7) == "REASON_" and k ~= "REASON_LAST" then - str = str .. adchpp.size_t_getitem(adchpp.Util_reasons, adchpp[k]) .. "\t" .. k .. "\n" + if k:sub(1, 12) == "Util_REASON_" and k ~= "Util_REASON_LAST" then + str = str .. adchpp.size_t_getitem(adchpp.Util_reasons, adchpp[k]) .. "\t" .. k:sub(6) .. "\n" end end @@ -558,7 +560,6 @@ end local function onReceive(c, cmd, override) - cmdstr = cmd:getCommandString() if stats[cmdstr] then stats[cmdstr] = stats[cmdstr] + 1 @@ -566,7 +567,7 @@ stats[cmdstr] = 1 end - if override > 0 then + if hasbit(override, adchpp.ClientManager_DONT_DISPATCH) then return 0 end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-28 14:27:56
|
Revision: 113 http://adchpp.svn.sourceforge.net/adchpp/?rev=113&view=rev Author: arnetheduck Date: 2007-12-28 06:27:54 -0800 (Fri, 28 Dec 2007) Log Message: ----------- Script fix Modified Paths: -------------- adchpp/trunk/plugins/Script/examples/access.lua Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-26 14:55:44 UTC (rev 112) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-28 14:27:54 UTC (rev 113) @@ -438,28 +438,28 @@ if command == "test" then reply(c, "Test ok") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND elseif command == "error" then xxxxyyyy() - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND elseif command == "help" then reply(c, "+test, +help, +regme password, +regnick nick password level") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND elseif command == "regme" then if not parameters:match("%S+") then reply(c, "You need to supply a password without whitespace") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end register_user(c:getCID():toBase32(), c:getField("NI"), parameters, 1) reply(c, "You're now registered") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND elseif command == "regnick" then local nick, password, level = parameters:match("^(%S+) (%S+) (%d+)") if not nick or not password or not level then reply(c, "You must supply nick, password and level!") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end level = tonumber(level) @@ -475,17 +475,17 @@ if not my_user then reply(c, "Only registered users may register others") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end if level >= my_user.level then reply(c, "You may only register to a lower level than your own") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end if level < 1 then reply(c, "Level too low") - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end register_user(cid, nick, password, level) @@ -496,7 +496,7 @@ reply(other, "You've been registered with password " .. password) end - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND elseif command == "stats" then local now = os.time() local scripttime = os.difftime(now, start_time) @@ -537,7 +537,7 @@ str = str .. recvCalls .. "\tReceive calls (" .. adchpp.Util_formatBytes(recvBytes/recvCalls) .. "/call)\n" reply(c, str) - return adchpp.AdcCommand_DONT_SEND + return adchpp.ClientManager_DONT_SEND end return 0 @@ -558,6 +558,7 @@ end local function onReceive(c, cmd, override) + cmdstr = cmd:getCommandString() if stats[cmdstr] then stats[cmdstr] = stats[cmdstr] + 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-28 13:17:31
|
Revision: 952 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=952&view=rev Author: arnetheduck Date: 2007-12-28 05:17:28 -0800 (Fri, 28 Dec 2007) Log Message: ----------- sfv fix Modified Paths: -------------- dcplusplus/trunk/dcpp/DownloadManager.cpp Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-23 22:35:08 UTC (rev 951) +++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2007-12-28 13:17:28 UTC (rev 952) @@ -372,11 +372,13 @@ dcdebug("Download finished: %s, size " I64_FMT ", downloaded " I64_FMT "\n", d->getPath().c_str(), d->getSize(), d->getPos()); +#if PORT_ME + // This should be done when the file is done, not the chunk... if(BOOLSETTING(SFV_CHECK) && d->getType() == Transfer::TYPE_FILE) { if(!checkSfv(aSource, d)) return; } - +#endif if(BOOLSETTING(LOG_DOWNLOADS) && (BOOLSETTING(LOG_FILELIST_TRANSFERS) || d->getType() == Transfer::TYPE_FILE)) { logDownload(aSource, d); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-26 14:55:46
|
Revision: 112 http://adchpp.svn.sourceforge.net/adchpp/?rev=112&view=rev Author: arnetheduck Date: 2007-12-26 06:55:44 -0800 (Wed, 26 Dec 2007) Log Message: ----------- Comment fixes Modified Paths: -------------- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp adchpp/trunk/plugins/Bloom/src/HashBloom.h Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-23 20:30:27 UTC (rev 111) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-26 14:55:44 UTC (rev 112) @@ -29,11 +29,9 @@ } for(size_t i = 0; i < k; ++i) { if(!bloom[pos(tth, i)]) { - printf("no match\n"); return false; } } - printf("match\n"); return true; } Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-23 20:30:27 UTC (rev 111) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-26 14:55:44 UTC (rev 112) @@ -15,7 +15,7 @@ */ class HashBloom { public: - /** Return the largest k such that get_m returns a value smaller than 2^(TTHValue::SIZE/k) */ + /** Return a suitable value for k based on n */ static size_t get_k(size_t n); /** Optimal number of bits to allocate for n elements when using k hashes */ static uint64_t get_m(size_t n, size_t k); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-23 22:35:15
|
Revision: 951 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=951&view=rev Author: arnetheduck Date: 2007-12-23 14:35:08 -0800 (Sun, 23 Dec 2007) Log Message: ----------- crash fix Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/DirectoryListingFrame.cpp Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-23 20:29:57 UTC (rev 950) +++ dcplusplus/trunk/changelog.txt 2007-12-23 22:35:08 UTC (rev 951) @@ -5,6 +5,7 @@ * Fixed a crash when right-clicking in own file list * [ADC] Searches filtered by token if available so that each search window only gets its own results * [ADC] Implemented test version of bloom filters which will dramatically reduce hub bandwidth usage for TTH searches +* Fixed a crash with partial list browsing -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-23 20:29:57 UTC (rev 950) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-23 22:35:08 UTC (rev 951) @@ -274,7 +274,6 @@ void DirectoryListingFrame::refreshTree(const tstring& root) { HoldRedraw hold(dirs); - HTREEITEM ht = findItem(treeRoot, root); if(ht == NULL) { ht = treeRoot; @@ -286,12 +285,12 @@ while((next = dirs->getChild(ht)) != NULL) { dirs->erase(next); } - updateTree(d, ht); dirs->select(NULL); selectItem(root); + dcdebug("selected"); dirs->expand(treeRoot); } @@ -674,8 +673,12 @@ } void DirectoryListingFrame::handleSelectionChanged() { + ItemInfo* ii = dirs->getSelectedData(); + if(!ii) { + return; + } - DirectoryListing::Directory* d = dirs->getSelectedData()->dir; + DirectoryListing::Directory* d = ii->dir; if(d == 0) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-23 20:30:51
|
Revision: 111 http://adchpp.svn.sourceforge.net/adchpp/?rev=111&view=rev Author: arnetheduck Date: 2007-12-23 12:30:27 -0800 (Sun, 23 Dec 2007) Log Message: ----------- Bloom filter fixes Modified Paths: -------------- adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/adchpp/ClientManager.h adchpp/trunk/plugins/Bloom/src/BloomManager.cpp adchpp/trunk/plugins/Bloom/src/BloomManager.h adchpp/trunk/plugins/Bloom/src/HashBloom.cpp adchpp/trunk/plugins/Bloom/src/HashBloom.h adchpp/trunk/unix/po/adchppd.pot Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/adchpp/ClientManager.cpp 2007-12-23 20:30:27 UTC (rev 111) @@ -50,19 +50,23 @@ void ClientManager::send(const AdcCommand& cmd, bool lowPrio /* = false */) throw() { const string& txt = cmd.toString(); - + + bool all = false; switch (cmd.getType()) { - case AdcCommand::TYPE_FEATURE: - case AdcCommand::TYPE_BROADCAST: { - bool all = (cmd.getType() == AdcCommand::TYPE_BROADCAST); + case AdcCommand::TYPE_BROADCAST: all = true; // Fallthrough + case AdcCommand::TYPE_FEATURE: { FastMutex::Lock l(ManagedSocket::getWriteMutex()); for (ClientIter i = clients.begin(); i != clients.end(); ++i) { - if (all || !i->second->isFiltered(cmd.getFeatures())) - i->second->fastSend(txt, lowPrio); + if (all || !i->second->isFiltered(cmd.getFeatures())) { + int override = 0; + signalSend_(*i->second, cmd, override); + if(!(override & DONT_SEND)) { + i->second->fastSend(txt, lowPrio); + } + } } - } SocketManager::getInstance()->addAllWriters(); - break; + } break; case AdcCommand::TYPE_DIRECT: // Fallthrough case AdcCommand::TYPE_ECHO: { ClientIter i = clients.find(cmd.getTo()); @@ -75,9 +79,8 @@ } } } + } break; } - break; - } } void ClientManager::sendToAll(const string& cmd) throw() { Modified: adchpp/trunk/adchpp/ClientManager.h =================================================================== --- adchpp/trunk/adchpp/ClientManager.h 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/adchpp/ClientManager.h 2007-12-23 20:30:27 UTC (rev 111) @@ -152,7 +152,7 @@ typedef SignalTraits<void (Client&)> SignalConnected; typedef SignalTraits<void (Client&, AdcCommand&, int&)> SignalReceive; typedef SignalTraits<void (Client&, const std::string&)> SignalBadLine; - typedef SignalTraits<void (Client&, AdcCommand&, int&)> SignalSend; + typedef SignalTraits<void (Client&, const AdcCommand&, int&)> SignalSend; typedef SignalTraits<void (Client&, int)> SignalState; typedef SignalTraits<void (Client&)> SignalDisconnected; Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-23 20:30:27 UTC (rev 111) @@ -25,16 +25,18 @@ #include <adchpp/Util.h> using namespace std; +using namespace std::tr1; using namespace std::tr1::placeholders; using namespace adchpp; BloomManager* BloomManager::instance = 0; const string BloomManager::className = "BloomManager"; -BloomManager::BloomManager() { +BloomManager::BloomManager() : searches(0), tthSearches(0), stopped(0) { LOG(className, "Starting"); ClientManager* cm = ClientManager::getInstance(); receiveConn = manage(&cm->signalReceive(), std::tr1::bind(&BloomManager::onReceive, this, _1, _2, _3)); + sendConn = manage(&cm->signalSend(), std::tr1::bind(&BloomManager::onSend, this, _1, _2, _3)); disconnectConn = manage(&cm->signalDisconnected(), std::tr1::bind(&BloomManager::onDisconnected, this, _1)); } @@ -56,11 +58,10 @@ size_t k = HashBloom::get_k(n); size_t m = HashBloom::get_m(n, k); + blooms.erase(c.getSID()); + + pending[c.getSID()] = make_tuple(ByteVector(), m, k); - HashBloom& bloom = blooms[c.getCID()]; - - bloom.reset(k); - AdcCommand get(AdcCommand::CMD_GET); get.addParam("blom"); get.addParam("/"); @@ -77,29 +78,83 @@ return; } + PendingMap::const_iterator i = pending.find(c.getSID()); + if(i == pending.end()) { + c.send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_BAD_STATE, "Unexpected bloom filter update")); + c.disconnect(Util::REASON_BAD_STATE); + override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; + return; + } + int64_t bytes = Util::toInt(cmd.getParam(3)); - c.setDataMode(std::tr1::bind(&BloomManager::onData, this, _1, _2, _3), bytes); - override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; - } else if(cmd.getCommand() == AdcCommand::CMD_SCH && cmd.getParam("TR", 0, tmp)) { - BloomMap::const_iterator i = blooms.find(c.getCID()); - if(i != blooms.end() && !i->second.match(TTHValue(tmp))) { - // Stop it - dcdebug("Stopping search\n"); + if(bytes != static_cast<int64_t>(get<1>(i->second) / 8)) { + c.send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_PROTOCOL_GENERIC, "Invalid number of bytes")); + c.disconnect(Util::REASON_PLUGIN); override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; + pending.erase(c.getSID()); + return; } + + c.setDataMode(bind(&BloomManager::onData, this, _1, _2, _3), bytes); + override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; + } else if(cmd.getCommand() == AdcCommand::CMD_MSG && cmd.getParameters().size() >= 1) { + if(cmd.getParam(0).compare(0, 6, "+stats") == 0) { + string stats = "\nBloom filter statistics:"; + stats += "\nTotal outgoing searches: " + Util::toString(searches); + stats += "\nOutgoing TTH searches: " + Util::toString(tthSearches) + " (" + Util::toString(tthSearches * 100. / searches) + "% of total)"; + stats += "\nStopped outgoing searches: " + Util::toString(stopped) + " (" + Util::toString(stopped * 100. / searches) + "% of total, " + Util::toString(stopped * 100. / tthSearches) + "% of TTH searches"; + int64_t bytes = getBytes(); + size_t clients = ClientManager::getInstance()->getClients().size(); + stats += "\nClient support: " + Util::toString(blooms.size()) + "/" + Util::toString(clients) + " (" + Util::toString(blooms.size() * 100. / clients) + "%)"; + stats += "\nApproximate memory usage: " + Util::formatBytes(bytes) + ", " + Util::formatBytes(static_cast<double>(bytes) / clients) + "/client"; + c.send(AdcCommand(AdcCommand::CMD_MSG).addParam(stats)); + override |= ClientManager::DONT_SEND; + } } } -void BloomManager::onData(Client& c, const uint8_t* data, size_t len) { - HashBloom& bloom = blooms[c.getCID()]; - for(size_t i = 0; i < len; ++i) { - for(size_t j = 0; j < 8; ++j) { - bloom.push_back(data[i] & (1 << j)); +void BloomManager::onSend(Client& c, const AdcCommand& cmd, int& override) { + if(cmd.getCommand() == AdcCommand::CMD_SCH) { + searches++; + string tmp; + if(cmd.getParam("TR", 0, tmp)) { + tthSearches++; + BloomMap::const_iterator i = blooms.find(c.getSID()); + if(i != blooms.end() && !i->second.match(TTHValue(tmp))) { + // Stop it + stopped++; + dcdebug("Stopping search\n"); + override |= ClientManager::DONT_SEND; + } } + } +} +int64_t BloomManager::getBytes() const { + int64_t bytes = 0; + for(BloomMap::const_iterator i = blooms.begin(); i != blooms.end(); ++i) { + bytes += i->second.size() / 8; } + return bytes; } +void BloomManager::onData(Client& c, const uint8_t* data, size_t len) { + PendingMap::iterator i = pending.find(c.getSID()); + if(i == pending.end()) { + // Shouldn't happen + return; + } + ByteVector& v = get<0>(i->second); + v.insert(v.end(), data, data + len); + + if(v.size() == get<1>(i->second) / 8) { + HashBloom& bloom = blooms[c.getSID()]; + bloom.reset(v, get<2>(i->second)); + pending.erase(i); + } +} + void BloomManager::onDisconnected(Client& c) { - blooms.erase(c.getCID()); + blooms.erase(c.getSID()); + pending.erase(c.getSID()); } Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.h 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.h 2007-12-23 20:30:27 UTC (rev 111) @@ -19,10 +19,7 @@ #ifndef BLOOM_MANAGER_H #define BLOOM_MANAGER_H -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - +#include <tuple> #include <adchpp/Exception.h> #include <adchpp/Singleton.h> #include <adchpp/ClientManager.h> @@ -55,21 +52,33 @@ virtual int getVersion() { return 0; } - void onReceive(Client& c, AdcCommand& cmd, int&); - void onData(Client& c, const uint8_t* data, size_t len); - void onDisconnected(Client& c); - static const std::string className; private: friend class Singleton<BloomManager>; static BloomManager* instance; - typedef std::tr1::unordered_map<CID, HashBloom> BloomMap; + typedef std::tr1::unordered_map<uint32_t, HashBloom> BloomMap; BloomMap blooms; + // bytes, m, k + typedef std::tr1::tuple<ByteVector, size_t, size_t> PendingItem; + typedef std::tr1::unordered_map<uint32_t, PendingItem> PendingMap; + PendingMap pending; + + int64_t searches; + int64_t tthSearches; + int64_t stopped; + ClientManager::SignalReceive::ManagedConnection receiveConn; ClientManager::SignalDisconnected::ManagedConnection disconnectConn; + ClientManager::SignalSend::ManagedConnection sendConn; + int64_t getBytes() const; + void onReceive(Client& c, AdcCommand& cmd, int&); + void onSend(Client& c, const AdcCommand& cmd, int&); + void onData(Client& c, const uint8_t* data, size_t len); + void onDisconnected(Client& c); + }; #endif //ACCESSMANAGER_H Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-23 20:30:27 UTC (rev 111) @@ -41,9 +41,15 @@ bloom.push_back(v); } -void HashBloom::reset(size_t k_) { - bloom.resize(0); +void HashBloom::reset(ByteVector& v, size_t k_) { k = k_; + + bloom.resize(v.size() * 8); + for(size_t i = 0; i < v.size(); ++i) { + for(size_t j = 0; j < 8; ++j) { + bloom[i*8 + j] = ((v[i] >> j) != 0); + } + } } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-23 20:30:27 UTC (rev 111) @@ -22,8 +22,10 @@ void add(const TTHValue& tth); bool match(const TTHValue& tth) const; - void reset(size_t k); + void reset(ByteVector& v, size_t k); void push_back(bool v); + + size_t size() const { return bloom.size(); } private: size_t pos(const TTHValue& tth, size_t n) const; Modified: adchpp/trunk/unix/po/adchppd.pot =================================================================== --- adchpp/trunk/unix/po/adchppd.pot 2007-12-22 23:08:03 UTC (rev 110) +++ adchpp/trunk/unix/po/adchppd.pot 2007-12-23 20:30:27 UTC (rev 111) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \"adchpp\"--copyright-holder=\"Jacek Sieka\"\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-22 23:02+0100\n" +"POT-Creation-Date: 2007-12-23 00:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-23 20:29:59
|
Revision: 950 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=950&view=rev Author: arnetheduck Date: 2007-12-23 12:29:57 -0800 (Sun, 23 Dec 2007) Log Message: ----------- Make bloom filters slightly more robust Modified Paths: -------------- dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/ShareManager.cpp Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-23 11:04:30 UTC (rev 949) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-23 20:29:57 UTC (rev 950) @@ -489,7 +489,20 @@ ByteVector v; size_t m = Util::toUInt32(c.getParam(3)) * 8; size_t k = Util::toUInt32(tmp); - + + if(k > 8 || k < 1) { + send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported k")); + return; + } + + size_t n = ShareManager::getInstance()->getSharedFiles(); + + // Ideal size for m is n * k / ln(2), but we allow some slack + if(m > (5 * n * k / log(2))) { + send(AdcCommand(AdcCommand::SEV_FATAL, AdcCommand::ERROR_TRANSFER_GENERIC, "Unsupported m")); + return; + } + ShareManager::getInstance()->getBloom(v, k, m); AdcCommand cmd(AdcCommand::CMD_SND, AdcCommand::TYPE_HUB); cmd.addParam(c.getParam(0)); Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-23 11:04:30 UTC (rev 949) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-23 20:29:57 UTC (rev 950) @@ -844,7 +844,6 @@ bloom.copy_to(v); } - void ShareManager::generateXmlList() { Lock l(cs); if(xmlDirty && (lastXmlUpdate + 15 * 60 * 1000 < GET_TICK() || lastXmlUpdate < lastFullUpdate)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-23 11:04:39
|
Revision: 949 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=949&view=rev Author: arnetheduck Date: 2007-12-23 03:04:30 -0800 (Sun, 23 Dec 2007) Log Message: ----------- Fix crash, use token field Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/win32/DirectoryListingFrame.cpp dcplusplus/trunk/win32/SearchFrame.cpp dcplusplus/trunk/win32/SearchFrame.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-22 22:38:16 UTC (rev 948) +++ dcplusplus/trunk/changelog.txt 2007-12-23 11:04:30 UTC (rev 949) @@ -1,7 +1,10 @@ -- 0.705 -- * Several patches for better *nix compatibility of the core (thanks steven sheehy et al) -* Improve segmented download file sharing +* Improve segmented download implementation * Fix search request ip when using multiple ip's (thanks stanislav maslovski) +* Fixed a crash when right-clicking in own file list +* [ADC] Searches filtered by token if available so that each search window only gets its own results +* [ADC] Implemented test version of bloom filters which will dramatically reduce hub bandwidth usage for TTH searches -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/win32/DirectoryListingFrame.cpp =================================================================== --- dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-22 22:38:16 UTC (rev 948) +++ dcplusplus/trunk/win32/DirectoryListingFrame.cpp 2007-12-23 11:04:30 UTC (rev 949) @@ -396,9 +396,9 @@ } if(files->getSelectedCount() == 1) { - if(BOOLSETTING(SHOW_SHELL_MENU) && (dl->getUser() == ClientManager::getInstance()->getMe())) { + ItemInfo* ii = files->getSelectedData(); + if(BOOLSETTING(SHOW_SHELL_MENU) && (dl->getUser() == ClientManager::getInstance()->getMe()) && ii->type == ItemInfo::FILE) { string path; - ItemInfo* ii = files->getSelectedData(); try { path = ShareManager::getInstance()->toReal(Util::toAdcFile(dl->getPath(ii->file) + ii->file->getName())); } catch(const ShareException&) { @@ -412,7 +412,6 @@ return true; } } - ItemInfo* ii = files->getSelectedData(); contextMenu = makeSingleMenu(ii); } else { Modified: dcplusplus/trunk/win32/SearchFrame.cpp =================================================================== --- dcplusplus/trunk/win32/SearchFrame.cpp 2007-12-22 22:38:16 UTC (rev 948) +++ dcplusplus/trunk/win32/SearchFrame.cpp 2007-12-23 11:04:30 UTC (rev 949) @@ -836,6 +836,12 @@ if(currentSearch.empty()) { return; } + + if(!aResult->getToken().empty() && token != aResult->getToken()) { + droppedResults++; + speak(SPEAK_FILTER_RESULT); + return; + } if(isHash) { if(aResult->getType() != SearchResult::TYPE_FILE || TTHValue(Text::fromT(currentSearch[0])) != aResult->getTTH()) { @@ -970,6 +976,7 @@ } s = s.substr(0, max(s.size(), static_cast<tstring::size_type>(1)) - 1); + token = Util::toString(Util::rand()); } @@ -1004,7 +1011,7 @@ if(SearchManager::getInstance()->okToSearch()) { SearchManager::getInstance()->search(clients, Text::fromT(s), llsize, - (SearchManager::TypeModes)ftype, mode, "manual"); + (SearchManager::TypeModes)ftype, mode, token); if(BOOLSETTING(CLEAR_SEARCH)) // Only clear if the search was sent searchBox->setText(Util::emptyStringT); } else { Modified: dcplusplus/trunk/win32/SearchFrame.h =================================================================== --- dcplusplus/trunk/win32/SearchFrame.h 2007-12-22 22:38:16 UTC (rev 948) +++ dcplusplus/trunk/win32/SearchFrame.h 2007-12-23 11:04:30 UTC (rev 949) @@ -200,6 +200,8 @@ CriticalSection cs; StringMap ucLineParams; + + std::string token; SearchFrame(SmartWin::WidgetTabView* mdiParent, const tstring& initialString_, LONGLONG initialSize_, SearchManager::SizeModes initialMode_, SearchManager::TypeModes initialType_); virtual ~SearchFrame(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-22 23:08:33
|
Revision: 110 http://adchpp.svn.sourceforge.net/adchpp/?rev=110&view=rev Author: arnetheduck Date: 2007-12-22 15:08:03 -0800 (Sat, 22 Dec 2007) Log Message: ----------- Add boost, more docs fixes Modified Paths: -------------- adchpp/trunk/Doxyfile Added Paths: ----------- adchpp/trunk/boost/ adchpp/trunk/boost/LICENSE_1_0.txt adchpp/trunk/boost/Readme.txt adchpp/trunk/boost/boost/ adchpp/trunk/boost/boost/algorithm/ adchpp/trunk/boost/boost/algorithm/minmax.hpp adchpp/trunk/boost/boost/algorithm/minmax_element.hpp adchpp/trunk/boost/boost/algorithm/string/ adchpp/trunk/boost/boost/algorithm/string/case_conv.hpp adchpp/trunk/boost/boost/algorithm/string/classification.hpp adchpp/trunk/boost/boost/algorithm/string/compare.hpp adchpp/trunk/boost/boost/algorithm/string/concept.hpp adchpp/trunk/boost/boost/algorithm/string/config.hpp adchpp/trunk/boost/boost/algorithm/string/constants.hpp adchpp/trunk/boost/boost/algorithm/string/detail/ adchpp/trunk/boost/boost/algorithm/string/detail/case_conv.hpp adchpp/trunk/boost/boost/algorithm/string/detail/classification.hpp adchpp/trunk/boost/boost/algorithm/string/detail/find_format.hpp adchpp/trunk/boost/boost/algorithm/string/detail/find_format_all.hpp adchpp/trunk/boost/boost/algorithm/string/detail/find_format_store.hpp adchpp/trunk/boost/boost/algorithm/string/detail/find_iterator.hpp adchpp/trunk/boost/boost/algorithm/string/detail/finder.hpp adchpp/trunk/boost/boost/algorithm/string/detail/finder_regex.hpp adchpp/trunk/boost/boost/algorithm/string/detail/formatter.hpp adchpp/trunk/boost/boost/algorithm/string/detail/formatter_regex.hpp adchpp/trunk/boost/boost/algorithm/string/detail/predicate.hpp adchpp/trunk/boost/boost/algorithm/string/detail/replace_storage.hpp adchpp/trunk/boost/boost/algorithm/string/detail/sequence.hpp adchpp/trunk/boost/boost/algorithm/string/detail/trim.hpp adchpp/trunk/boost/boost/algorithm/string/detail/util.hpp adchpp/trunk/boost/boost/algorithm/string/erase.hpp adchpp/trunk/boost/boost/algorithm/string/find.hpp adchpp/trunk/boost/boost/algorithm/string/find_format.hpp adchpp/trunk/boost/boost/algorithm/string/find_iterator.hpp adchpp/trunk/boost/boost/algorithm/string/finder.hpp adchpp/trunk/boost/boost/algorithm/string/formatter.hpp adchpp/trunk/boost/boost/algorithm/string/iter_find.hpp adchpp/trunk/boost/boost/algorithm/string/join.hpp adchpp/trunk/boost/boost/algorithm/string/predicate.hpp adchpp/trunk/boost/boost/algorithm/string/predicate_facade.hpp adchpp/trunk/boost/boost/algorithm/string/regex.hpp adchpp/trunk/boost/boost/algorithm/string/regex_find_format.hpp adchpp/trunk/boost/boost/algorithm/string/replace.hpp adchpp/trunk/boost/boost/algorithm/string/sequence_traits.hpp adchpp/trunk/boost/boost/algorithm/string/split.hpp adchpp/trunk/boost/boost/algorithm/string/std/ adchpp/trunk/boost/boost/algorithm/string/std/list_traits.hpp adchpp/trunk/boost/boost/algorithm/string/std/rope_traits.hpp adchpp/trunk/boost/boost/algorithm/string/std/slist_traits.hpp adchpp/trunk/boost/boost/algorithm/string/std/string_traits.hpp adchpp/trunk/boost/boost/algorithm/string/std_containers_traits.hpp adchpp/trunk/boost/boost/algorithm/string/trim.hpp adchpp/trunk/boost/boost/algorithm/string/yes_no_type.hpp adchpp/trunk/boost/boost/algorithm/string.hpp adchpp/trunk/boost/boost/algorithm/string_regex.hpp adchpp/trunk/boost/boost/aligned_storage.hpp adchpp/trunk/boost/boost/any.hpp adchpp/trunk/boost/boost/archive/ adchpp/trunk/boost/boost/archive/add_facet.hpp adchpp/trunk/boost/boost/archive/archive_exception.hpp adchpp/trunk/boost/boost/archive/basic_archive.hpp adchpp/trunk/boost/boost/archive/basic_binary_iarchive.hpp adchpp/trunk/boost/boost/archive/basic_binary_iprimitive.hpp adchpp/trunk/boost/boost/archive/basic_binary_oarchive.hpp adchpp/trunk/boost/boost/archive/basic_binary_oprimitive.hpp adchpp/trunk/boost/boost/archive/basic_streambuf_locale_saver.hpp adchpp/trunk/boost/boost/archive/basic_text_iarchive.hpp adchpp/trunk/boost/boost/archive/basic_text_iprimitive.hpp adchpp/trunk/boost/boost/archive/basic_text_oarchive.hpp adchpp/trunk/boost/boost/archive/basic_text_oprimitive.hpp adchpp/trunk/boost/boost/archive/basic_xml_archive.hpp adchpp/trunk/boost/boost/archive/basic_xml_iarchive.hpp adchpp/trunk/boost/boost/archive/basic_xml_oarchive.hpp adchpp/trunk/boost/boost/archive/binary_iarchive.hpp adchpp/trunk/boost/boost/archive/binary_iarchive_impl.hpp adchpp/trunk/boost/boost/archive/binary_oarchive.hpp adchpp/trunk/boost/boost/archive/binary_oarchive_impl.hpp adchpp/trunk/boost/boost/archive/binary_wiarchive.hpp adchpp/trunk/boost/boost/archive/binary_woarchive.hpp adchpp/trunk/boost/boost/archive/codecvt_null.hpp adchpp/trunk/boost/boost/archive/detail/ adchpp/trunk/boost/boost/archive/detail/abi_prefix.hpp adchpp/trunk/boost/boost/archive/detail/abi_suffix.hpp adchpp/trunk/boost/boost/archive/detail/archive_pointer_iserializer.hpp adchpp/trunk/boost/boost/archive/detail/archive_pointer_oserializer.hpp adchpp/trunk/boost/boost/archive/detail/auto_link_archive.hpp adchpp/trunk/boost/boost/archive/detail/auto_link_warchive.hpp adchpp/trunk/boost/boost/archive/detail/basic_archive_impl.hpp adchpp/trunk/boost/boost/archive/detail/basic_config.hpp adchpp/trunk/boost/boost/archive/detail/basic_iarchive.hpp adchpp/trunk/boost/boost/archive/detail/basic_iserializer.hpp adchpp/trunk/boost/boost/archive/detail/basic_oarchive.hpp adchpp/trunk/boost/boost/archive/detail/basic_oserializer.hpp adchpp/trunk/boost/boost/archive/detail/basic_pointer_iserializer.hpp adchpp/trunk/boost/boost/archive/detail/basic_pointer_oserializer.hpp adchpp/trunk/boost/boost/archive/detail/basic_serializer.hpp adchpp/trunk/boost/boost/archive/detail/basic_serializer_map.hpp adchpp/trunk/boost/boost/archive/detail/common_iarchive.hpp adchpp/trunk/boost/boost/archive/detail/common_oarchive.hpp adchpp/trunk/boost/boost/archive/detail/decl.hpp adchpp/trunk/boost/boost/archive/detail/interface_iarchive.hpp adchpp/trunk/boost/boost/archive/detail/interface_oarchive.hpp adchpp/trunk/boost/boost/archive/detail/iserializer.hpp adchpp/trunk/boost/boost/archive/detail/known_archive_types.hpp adchpp/trunk/boost/boost/archive/detail/known_archive_types_fwd.hpp adchpp/trunk/boost/boost/archive/detail/oserializer.hpp adchpp/trunk/boost/boost/archive/detail/polymorphic_iarchive_impl.hpp adchpp/trunk/boost/boost/archive/detail/polymorphic_oarchive_impl.hpp adchpp/trunk/boost/boost/archive/detail/utf8_codecvt_facet.hpp adchpp/trunk/boost/boost/archive/dinkumware.hpp adchpp/trunk/boost/boost/archive/impl/ adchpp/trunk/boost/boost/archive/impl/archive_pointer_iserializer.ipp adchpp/trunk/boost/boost/archive/impl/archive_pointer_oserializer.ipp adchpp/trunk/boost/boost/archive/impl/basic_binary_iarchive.ipp adchpp/trunk/boost/boost/archive/impl/basic_binary_iprimitive.ipp adchpp/trunk/boost/boost/archive/impl/basic_binary_oarchive.ipp adchpp/trunk/boost/boost/archive/impl/basic_binary_oprimitive.ipp adchpp/trunk/boost/boost/archive/impl/basic_text_iarchive.ipp adchpp/trunk/boost/boost/archive/impl/basic_text_iprimitive.ipp adchpp/trunk/boost/boost/archive/impl/basic_text_oarchive.ipp adchpp/trunk/boost/boost/archive/impl/basic_text_oprimitive.ipp adchpp/trunk/boost/boost/archive/impl/basic_xml_grammar.hpp adchpp/trunk/boost/boost/archive/impl/basic_xml_iarchive.ipp adchpp/trunk/boost/boost/archive/impl/basic_xml_oarchive.ipp adchpp/trunk/boost/boost/archive/impl/text_iarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/text_oarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/text_wiarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/text_woarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/xml_iarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/xml_oarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/xml_wiarchive_impl.ipp adchpp/trunk/boost/boost/archive/impl/xml_woarchive_impl.ipp adchpp/trunk/boost/boost/archive/iterators/ adchpp/trunk/boost/boost/archive/iterators/base64_exception.hpp adchpp/trunk/boost/boost/archive/iterators/base64_from_binary.hpp adchpp/trunk/boost/boost/archive/iterators/binary_from_base64.hpp adchpp/trunk/boost/boost/archive/iterators/dataflow.hpp adchpp/trunk/boost/boost/archive/iterators/dataflow_exception.hpp adchpp/trunk/boost/boost/archive/iterators/escape.hpp adchpp/trunk/boost/boost/archive/iterators/head_iterator.hpp adchpp/trunk/boost/boost/archive/iterators/insert_linebreaks.hpp adchpp/trunk/boost/boost/archive/iterators/istream_iterator.hpp adchpp/trunk/boost/boost/archive/iterators/mb_from_wchar.hpp adchpp/trunk/boost/boost/archive/iterators/ostream_iterator.hpp adchpp/trunk/boost/boost/archive/iterators/remove_whitespace.hpp adchpp/trunk/boost/boost/archive/iterators/transform_width.hpp adchpp/trunk/boost/boost/archive/iterators/unescape.hpp adchpp/trunk/boost/boost/archive/iterators/wchar_from_mb.hpp adchpp/trunk/boost/boost/archive/iterators/xml_escape.hpp adchpp/trunk/boost/boost/archive/iterators/xml_unescape.hpp adchpp/trunk/boost/boost/archive/iterators/xml_unescape_exception.hpp adchpp/trunk/boost/boost/archive/polymorphic_binary_iarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_binary_oarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_iarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_oarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_text_iarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_text_oarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_text_wiarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_text_woarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_xml_iarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_xml_oarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_xml_wiarchive.hpp adchpp/trunk/boost/boost/archive/polymorphic_xml_woarchive.hpp adchpp/trunk/boost/boost/archive/text_iarchive.hpp adchpp/trunk/boost/boost/archive/text_oarchive.hpp adchpp/trunk/boost/boost/archive/text_wiarchive.hpp adchpp/trunk/boost/boost/archive/text_woarchive.hpp adchpp/trunk/boost/boost/archive/tmpdir.hpp adchpp/trunk/boost/boost/archive/wcslen.hpp adchpp/trunk/boost/boost/archive/xml_iarchive.hpp adchpp/trunk/boost/boost/archive/xml_oarchive.hpp adchpp/trunk/boost/boost/archive/xml_wiarchive.hpp adchpp/trunk/boost/boost/archive/xml_woarchive.hpp adchpp/trunk/boost/boost/array.hpp adchpp/trunk/boost/boost/assert.hpp adchpp/trunk/boost/boost/assign/ adchpp/trunk/boost/boost/assign/assignment_exception.hpp adchpp/trunk/boost/boost/assign/list_inserter.hpp adchpp/trunk/boost/boost/assign/list_of.hpp adchpp/trunk/boost/boost/assign/ptr_list_inserter.hpp adchpp/trunk/boost/boost/assign/ptr_list_of.hpp adchpp/trunk/boost/boost/assign/ptr_map_inserter.hpp adchpp/trunk/boost/boost/assign/std/ adchpp/trunk/boost/boost/assign/std/deque.hpp adchpp/trunk/boost/boost/assign/std/list.hpp adchpp/trunk/boost/boost/assign/std/map.hpp adchpp/trunk/boost/boost/assign/std/queue.hpp adchpp/trunk/boost/boost/assign/std/set.hpp adchpp/trunk/boost/boost/assign/std/slist.hpp adchpp/trunk/boost/boost/assign/std/stack.hpp adchpp/trunk/boost/boost/assign/std/vector.hpp adchpp/trunk/boost/boost/assign/std.hpp adchpp/trunk/boost/boost/assign.hpp adchpp/trunk/boost/boost/bind/ adchpp/trunk/boost/boost/bind/apply.hpp adchpp/trunk/boost/boost/bind/arg.hpp adchpp/trunk/boost/boost/bind/bind_cc.hpp adchpp/trunk/boost/boost/bind/bind_mf_cc.hpp adchpp/trunk/boost/boost/bind/bind_template.hpp adchpp/trunk/boost/boost/bind/make_adaptable.hpp adchpp/trunk/boost/boost/bind/mem_fn_cc.hpp adchpp/trunk/boost/boost/bind/mem_fn_template.hpp adchpp/trunk/boost/boost/bind/mem_fn_vw.hpp adchpp/trunk/boost/boost/bind/placeholders.hpp adchpp/trunk/boost/boost/bind/protect.hpp adchpp/trunk/boost/boost/bind/storage.hpp adchpp/trunk/boost/boost/bind.hpp adchpp/trunk/boost/boost/blank.hpp adchpp/trunk/boost/boost/blank_fwd.hpp adchpp/trunk/boost/boost/call_traits.hpp adchpp/trunk/boost/boost/cast.hpp adchpp/trunk/boost/boost/checked_delete.hpp adchpp/trunk/boost/boost/compatibility/ adchpp/trunk/boost/boost/compatibility/cpp_c_headers/ adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cassert adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cctype adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cerrno adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cfloat adchpp/trunk/boost/boost/compatibility/cpp_c_headers/climits adchpp/trunk/boost/boost/compatibility/cpp_c_headers/clocale adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cmath adchpp/trunk/boost/boost/compatibility/cpp_c_headers/csetjmp adchpp/trunk/boost/boost/compatibility/cpp_c_headers/csignal adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cstdarg adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cstddef adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cstdio adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cstdlib adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cstring adchpp/trunk/boost/boost/compatibility/cpp_c_headers/ctime adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cwchar adchpp/trunk/boost/boost/compatibility/cpp_c_headers/cwctype adchpp/trunk/boost/boost/compressed_pair.hpp adchpp/trunk/boost/boost/concept_archetype.hpp adchpp/trunk/boost/boost/concept_check.hpp adchpp/trunk/boost/boost/config/ adchpp/trunk/boost/boost/config/abi/ adchpp/trunk/boost/boost/config/abi/borland_prefix.hpp adchpp/trunk/boost/boost/config/abi/borland_suffix.hpp adchpp/trunk/boost/boost/config/abi/msvc_prefix.hpp adchpp/trunk/boost/boost/config/abi/msvc_suffix.hpp adchpp/trunk/boost/boost/config/abi_prefix.hpp adchpp/trunk/boost/boost/config/abi_suffix.hpp adchpp/trunk/boost/boost/config/auto_link.hpp adchpp/trunk/boost/boost/config/compiler/ adchpp/trunk/boost/boost/config/compiler/borland.hpp adchpp/trunk/boost/boost/config/compiler/comeau.hpp adchpp/trunk/boost/boost/config/compiler/common_edg.hpp adchpp/trunk/boost/boost/config/compiler/compaq_cxx.hpp adchpp/trunk/boost/boost/config/compiler/digitalmars.hpp adchpp/trunk/boost/boost/config/compiler/gcc.hpp adchpp/trunk/boost/boost/config/compiler/gcc_xml.hpp adchpp/trunk/boost/boost/config/compiler/greenhills.hpp adchpp/trunk/boost/boost/config/compiler/hp_acc.hpp adchpp/trunk/boost/boost/config/compiler/intel.hpp adchpp/trunk/boost/boost/config/compiler/kai.hpp adchpp/trunk/boost/boost/config/compiler/metrowerks.hpp adchpp/trunk/boost/boost/config/compiler/mpw.hpp adchpp/trunk/boost/boost/config/compiler/sgi_mipspro.hpp adchpp/trunk/boost/boost/config/compiler/sunpro_cc.hpp adchpp/trunk/boost/boost/config/compiler/vacpp.hpp adchpp/trunk/boost/boost/config/compiler/visualc.hpp adchpp/trunk/boost/boost/config/no_tr1/ adchpp/trunk/boost/boost/config/no_tr1/complex.hpp adchpp/trunk/boost/boost/config/no_tr1/functional.hpp adchpp/trunk/boost/boost/config/no_tr1/memory.hpp adchpp/trunk/boost/boost/config/no_tr1/utility.hpp adchpp/trunk/boost/boost/config/platform/ adchpp/trunk/boost/boost/config/platform/aix.hpp adchpp/trunk/boost/boost/config/platform/amigaos.hpp adchpp/trunk/boost/boost/config/platform/beos.hpp adchpp/trunk/boost/boost/config/platform/bsd.hpp adchpp/trunk/boost/boost/config/platform/cygwin.hpp adchpp/trunk/boost/boost/config/platform/hpux.hpp adchpp/trunk/boost/boost/config/platform/irix.hpp adchpp/trunk/boost/boost/config/platform/linux.hpp adchpp/trunk/boost/boost/config/platform/macos.hpp adchpp/trunk/boost/boost/config/platform/qnxnto.hpp adchpp/trunk/boost/boost/config/platform/solaris.hpp adchpp/trunk/boost/boost/config/platform/win32.hpp adchpp/trunk/boost/boost/config/posix_features.hpp adchpp/trunk/boost/boost/config/requires_threads.hpp adchpp/trunk/boost/boost/config/select_compiler_config.hpp adchpp/trunk/boost/boost/config/select_platform_config.hpp adchpp/trunk/boost/boost/config/select_stdlib_config.hpp adchpp/trunk/boost/boost/config/stdlib/ adchpp/trunk/boost/boost/config/stdlib/dinkumware.hpp adchpp/trunk/boost/boost/config/stdlib/libcomo.hpp adchpp/trunk/boost/boost/config/stdlib/libstdcpp3.hpp adchpp/trunk/boost/boost/config/stdlib/modena.hpp adchpp/trunk/boost/boost/config/stdlib/msl.hpp adchpp/trunk/boost/boost/config/stdlib/roguewave.hpp adchpp/trunk/boost/boost/config/stdlib/sgi.hpp adchpp/trunk/boost/boost/config/stdlib/stlport.hpp adchpp/trunk/boost/boost/config/stdlib/vacpp.hpp adchpp/trunk/boost/boost/config/suffix.hpp adchpp/trunk/boost/boost/config/user.hpp adchpp/trunk/boost/boost/config.hpp adchpp/trunk/boost/boost/crc.hpp adchpp/trunk/boost/boost/cregex.hpp adchpp/trunk/boost/boost/cstdint.hpp adchpp/trunk/boost/boost/cstdlib.hpp adchpp/trunk/boost/boost/current_function.hpp adchpp/trunk/boost/boost/date_time/ adchpp/trunk/boost/boost/date_time/adjust_functors.hpp adchpp/trunk/boost/boost/date_time/c_local_time_adjustor.hpp adchpp/trunk/boost/boost/date_time/c_time.hpp adchpp/trunk/boost/boost/date_time/compiler_config.hpp adchpp/trunk/boost/boost/date_time/constrained_value.hpp adchpp/trunk/boost/boost/date_time/date.hpp adchpp/trunk/boost/boost/date_time/date_clock_device.hpp adchpp/trunk/boost/boost/date_time/date_defs.hpp adchpp/trunk/boost/boost/date_time/date_duration.hpp adchpp/trunk/boost/boost/date_time/date_duration_types.hpp adchpp/trunk/boost/boost/date_time/date_facet.hpp adchpp/trunk/boost/boost/date_time/date_format_simple.hpp adchpp/trunk/boost/boost/date_time/date_formatting.hpp adchpp/trunk/boost/boost/date_time/date_formatting_limited.hpp adchpp/trunk/boost/boost/date_time/date_formatting_locales.hpp adchpp/trunk/boost/boost/date_time/date_generator_formatter.hpp adchpp/trunk/boost/boost/date_time/date_generator_parser.hpp adchpp/trunk/boost/boost/date_time/date_generators.hpp adchpp/trunk/boost/boost/date_time/date_iterator.hpp adchpp/trunk/boost/boost/date_time/date_names_put.hpp adchpp/trunk/boost/boost/date_time/date_parsing.hpp adchpp/trunk/boost/boost/date_time/dst_rules.hpp adchpp/trunk/boost/boost/date_time/dst_transition_generators.hpp adchpp/trunk/boost/boost/date_time/filetime_functions.hpp adchpp/trunk/boost/boost/date_time/format_date_parser.hpp adchpp/trunk/boost/boost/date_time/gregorian/ adchpp/trunk/boost/boost/date_time/gregorian/conversion.hpp adchpp/trunk/boost/boost/date_time/gregorian/formatters.hpp adchpp/trunk/boost/boost/date_time/gregorian/formatters_limited.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_calendar.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_date.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_day.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_day_of_year.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_duration.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_duration_types.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_facet.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_month.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_serialize.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_weekday.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_year.hpp adchpp/trunk/boost/boost/date_time/gregorian/greg_ymd.hpp adchpp/trunk/boost/boost/date_time/gregorian/gregorian.hpp adchpp/trunk/boost/boost/date_time/gregorian/gregorian_io.hpp adchpp/trunk/boost/boost/date_time/gregorian/gregorian_types.hpp adchpp/trunk/boost/boost/date_time/gregorian/parsers.hpp adchpp/trunk/boost/boost/date_time/gregorian_calendar.hpp adchpp/trunk/boost/boost/date_time/gregorian_calendar.ipp adchpp/trunk/boost/boost/date_time/int_adapter.hpp adchpp/trunk/boost/boost/date_time/iso_format.hpp adchpp/trunk/boost/boost/date_time/local_time/ adchpp/trunk/boost/boost/date_time/local_time/conversion.hpp adchpp/trunk/boost/boost/date_time/local_time/custom_time_zone.hpp adchpp/trunk/boost/boost/date_time/local_time/date_duration_operators.hpp adchpp/trunk/boost/boost/date_time/local_time/dst_transition_day_rules.hpp adchpp/trunk/boost/boost/date_time/local_time/local_date_time.hpp adchpp/trunk/boost/boost/date_time/local_time/local_time.hpp adchpp/trunk/boost/boost/date_time/local_time/local_time_io.hpp adchpp/trunk/boost/boost/date_time/local_time/local_time_types.hpp adchpp/trunk/boost/boost/date_time/local_time/posix_time_zone.hpp adchpp/trunk/boost/boost/date_time/local_time/tz_database.hpp adchpp/trunk/boost/boost/date_time/local_time_adjustor.hpp adchpp/trunk/boost/boost/date_time/local_timezone_defs.hpp adchpp/trunk/boost/boost/date_time/locale_config.hpp adchpp/trunk/boost/boost/date_time/microsec_time_clock.hpp adchpp/trunk/boost/boost/date_time/parse_format_base.hpp adchpp/trunk/boost/boost/date_time/period.hpp adchpp/trunk/boost/boost/date_time/period_formatter.hpp adchpp/trunk/boost/boost/date_time/period_parser.hpp adchpp/trunk/boost/boost/date_time/posix_time/ adchpp/trunk/boost/boost/date_time/posix_time/conversion.hpp adchpp/trunk/boost/boost/date_time/posix_time/date_duration_operators.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_config.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_duration.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_io.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_legacy_io.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_system.hpp adchpp/trunk/boost/boost/date_time/posix_time/posix_time_types.hpp adchpp/trunk/boost/boost/date_time/posix_time/ptime.hpp adchpp/trunk/boost/boost/date_time/posix_time/time_formatters.hpp adchpp/trunk/boost/boost/date_time/posix_time/time_formatters_limited.hpp adchpp/trunk/boost/boost/date_time/posix_time/time_parsers.hpp adchpp/trunk/boost/boost/date_time/posix_time/time_period.hpp adchpp/trunk/boost/boost/date_time/posix_time/time_serialize.hpp adchpp/trunk/boost/boost/date_time/special_defs.hpp adchpp/trunk/boost/boost/date_time/special_values_formatter.hpp adchpp/trunk/boost/boost/date_time/special_values_parser.hpp adchpp/trunk/boost/boost/date_time/string_convert.hpp adchpp/trunk/boost/boost/date_time/string_parse_tree.hpp adchpp/trunk/boost/boost/date_time/strings_from_facet.hpp adchpp/trunk/boost/boost/date_time/testfrmwk.hpp adchpp/trunk/boost/boost/date_time/time.hpp adchpp/trunk/boost/boost/date_time/time_clock.hpp adchpp/trunk/boost/boost/date_time/time_defs.hpp adchpp/trunk/boost/boost/date_time/time_duration.hpp adchpp/trunk/boost/boost/date_time/time_facet.hpp adchpp/trunk/boost/boost/date_time/time_formatting_streams.hpp adchpp/trunk/boost/boost/date_time/time_iterator.hpp adchpp/trunk/boost/boost/date_time/time_parsing.hpp adchpp/trunk/boost/boost/date_time/time_resolution_traits.hpp adchpp/trunk/boost/boost/date_time/time_system_counted.hpp adchpp/trunk/boost/boost/date_time/time_system_split.hpp adchpp/trunk/boost/boost/date_time/time_zone_base.hpp adchpp/trunk/boost/boost/date_time/time_zone_names.hpp adchpp/trunk/boost/boost/date_time/tz_db_base.hpp adchpp/trunk/boost/boost/date_time/wrapping_int.hpp adchpp/trunk/boost/boost/date_time/year_month_day.hpp adchpp/trunk/boost/boost/date_time.hpp adchpp/trunk/boost/boost/detail/ adchpp/trunk/boost/boost/detail/algorithm.hpp adchpp/trunk/boost/boost/detail/allocator_utilities.hpp adchpp/trunk/boost/boost/detail/atomic_count.hpp adchpp/trunk/boost/boost/detail/atomic_count_gcc.hpp adchpp/trunk/boost/boost/detail/atomic_count_pthreads.hpp adchpp/trunk/boost/boost/detail/atomic_count_win32.hpp adchpp/trunk/boost/boost/detail/bad_weak_ptr.hpp adchpp/trunk/boost/boost/detail/binary_search.hpp adchpp/trunk/boost/boost/detail/call_traits.hpp adchpp/trunk/boost/boost/detail/catch_exceptions.hpp adchpp/trunk/boost/boost/detail/compressed_pair.hpp adchpp/trunk/boost/boost/detail/dynamic_bitset.hpp adchpp/trunk/boost/boost/detail/endian.hpp adchpp/trunk/boost/boost/detail/indirect_traits.hpp adchpp/trunk/boost/boost/detail/interlocked.hpp adchpp/trunk/boost/boost/detail/is_function_ref_tester.hpp adchpp/trunk/boost/boost/detail/is_incrementable.hpp adchpp/trunk/boost/boost/detail/is_xxx.hpp adchpp/trunk/boost/boost/detail/iterator.hpp adchpp/trunk/boost/boost/detail/lightweight_mutex.hpp adchpp/trunk/boost/boost/detail/lightweight_test.hpp adchpp/trunk/boost/boost/detail/limits.hpp adchpp/trunk/boost/boost/detail/lwm_nop.hpp adchpp/trunk/boost/boost/detail/lwm_pthreads.hpp adchpp/trunk/boost/boost/detail/lwm_win32_cs.hpp adchpp/trunk/boost/boost/detail/named_template_params.hpp adchpp/trunk/boost/boost/detail/no_exceptions_support.hpp adchpp/trunk/boost/boost/detail/none_t.hpp adchpp/trunk/boost/boost/detail/numeric_traits.hpp adchpp/trunk/boost/boost/detail/ob_call_traits.hpp adchpp/trunk/boost/boost/detail/ob_compressed_pair.hpp adchpp/trunk/boost/boost/detail/quick_allocator.hpp adchpp/trunk/boost/boost/detail/reference_content.hpp adchpp/trunk/boost/boost/detail/select_type.hpp adchpp/trunk/boost/boost/detail/shared_array_nmt.hpp adchpp/trunk/boost/boost/detail/shared_count.hpp adchpp/trunk/boost/boost/detail/shared_ptr_nmt.hpp adchpp/trunk/boost/boost/detail/sp_counted_base.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_cw_ppc.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_cw_x86.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_gcc_ia64.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_gcc_ppc.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_gcc_x86.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_nt.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_pt.hpp adchpp/trunk/boost/boost/detail/sp_counted_base_w32.hpp adchpp/trunk/boost/boost/detail/sp_counted_impl.hpp adchpp/trunk/boost/boost/detail/templated_streams.hpp adchpp/trunk/boost/boost/detail/utf8_codecvt_facet.hpp adchpp/trunk/boost/boost/detail/workaround.hpp adchpp/trunk/boost/boost/dynamic_bitset/ adchpp/trunk/boost/boost/dynamic_bitset/config.hpp adchpp/trunk/boost/boost/dynamic_bitset/dynamic_bitset.hpp adchpp/trunk/boost/boost/dynamic_bitset.hpp adchpp/trunk/boost/boost/dynamic_bitset_fwd.hpp adchpp/trunk/boost/boost/dynamic_property_map.hpp adchpp/trunk/boost/boost/enable_shared_from_this.hpp adchpp/trunk/boost/boost/filesystem/ adchpp/trunk/boost/boost/filesystem/cerrno.hpp adchpp/trunk/boost/boost/filesystem/config.hpp adchpp/trunk/boost/boost/filesystem/convenience.hpp adchpp/trunk/boost/boost/filesystem/exception.hpp adchpp/trunk/boost/boost/filesystem/fstream.hpp adchpp/trunk/boost/boost/filesystem/operations.hpp adchpp/trunk/boost/boost/filesystem/path.hpp adchpp/trunk/boost/boost/filesystem.hpp adchpp/trunk/boost/boost/foreach.hpp adchpp/trunk/boost/boost/format/ adchpp/trunk/boost/boost/format/alt_sstream.hpp adchpp/trunk/boost/boost/format/alt_sstream_impl.hpp adchpp/trunk/boost/boost/format/detail/ adchpp/trunk/boost/boost/format/detail/compat_workarounds.hpp adchpp/trunk/boost/boost/format/detail/config_macros.hpp adchpp/trunk/boost/boost/format/detail/msvc_disambiguater.hpp adchpp/trunk/boost/boost/format/detail/unset_macros.hpp adchpp/trunk/boost/boost/format/detail/workarounds_gcc-2_95.hpp adchpp/trunk/boost/boost/format/detail/workarounds_stlport.hpp adchpp/trunk/boost/boost/format/exceptions.hpp adchpp/trunk/boost/boost/format/feed_args.hpp adchpp/trunk/boost/boost/format/format_class.hpp adchpp/trunk/boost/boost/format/format_fwd.hpp adchpp/trunk/boost/boost/format/format_implementation.hpp adchpp/trunk/boost/boost/format/free_funcs.hpp adchpp/trunk/boost/boost/format/group.hpp adchpp/trunk/boost/boost/format/internals.hpp adchpp/trunk/boost/boost/format/internals_fwd.hpp adchpp/trunk/boost/boost/format/parsing.hpp adchpp/trunk/boost/boost/format.hpp adchpp/trunk/boost/boost/function/ adchpp/trunk/boost/boost/function/detail/ adchpp/trunk/boost/boost/function/detail/function_iterate.hpp adchpp/trunk/boost/boost/function/detail/gen_maybe_include.pl adchpp/trunk/boost/boost/function/detail/maybe_include.hpp adchpp/trunk/boost/boost/function/detail/prologue.hpp adchpp/trunk/boost/boost/function/function0.hpp adchpp/trunk/boost/boost/function/function1.hpp adchpp/trunk/boost/boost/function/function10.hpp adchpp/trunk/boost/boost/function/function2.hpp adchpp/trunk/boost/boost/function/function3.hpp adchpp/trunk/boost/boost/function/function4.hpp adchpp/trunk/boost/boost/function/function5.hpp adchpp/trunk/boost/boost/function/function6.hpp adchpp/trunk/boost/boost/function/function7.hpp adchpp/trunk/boost/boost/function/function8.hpp adchpp/trunk/boost/boost/function/function9.hpp adchpp/trunk/boost/boost/function/function_base.hpp adchpp/trunk/boost/boost/function/function_template.hpp adchpp/trunk/boost/boost/function/gen_function_N.pl adchpp/trunk/boost/boost/function.hpp adchpp/trunk/boost/boost/function_equal.hpp adchpp/trunk/boost/boost/function_output_iterator.hpp adchpp/trunk/boost/boost/functional/ adchpp/trunk/boost/boost/functional/detail/ adchpp/trunk/boost/boost/functional/detail/container_fwd.hpp adchpp/trunk/boost/boost/functional/detail/float_functions.hpp adchpp/trunk/boost/boost/functional/detail/hash_float.hpp adchpp/trunk/boost/boost/functional/hash/ adchpp/trunk/boost/boost/functional/hash/deque.hpp adchpp/trunk/boost/boost/functional/hash/hash.hpp adchpp/trunk/boost/boost/functional/hash/list.hpp adchpp/trunk/boost/boost/functional/hash/map.hpp adchpp/trunk/boost/boost/functional/hash/pair.hpp adchpp/trunk/boost/boost/functional/hash/set.hpp adchpp/trunk/boost/boost/functional/hash/vector.hpp adchpp/trunk/boost/boost/functional/hash.hpp adchpp/trunk/boost/boost/functional/hash_fwd.hpp adchpp/trunk/boost/boost/functional.hpp adchpp/trunk/boost/boost/generator_iterator.hpp adchpp/trunk/boost/boost/get_pointer.hpp adchpp/trunk/boost/boost/graph/ adchpp/trunk/boost/boost/graph/adj_list_serialize.hpp adchpp/trunk/boost/boost/graph/adjacency_iterator.hpp adchpp/trunk/boost/boost/graph/adjacency_list.hpp adchpp/trunk/boost/boost/graph/adjacency_list_io.hpp adchpp/trunk/boost/boost/graph/adjacency_matrix.hpp adchpp/trunk/boost/boost/graph/astar_search.hpp adchpp/trunk/boost/boost/graph/bandwidth.hpp adchpp/trunk/boost/boost/graph/bc_clustering.hpp adchpp/trunk/boost/boost/graph/bellman_ford_shortest_paths.hpp adchpp/trunk/boost/boost/graph/betweenness_centrality.hpp adchpp/trunk/boost/boost/graph/biconnected_components.hpp adchpp/trunk/boost/boost/graph/breadth_first_search.hpp adchpp/trunk/boost/boost/graph/circle_layout.hpp adchpp/trunk/boost/boost/graph/compressed_sparse_row_graph.hpp adchpp/trunk/boost/boost/graph/connected_components.hpp adchpp/trunk/boost/boost/graph/copy.hpp adchpp/trunk/boost/boost/graph/create_condensation_graph.hpp adchpp/trunk/boost/boost/graph/cuthill_mckee_ordering.hpp adchpp/trunk/boost/boost/graph/dag_shortest_paths.hpp adchpp/trunk/boost/boost/graph/depth_first_search.hpp adchpp/trunk/boost/boost/graph/detail/ adchpp/trunk/boost/boost/graph/detail/adj_list_edge_iterator.hpp adchpp/trunk/boost/boost/graph/detail/adjacency_list.hpp adchpp/trunk/boost/boost/graph/detail/array_binary_tree.hpp adchpp/trunk/boost/boost/graph/detail/bitset.hpp adchpp/trunk/boost/boost/graph/detail/bitset_adaptor.hpp adchpp/trunk/boost/boost/graph/detail/connected_components.hpp adchpp/trunk/boost/boost/graph/detail/edge.hpp adchpp/trunk/boost/boost/graph/detail/incidence_iterator.hpp adchpp/trunk/boost/boost/graph/detail/incremental_components.hpp adchpp/trunk/boost/boost/graph/detail/indexed_properties.hpp adchpp/trunk/boost/boost/graph/detail/is_same.hpp adchpp/trunk/boost/boost/graph/detail/list_base.hpp adchpp/trunk/boost/boost/graph/detail/permutation.hpp adchpp/trunk/boost/boost/graph/detail/read_graphviz_spirit.hpp adchpp/trunk/boost/boost/graph/detail/self_avoiding_walk.hpp adchpp/trunk/boost/boost/graph/detail/set_adaptor.hpp adchpp/trunk/boost/boost/graph/detail/shadow_iterator.hpp adchpp/trunk/boost/boost/graph/detail/sparse_ordering.hpp adchpp/trunk/boost/boost/graph/dijkstra_shortest_paths.hpp adchpp/trunk/boost/boost/graph/dominator_tree.hpp adchpp/trunk/boost/boost/graph/edge_connectivity.hpp adchpp/trunk/boost/boost/graph/edge_list.hpp adchpp/trunk/boost/boost/graph/edmunds_karp_max_flow.hpp adchpp/trunk/boost/boost/graph/erdos_renyi_generator.hpp adchpp/trunk/boost/boost/graph/exception.hpp adchpp/trunk/boost/boost/graph/filtered_graph.hpp adchpp/trunk/boost/boost/graph/floyd_warshall_shortest.hpp adchpp/trunk/boost/boost/graph/fruchterman_reingold.hpp adchpp/trunk/boost/boost/graph/graph_archetypes.hpp adchpp/trunk/boost/boost/graph/graph_as_tree.hpp adchpp/trunk/boost/boost/graph/graph_concepts.hpp adchpp/trunk/boost/boost/graph/graph_selectors.hpp adchpp/trunk/boost/boost/graph/graph_test.hpp adchpp/trunk/boost/boost/graph/graph_traits.hpp adchpp/trunk/boost/boost/graph/graph_utility.hpp adchpp/trunk/boost/boost/graph/graphviz.hpp adchpp/trunk/boost/boost/graph/gursoy_atun_layout.hpp adchpp/trunk/boost/boost/graph/incremental_components.hpp adchpp/trunk/boost/boost/graph/isomorphism.hpp adchpp/trunk/boost/boost/graph/iteration_macros.hpp adchpp/trunk/boost/boost/graph/iteration_macros_undef.hpp adchpp/trunk/boost/boost/graph/johnson_all_pairs_shortest.hpp adchpp/trunk/boost/boost/graph/kamada_kawai_spring_layout.hpp adchpp/trunk/boost/boost/graph/king_ordering.hpp adchpp/trunk/boost/boost/graph/kruskal_min_spanning_tree.hpp adchpp/trunk/boost/boost/graph/leda_graph.hpp adchpp/trunk/boost/boost/graph/matrix_as_graph.hpp adchpp/trunk/boost/boost/graph/max_cardinality_matching.hpp adchpp/trunk/boost/boost/graph/minimum_degree_ordering.hpp adchpp/trunk/boost/boost/graph/named_function_params.hpp adchpp/trunk/boost/boost/graph/neighbor_bfs.hpp adchpp/trunk/boost/boost/graph/page_rank.hpp adchpp/trunk/boost/boost/graph/plod_generator.hpp adchpp/trunk/boost/boost/graph/prim_minimum_spanning_tree.hpp adchpp/trunk/boost/boost/graph/profile.hpp adchpp/trunk/boost/boost/graph/properties.hpp adchpp/trunk/boost/boost/graph/property_iter_range.hpp adchpp/trunk/boost/boost/graph/push_relabel_max_flow.hpp adchpp/trunk/boost/boost/graph/random.hpp adchpp/trunk/boost/boost/graph/random_layout.hpp adchpp/trunk/boost/boost/graph/read_dimacs.hpp adchpp/trunk/boost/boost/graph/relax.hpp adchpp/trunk/boost/boost/graph/reverse_graph.hpp adchpp/trunk/boost/boost/graph/sequential_vertex_coloring.hpp adchpp/trunk/boost/boost/graph/simple_point.hpp adchpp/trunk/boost/boost/graph/sloan_ordering.hpp adchpp/trunk/boost/boost/graph/small_world_generator.hpp adchpp/trunk/boost/boost/graph/smallest_last_ordering.hpp adchpp/trunk/boost/boost/graph/stanford_graph.hpp adchpp/trunk/boost/boost/graph/strong_components.hpp adchpp/trunk/boost/boost/graph/subgraph.hpp adchpp/trunk/boost/boost/graph/topological_sort.hpp adchpp/trunk/boost/boost/graph/transitive_closure.hpp adchpp/trunk/boost/boost/graph/transpose_graph.hpp adchpp/trunk/boost/boost/graph/tree_traits.hpp adchpp/trunk/boost/boost/graph/two_bit_color_map.hpp adchpp/trunk/boost/boost/graph/undirected_dfs.hpp adchpp/trunk/boost/boost/graph/vector_as_graph.hpp adchpp/trunk/boost/boost/graph/visitors.hpp adchpp/trunk/boost/boost/graph/wavefront.hpp adchpp/trunk/boost/boost/implicit_cast.hpp adchpp/trunk/boost/boost/indirect_reference.hpp adchpp/trunk/boost/boost/integer/ adchpp/trunk/boost/boost/integer/integer_mask.hpp adchpp/trunk/boost/boost/integer/static_log2.hpp adchpp/trunk/boost/boost/integer/static_min_max.hpp adchpp/trunk/boost/boost/integer.hpp adchpp/trunk/boost/boost/integer_fwd.hpp adchpp/trunk/boost/boost/integer_traits.hpp adchpp/trunk/boost/boost/intrusive_ptr.hpp adchpp/trunk/boost/boost/io/ adchpp/trunk/boost/boost/io/ios_state.hpp adchpp/trunk/boost/boost/io_fwd.hpp adchpp/trunk/boost/boost/iostreams/ adchpp/trunk/boost/boost/iostreams/categories.hpp adchpp/trunk/boost/boost/iostreams/chain.hpp adchpp/trunk/boost/boost/iostreams/char_traits.hpp adchpp/trunk/boost/boost/iostreams/checked_operations.hpp adchpp/trunk/boost/boost/iostreams/close.hpp adchpp/trunk/boost/boost/iostreams/code_converter.hpp adchpp/trunk/boost/boost/iostreams/combine.hpp adchpp/trunk/boost/boost/iostreams/compose.hpp adchpp/trunk/boost/boost/iostreams/concepts.hpp adchpp/trunk/boost/boost/iostreams/constants.hpp adchpp/trunk/boost/boost/iostreams/copy.hpp adchpp/trunk/boost/boost/iostreams/detail/ adchpp/trunk/boost/boost/iostreams/detail/access_control.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/ adchpp/trunk/boost/boost/iostreams/detail/adapter/basic_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/concept_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/direct_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/mode_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/output_iterator_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/adapter/range_adapter.hpp adchpp/trunk/boost/boost/iostreams/detail/add_facet.hpp adchpp/trunk/boost/boost/iostreams/detail/bool_trait_def.hpp adchpp/trunk/boost/boost/iostreams/detail/broken_overload_resolution/ adchpp/trunk/boost/boost/iostreams/detail/broken_overload_resolution/forward.hpp adchpp/trunk/boost/boost/iostreams/detail/broken_overload_resolution/stream.hpp adchpp/trunk/boost/boost/iostreams/detail/broken_overload_resolution/stream_buffer.hpp adchpp/trunk/boost/boost/iostreams/detail/buffer.hpp adchpp/trunk/boost/boost/iostreams/detail/call_traits.hpp adchpp/trunk/boost/boost/iostreams/detail/char_traits.hpp adchpp/trunk/boost/boost/iostreams/detail/closer.hpp adchpp/trunk/boost/boost/iostreams/detail/codecvt_helper.hpp adchpp/trunk/boost/boost/iostreams/detail/codecvt_holder.hpp adchpp/trunk/boost/boost/iostreams/detail/config/ adchpp/trunk/boost/boost/iostreams/detail/config/auto_link.hpp adchpp/trunk/boost/boost/iostreams/detail/config/bzip2.hpp adchpp/trunk/boost/boost/iostreams/detail/config/codecvt.hpp adchpp/trunk/boost/boost/iostreams/detail/config/disable_warnings.hpp adchpp/trunk/boost/boost/iostreams/detail/config/dyn_link.hpp adchpp/trunk/boost/boost/iostreams/detail/config/enable_warnings.hpp adchpp/trunk/boost/boost/iostreams/detail/config/gcc.hpp adchpp/trunk/boost/boost/iostreams/detail/config/limits.hpp adchpp/trunk/boost/boost/iostreams/detail/config/overload_resolution.hpp adchpp/trunk/boost/boost/iostreams/detail/config/wide_streams.hpp adchpp/trunk/boost/boost/iostreams/detail/config/windows_posix.hpp adchpp/trunk/boost/boost/iostreams/detail/config/zlib.hpp adchpp/trunk/boost/boost/iostreams/detail/counted_array.hpp adchpp/trunk/boost/boost/iostreams/detail/default_arg.hpp adchpp/trunk/boost/boost/iostreams/detail/dispatch.hpp adchpp/trunk/boost/boost/iostreams/detail/double_object.hpp adchpp/trunk/boost/boost/iostreams/detail/enable_if_stream.hpp adchpp/trunk/boost/boost/iostreams/detail/error.hpp adchpp/trunk/boost/boost/iostreams/detail/forward.hpp adchpp/trunk/boost/boost/iostreams/detail/fstream.hpp adchpp/trunk/boost/boost/iostreams/detail/ios.hpp adchpp/trunk/boost/boost/iostreams/detail/iostream.hpp adchpp/trunk/boost/boost/iostreams/detail/is_dereferenceable.hpp adchpp/trunk/boost/boost/iostreams/detail/is_iterator_range.hpp adchpp/trunk/boost/boost/iostreams/detail/newline.hpp adchpp/trunk/boost/boost/iostreams/detail/optional.hpp adchpp/trunk/boost/boost/iostreams/detail/param_type.hpp adchpp/trunk/boost/boost/iostreams/detail/push.hpp adchpp/trunk/boost/boost/iostreams/detail/push_params.hpp adchpp/trunk/boost/boost/iostreams/detail/resolve.hpp adchpp/trunk/boost/boost/iostreams/detail/select.hpp adchpp/trunk/boost/boost/iostreams/detail/select_by_size.hpp adchpp/trunk/boost/boost/iostreams/detail/streambuf/ adchpp/trunk/boost/boost/iostreams/detail/streambuf/chainbuf.hpp adchpp/trunk/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp adchpp/trunk/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp adchpp/trunk/boost/boost/iostreams/detail/streambuf/linked_streambuf.hpp adchpp/trunk/boost/boost/iostreams/detail/streambuf.hpp adchpp/trunk/boost/boost/iostreams/detail/system_failure.hpp adchpp/trunk/boost/boost/iostreams/detail/template_params.hpp adchpp/trunk/boost/boost/iostreams/detail/translate_int_type.hpp adchpp/trunk/boost/boost/iostreams/detail/vc6/ adchpp/trunk/boost/boost/iostreams/detail/vc6/close.hpp adchpp/trunk/boost/boost/iostreams/detail/vc6/read.hpp adchpp/trunk/boost/boost/iostreams/detail/vc6/write.hpp adchpp/trunk/boost/boost/iostreams/detail/wrap_unwrap.hpp adchpp/trunk/boost/boost/iostreams/device/ adchpp/trunk/boost/boost/iostreams/device/array.hpp adchpp/trunk/boost/boost/iostreams/device/back_inserter.hpp adchpp/trunk/boost/boost/iostreams/device/file.hpp adchpp/trunk/boost/boost/iostreams/device/file_descriptor.hpp adchpp/trunk/boost/boost/iostreams/device/mapped_file.hpp adchpp/trunk/boost/boost/iostreams/device/null.hpp adchpp/trunk/boost/boost/iostreams/filter/ adchpp/trunk/boost/boost/iostreams/filter/aggregate.hpp adchpp/trunk/boost/boost/iostreams/filter/bzip2.hpp adchpp/trunk/boost/boost/iostreams/filter/counter.hpp adchpp/trunk/boost/boost/iostreams/filter/gzip.hpp adchpp/trunk/boost/boost/iostreams/filter/line.hpp adchpp/trunk/boost/boost/iostreams/filter/newline.hpp adchpp/trunk/boost/boost/iostreams/filter/regex.hpp adchpp/trunk/boost/boost/iostreams/filter/stdio.hpp adchpp/trunk/boost/boost/iostreams/filter/symmetric.hpp adchpp/trunk/boost/boost/iostreams/filter/test.hpp adchpp/trunk/boost/boost/iostreams/filter/zlib.hpp adchpp/trunk/boost/boost/iostreams/filtering_stream.hpp adchpp/trunk/boost/boost/iostreams/filtering_streambuf.hpp adchpp/trunk/boost/boost/iostreams/flush.hpp adchpp/trunk/boost/boost/iostreams/get.hpp adchpp/trunk/boost/boost/iostreams/imbue.hpp adchpp/trunk/boost/boost/iostreams/input_sequence.hpp adchpp/trunk/boost/boost/iostreams/invert.hpp adchpp/trunk/boost/boost/iostreams/operations.hpp adchpp/trunk/boost/boost/iostreams/operations_fwd.hpp adchpp/trunk/boost/boost/iostreams/optimal_buffer_size.hpp adchpp/trunk/boost/boost/iostreams/output_sequence.hpp adchpp/trunk/boost/boost/iostreams/pipeline.hpp adchpp/trunk/boost/boost/iostreams/positioning.hpp adchpp/trunk/boost/boost/iostreams/put.hpp adchpp/trunk/boost/boost/iostreams/putback.hpp adchpp/trunk/boost/boost/iostreams/read.hpp adchpp/trunk/boost/boost/iostreams/restrict.hpp adchpp/trunk/boost/boost/iostreams/seek.hpp adchpp/trunk/boost/boost/iostreams/skip.hpp adchpp/trunk/boost/boost/iostreams/stream.hpp adchpp/trunk/boost/boost/iostreams/stream_buffer.hpp adchpp/trunk/boost/boost/iostreams/tee.hpp adchpp/trunk/boost/boost/iostreams/traits.hpp adchpp/trunk/boost/boost/iostreams/traits_fwd.hpp adchpp/trunk/boost/boost/iostreams/write.hpp adchpp/trunk/boost/boost/iterator/ adchpp/trunk/boost/boost/iterator/counting_iterator.hpp adchpp/trunk/boost/boost/iterator/detail/ adchpp/trunk/boost/boost/iterator/detail/any_conversion_eater.hpp adchpp/trunk/boost/boost/iterator/detail/config_def.hpp adchpp/trunk/boost/boost/iterator/detail/config_undef.hpp adchpp/trunk/boost/boost/iterator/detail/enable_if.hpp adchpp/trunk/boost/boost/iterator/detail/facade_iterator_category.hpp adchpp/trunk/boost/boost/iterator/detail/minimum_category.hpp adchpp/trunk/boost/boost/iterator/filter_iterator.hpp adchpp/trunk/boost/boost/iterator/indirect_iterator.hpp adchpp/trunk/boost/boost/iterator/interoperable.hpp adchpp/trunk/boost/boost/iterator/is_lvalue_iterator.hpp adchpp/trunk/boost/boost/iterator/is_readable_iterator.hpp adchpp/trunk/boost/boost/iterator/iterator_adaptor.hpp adchpp/trunk/boost/boost/iterator/iterator_archetypes.hpp adchpp/trunk/boost/boost/iterator/iterator_categories.hpp adchpp/trunk/boost/boost/iterator/iterator_concepts.hpp adchpp/trunk/boost/boost/iterator/iterator_facade.hpp adchpp/trunk/boost/boost/iterator/iterator_traits.hpp adchpp/trunk/boost/boost/iterator/new_iterator_tests.hpp adchpp/trunk/boost/boost/iterator/permutation_iterator.hpp adchpp/trunk/boost/boost/iterator/reverse_iterator.hpp adchpp/trunk/boost/boost/iterator/transform_iterator.hpp adchpp/trunk/boost/boost/iterator/zip_iterator.hpp adchpp/trunk/boost/boost/iterator.hpp adchpp/trunk/boost/boost/iterator_adaptors.hpp adchpp/trunk/boost/boost/lambda/ adchpp/trunk/boost/boost/lambda/algorithm.hpp adchpp/trunk/boost/boost/lambda/bind.hpp adchpp/trunk/boost/boost/lambda/casts.hpp adchpp/trunk/boost/boost/lambda/closures.hpp adchpp/trunk/boost/boost/lambda/construct.hpp adchpp/trunk/boost/boost/lambda/control_structures.hpp adchpp/trunk/boost/boost/lambda/core.hpp adchpp/trunk/boost/boost/lambda/detail/ adchpp/trunk/boost/boost/lambda/detail/actions.hpp adchpp/trunk/boost/boost/lambda/detail/arity_code.hpp adchpp/trunk/boost/boost/lambda/detail/bind_functions.hpp adchpp/trunk/boost/boost/lambda/detail/control_constructs_common.hpp adchpp/trunk/boost/boost/lambda/detail/control_structures_impl.hpp adchpp/trunk/boost/boost/lambda/detail/function_adaptors.hpp adchpp/trunk/boost/boost/lambda/detail/is_instance_of.hpp adchpp/trunk/boost/boost/lambda/detail/lambda_config.hpp adchpp/trunk/boost/boost/lambda/detail/lambda_functor_base.hpp adchpp/trunk/boost/boost/lambda/detail/lambda_functors.hpp adchpp/trunk/boost/boost/lambda/detail/lambda_fwd.hpp adchpp/trunk/boost/boost/lambda/detail/lambda_traits.hpp adchpp/trunk/boost/boost/lambda/detail/member_ptr.hpp adchpp/trunk/boost/boost/lambda/detail/operator_actions.hpp adchpp/trunk/boost/boost/lambda/detail/operator_lambda_func_base.hpp adchpp/trunk/boost/boost/lambda/detail/operator_return_type_traits.hpp adchpp/trunk/boost/boost/lambda/detail/operators.hpp adchpp/trunk/boost/boost/lambda/detail/ret.hpp adchpp/trunk/boost/boost/lambda/detail/return_type_traits.hpp adchpp/trunk/boost/boost/lambda/detail/select_functions.hpp adchpp/trunk/boost/boost/lambda/exceptions.hpp adchpp/trunk/boost/boost/lambda/if.hpp adchpp/trunk/boost/boost/lambda/lambda.hpp adchpp/trunk/boost/boost/lambda/loops.hpp adchpp/trunk/boost/boost/lambda/numeric.hpp adchpp/trunk/boost/boost/lambda/switch.hpp adchpp/trunk/boost/boost/last_value.hpp adchpp/trunk/boost/boost/lexical_cast.hpp adchpp/trunk/boost/boost/limits.hpp adchpp/trunk/boost/boost/logic/ adchpp/trunk/boost/boost/logic/tribool.hpp adchpp/trunk/boost/boost/logic/tribool_fwd.hpp adchpp/trunk/boost/boost/logic/tribool_io.hpp adchpp/trunk/boost/boost/math/ adchpp/trunk/boost/boost/math/common_factor.hpp adchpp/trunk/boost/boost/math/common_factor_ct.hpp adchpp/trunk/boost/boost/math/common_factor_rt.hpp adchpp/trunk/boost/boost/math/complex/ adchpp/trunk/boost/boost/math/complex/acos.hpp adchpp/trunk/boost/boost/math/complex/acosh.hpp adchpp/trunk/boost/boost/math/complex/asin.hpp adchpp/trunk/boost/boost/math/complex/asinh.hpp adchpp/trunk/boost/boost/math/complex/atan.hpp adchpp/trunk/boost/boost/math/complex/atanh.hpp adchpp/trunk/boost/boost/math/complex/details.hpp adchpp/trunk/boost/boost/math/complex/fabs.hpp adchpp/trunk/boost/boost/math/complex.hpp adchpp/trunk/boost/boost/math/octonion.hpp adchpp/trunk/boost/boost/math/quaternion.hpp adchpp/trunk/boost/boost/math/special_functions/ adchpp/trunk/boost/boost/math/special_functions/acosh.hpp adchpp/trunk/boost/boost/math/special_functions/asinh.hpp adchpp/trunk/boost/boost/math/special_functions/atanh.hpp adchpp/trunk/boost/boost/math/special_functions/detail/ adchpp/trunk/boost/boost/math/special_functions/detail/series.hpp adchpp/trunk/boost/boost/math/special_functions/expm1.hpp adchpp/trunk/boost/boost/math/special_functions/hypot.hpp adchpp/trunk/boost/boost/math/special_functions/log1p.hpp adchpp/trunk/boost/boost/math/special_functions/sinc.hpp adchpp/trunk/boost/boost/math/special_functions/sinhc.hpp adchpp/trunk/boost/boost/math_fwd.hpp adchpp/trunk/boost/boost/mem_fn.hpp adchpp/trunk/boost/boost/mpl/ adchpp/trunk/boost/boost/mpl/O1_size.hpp adchpp/trunk/boost/boost/mpl/O1_size_fwd.hpp adchpp/trunk/boost/boost/mpl/accumulate.hpp adchpp/trunk/boost/boost/mpl/advance.hpp adchpp/trunk/boost/boost/mpl/advance_fwd.hpp adchpp/trunk/boost/boost/mpl/alias.hpp adchpp/trunk/boost/boost/mpl/always.hpp adchpp/trunk/boost/boost/mpl/and.hpp adchpp/trunk/boost/boost/mpl/apply.hpp adchpp/trunk/boost/boost/mpl/apply_fwd.hpp adchpp/trunk/boost/boost/mpl/apply_wrap.hpp adchpp/trunk/boost/boost/mpl/arg.hpp adchpp/trunk/boost/boost/mpl/arg_fwd.hpp adchpp/trunk/boost/boost/mpl/arithmetic.hpp adchpp/trunk/boost/boost/mpl/as_sequence.hpp adchpp/trunk/boost/boost/mpl/assert.hpp adchpp/trunk/boost/boost/mpl/at.hpp adchpp/trunk/boost/boost/mpl/at_fwd.hpp adchpp/trunk/boost/boost/mpl/aux_/ adchpp/trunk/boost/boost/mpl/aux_/O1_size_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/adl_barrier.hpp adchpp/trunk/boost/boost/mpl/aux_/advance_backward.hpp adchpp/trunk/boost/boost/mpl/aux_/advance_forward.hpp adchpp/trunk/boost/boost/mpl/aux_/apply_1st.hpp adchpp/trunk/boost/boost/mpl/aux_/arg_typedef.hpp adchpp/trunk/boost/boost/mpl/aux_/arithmetic_op.hpp adchpp/trunk/boost/boost/mpl/aux_/arity.hpp adchpp/trunk/boost/boost/mpl/aux_/arity_spec.hpp adchpp/trunk/boost/boost/mpl/aux_/at_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/back_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/basic_bind.hpp adchpp/trunk/boost/boost/mpl/aux_/begin_end_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/clear_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/common_name_wknd.hpp adchpp/trunk/boost/boost/mpl/aux_/comparison_op.hpp adchpp/trunk/boost/boost/mpl/aux_/config/ adchpp/trunk/boost/boost/mpl/aux_/config/adl.hpp adchpp/trunk/boost/boost/mpl/aux_/config/arrays.hpp adchpp/trunk/boost/boost/mpl/aux_/config/bind.hpp adchpp/trunk/boost/boost/mpl/aux_/config/compiler.hpp adchpp/trunk/boost/boost/mpl/aux_/config/ctps.hpp adchpp/trunk/boost/boost/mpl/aux_/config/dependent_nttp.hpp adchpp/trunk/boost/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp adchpp/trunk/boost/boost/mpl/aux_/config/dtp.hpp adchpp/trunk/boost/boost/mpl/aux_/config/eti.hpp adchpp/trunk/boost/boost/mpl/aux_/config/forwarding.hpp adchpp/trunk/boost/boost/mpl/aux_/config/gcc.hpp adchpp/trunk/boost/boost/mpl/aux_/config/has_apply.hpp adchpp/trunk/boost/boost/mpl/aux_/config/has_xxx.hpp adchpp/trunk/boost/boost/mpl/aux_/config/integral.hpp adchpp/trunk/boost/boost/mpl/aux_/config/intel.hpp adchpp/trunk/boost/boost/mpl/aux_/config/lambda.hpp adchpp/trunk/boost/boost/mpl/aux_/config/msvc.hpp adchpp/trunk/boost/boost/mpl/aux_/config/msvc_typename.hpp adchpp/trunk/boost/boost/mpl/aux_/config/nttp.hpp adchpp/trunk/boost/boost/mpl/aux_/config/operators.hpp adchpp/trunk/boost/boost/mpl/aux_/config/overload_resolution.hpp adchpp/trunk/boost/boost/mpl/aux_/config/preprocessor.hpp adchpp/trunk/boost/boost/mpl/aux_/config/static_constant.hpp adchpp/trunk/boost/boost/mpl/aux_/config/ttp.hpp adchpp/trunk/boost/boost/mpl/aux_/config/typeof.hpp adchpp/trunk/boost/boost/mpl/aux_/config/use_preprocessed.hpp adchpp/trunk/boost/boost/mpl/aux_/config/workaround.hpp adchpp/trunk/boost/boost/mpl/aux_/contains_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/count_args.hpp adchpp/trunk/boost/boost/mpl/aux_/count_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/empty_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/erase_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/erase_key_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/filter_iter.hpp adchpp/trunk/boost/boost/mpl/aux_/find_if_pred.hpp adchpp/trunk/boost/boost/mpl/aux_/fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/fold_impl_body.hpp adchpp/trunk/boost/boost/mpl/aux_/fold_op.hpp adchpp/trunk/boost/boost/mpl/aux_/fold_pred.hpp adchpp/trunk/boost/boost/mpl/aux_/front_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/full_lambda.hpp adchpp/trunk/boost/boost/mpl/aux_/has_apply.hpp adchpp/trunk/boost/boost/mpl/aux_/has_begin.hpp adchpp/trunk/boost/boost/mpl/aux_/has_key_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/has_rebind.hpp adchpp/trunk/boost/boost/mpl/aux_/has_size.hpp adchpp/trunk/boost/boost/mpl/aux_/has_tag.hpp adchpp/trunk/boost/boost/mpl/aux_/has_type.hpp adchpp/trunk/boost/boost/mpl/aux_/include_preprocessed.hpp adchpp/trunk/boost/boost/mpl/aux_/insert_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/insert_range_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/inserter_algorithm.hpp adchpp/trunk/boost/boost/mpl/aux_/integral_wrapper.hpp adchpp/trunk/boost/boost/mpl/aux_/is_msvc_eti_arg.hpp adchpp/trunk/boost/boost/mpl/aux_/iter_apply.hpp adchpp/trunk/boost/boost/mpl/aux_/iter_fold_if_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/iter_fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/iter_push_front.hpp adchpp/trunk/boost/boost/mpl/aux_/joint_iter.hpp adchpp/trunk/boost/boost/mpl/aux_/lambda_arity_param.hpp adchpp/trunk/boost/boost/mpl/aux_/lambda_no_ctps.hpp adchpp/trunk/boost/boost/mpl/aux_/lambda_spec.hpp adchpp/trunk/boost/boost/mpl/aux_/lambda_support.hpp adchpp/trunk/boost/boost/mpl/aux_/largest_int.hpp adchpp/trunk/boost/boost/mpl/aux_/logical_op.hpp adchpp/trunk/boost/boost/mpl/aux_/msvc_dtw.hpp adchpp/trunk/boost/boost/mpl/aux_/msvc_eti_base.hpp adchpp/trunk/boost/boost/mpl/aux_/msvc_is_class.hpp adchpp/trunk/boost/boost/mpl/aux_/msvc_never_true.hpp adchpp/trunk/boost/boost/mpl/aux_/msvc_type.hpp adchpp/trunk/boost/boost/mpl/aux_/na.hpp adchpp/trunk/boost/boost/mpl/aux_/na_assert.hpp adchpp/trunk/boost/boost/mpl/aux_/na_fwd.hpp adchpp/trunk/boost/boost/mpl/aux_/na_spec.hpp adchpp/trunk/boost/boost/mpl/aux_/nested_type_wknd.hpp adchpp/trunk/boost/boost/mpl/aux_/nttp_decl.hpp adchpp/trunk/boost/boost/mpl/aux_/numeric_cast_utils.hpp adchpp/trunk/boost/boost/mpl/aux_/numeric_op.hpp adchpp/trunk/boost/boost/mpl/aux_/order_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/overload_names.hpp adchpp/trunk/boost/boost/mpl/aux_/partition_op.hpp adchpp/trunk/boost/boost/mpl/aux_/pop_back_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/pop_front_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/ adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/ adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/advance_backward.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/advance_forward.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/and.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/apply.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/apply_fwd.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/apply_wrap.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/arg.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/basic_bind.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/bind.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/bind_fwd.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/bitand.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/bitor.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/bitxor.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/deque.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/divides.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/equal_to.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/full_lambda.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/greater.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/greater_equal.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/inherit.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/iter_fold_if_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/iter_fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/lambda_no_ctps.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/less.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/less_equal.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/list.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/list_c.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/map.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/minus.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/modulus.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/not_equal_to.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/or.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/placeholders.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/plus.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/quote.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/reverse_fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/reverse_iter_fold_impl.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/set.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/set_c.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/shift_left.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/shift_right.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/template_arity.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/times.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/unpack_args.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/vector.hpp adchpp/trunk/boost/boost/mpl/aux_/preprocessed/bcc/vector_c.hpp adchp... [truncated message content] |
From: <arn...@us...> - 2007-12-22 22:38:18
|
Revision: 948 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=948&view=rev Author: arnetheduck Date: 2007-12-22 14:38:16 -0800 (Sat, 22 Dec 2007) Log Message: ----------- boost 1.34.1 Modified Paths: -------------- dcplusplus/trunk/boost/boost/archive/basic_text_oprimitive.hpp dcplusplus/trunk/boost/boost/archive/basic_xml_archive.hpp dcplusplus/trunk/boost/boost/archive/detail/iserializer.hpp dcplusplus/trunk/boost/boost/archive/detail/oserializer.hpp dcplusplus/trunk/boost/boost/date_time/date_generators.hpp dcplusplus/trunk/boost/boost/date_time/time_resolution_traits.hpp dcplusplus/trunk/boost/boost/detail/atomic_count_gcc.hpp dcplusplus/trunk/boost/boost/function.hpp dcplusplus/trunk/boost/boost/functional/hash/hash.hpp dcplusplus/trunk/boost/boost/graph/relax.hpp dcplusplus/trunk/boost/boost/iostreams/char_traits.hpp dcplusplus/trunk/boost/boost/iostreams/checked_operations.hpp dcplusplus/trunk/boost/boost/iostreams/code_converter.hpp dcplusplus/trunk/boost/boost/iostreams/compose.hpp dcplusplus/trunk/boost/boost/iostreams/detail/adapter/concept_adapter.hpp dcplusplus/trunk/boost/boost/iostreams/detail/adapter/direct_adapter.hpp dcplusplus/trunk/boost/boost/iostreams/detail/adapter/mode_adapter.hpp dcplusplus/trunk/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp dcplusplus/trunk/boost/boost/iostreams/detail/adapter/range_adapter.hpp dcplusplus/trunk/boost/boost/iostreams/detail/resolve.hpp dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp dcplusplus/trunk/boost/boost/iostreams/device/file.hpp dcplusplus/trunk/boost/boost/iostreams/device/file_descriptor.hpp dcplusplus/trunk/boost/boost/iostreams/device/mapped_file.hpp dcplusplus/trunk/boost/boost/iostreams/device/null.hpp dcplusplus/trunk/boost/boost/iostreams/filter/aggregate.hpp dcplusplus/trunk/boost/boost/iostreams/filter/gzip.hpp dcplusplus/trunk/boost/boost/iostreams/filter/line.hpp dcplusplus/trunk/boost/boost/iostreams/filter/zlib.hpp dcplusplus/trunk/boost/boost/iostreams/restrict.hpp dcplusplus/trunk/boost/boost/limits.hpp dcplusplus/trunk/boost/boost/numeric/interval/detail/ppc_rounding_control.hpp dcplusplus/trunk/boost/boost/operators.hpp dcplusplus/trunk/boost/boost/python/exec.hpp dcplusplus/trunk/boost/boost/python/module_init.hpp dcplusplus/trunk/boost/boost/regex/v4/basic_regex.hpp dcplusplus/trunk/boost/boost/spirit/iterator/file_iterator.hpp dcplusplus/trunk/boost/boost/spirit/iterator/impl/file_iterator.ipp dcplusplus/trunk/boost/boost/tr1/detail/config.hpp dcplusplus/trunk/boost/boost/version.hpp dcplusplus/trunk/boost/boost/xpressive/detail/core/state.hpp dcplusplus/trunk/boost/boost/xpressive/detail/dynamic/dynamic.hpp Modified: dcplusplus/trunk/boost/boost/archive/basic_text_oprimitive.hpp =================================================================== --- dcplusplus/trunk/boost/boost/archive/basic_text_oprimitive.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/archive/basic_text_oprimitive.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -89,8 +89,10 @@ void save(const bool t){ // trap usage of invalid uninitialized boolean which would // otherwise crash on load. +#ifndef NDEBUG int i = t; assert(0 == i || 1 == i); +#endif if(os.fail()) boost::throw_exception(archive_exception(archive_exception::stream_error)); os << t; Modified: dcplusplus/trunk/boost/boost/archive/basic_xml_archive.hpp =================================================================== --- dcplusplus/trunk/boost/boost/archive/basic_xml_archive.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/archive/basic_xml_archive.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -36,7 +36,7 @@ xml_archive_tag_mismatch, xml_archive_tag_name_error } exception_code; - xml_archive_exception(exception_code c) + xml_archive_exception(exception_code /* c */) {} virtual const char *what( ) const throw( ) { Modified: dcplusplus/trunk/boost/boost/archive/detail/iserializer.hpp =================================================================== --- dcplusplus/trunk/boost/boost/archive/detail/iserializer.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/archive/detail/iserializer.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -121,7 +121,7 @@ return boost::serialization::implementation_level<T>::value >= boost::serialization::object_class_info; } - virtual bool tracking(const unsigned int flags) const { + virtual bool tracking(const unsigned int /* flags */) const { // if(0 != (flags & no_tracking)) // return false; return boost::serialization::tracking_level<T>::value Modified: dcplusplus/trunk/boost/boost/archive/detail/oserializer.hpp =================================================================== --- dcplusplus/trunk/boost/boost/archive/detail/oserializer.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/archive/detail/oserializer.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -114,7 +114,7 @@ return boost::serialization::implementation_level<T>::value >= boost::serialization::object_class_info; } - virtual bool tracking(const unsigned int flags) const { + virtual bool tracking(const unsigned int /* flags */) const { // if(0 != (flags & no_tracking)) // return false; return boost::serialization::tracking_level<T>::value == boost::serialization::track_always Modified: dcplusplus/trunk/boost/boost/date_time/date_generators.hpp =================================================================== --- dcplusplus/trunk/boost/boost/date_time/date_generators.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/date_time/date_generators.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) * Author: Jeff Garland, Bart Garst - * $Date: 2005/04/17 21:48:19 $ + * $Date: 2007/06/01 16:12:07 $ */ /*! @file date_generators.hpp @@ -153,6 +153,8 @@ month_type month_; }; + //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5. + BOOST_DATE_TIME_DECL const char* nth_as_str(int n); //! Useful generator functor for finding holidays /*! Based on the idea in Cal. Calc. for finding holidays that are @@ -241,10 +243,8 @@ week_num wn_; day_of_week_type dow_; }; - - //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5. - BOOST_DATE_TIME_DECL const char* nth_as_str(int n); + //! Useful generator functor for finding holidays and daylight savings /*! Similar to nth_kday_of_month, but requires less paramters * \ingroup date_alg Modified: dcplusplus/trunk/boost/boost/date_time/time_resolution_traits.hpp =================================================================== --- dcplusplus/trunk/boost/boost/date_time/time_resolution_traits.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/date_time/time_resolution_traits.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE-1.0 or http://www.boost.org/LICENSE-1.0) * Author: Jeff Garland, Bart Garst - * $Date: 2005/08/25 16:27:20 $ + * $Date: 2007/05/25 19:58:16 $ */ @@ -120,11 +120,10 @@ + (fractional_seconds_type(minutes)*60) + seconds)*res_adjust()) + fs) * -1); } - else{ - return (((fractional_seconds_type(hours)*3600) - + (fractional_seconds_type(minutes)*60) - + seconds)*res_adjust()) + fs; - } + + return (((fractional_seconds_type(hours)*3600) + + (fractional_seconds_type(minutes)*60) + + seconds)*res_adjust()) + fs; } }; Modified: dcplusplus/trunk/boost/boost/detail/atomic_count_gcc.hpp =================================================================== --- dcplusplus/trunk/boost/boost/detail/atomic_count_gcc.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/detail/atomic_count_gcc.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -17,7 +17,11 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <bits/atomicity.h> +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) +# include <ext/atomicity.h> +#else +# include <bits/atomicity.h> +#endif namespace boost { Modified: dcplusplus/trunk/boost/boost/function.hpp =================================================================== --- dcplusplus/trunk/boost/boost/function.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/function.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -21,8 +21,8 @@ // in anything that may be included by function_template.hpp doesn't break #include <boost/function/detail/prologue.hpp> -// Visual Age C++ doesn't handle the file iteration well -#if BOOST_WORKAROUND(__IBMCPP__, >= 500) +// Older versions of the IBM C++ compiler do not handle file iterations well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800) # if BOOST_FUNCTION_MAX_ARGS >= 0 # include <boost/function/function0.hpp> # endif Modified: dcplusplus/trunk/boost/boost/functional/hash/hash.hpp =================================================================== --- dcplusplus/trunk/boost/boost/functional/hash/hash.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/functional/hash/hash.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -1,5 +1,5 @@ -// Copyright Daniel James 2005-2006. Use, modification, and distribution are +// Copyright Daniel James 2005-2007. Use, modification, and distribution are // subject to the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -28,6 +28,11 @@ #include <boost/type_traits/is_const.hpp> #endif +#if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4267) +#endif + namespace boost { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) @@ -41,12 +46,13 @@ std::size_t hash_value(long); std::size_t hash_value(unsigned long); -#if defined(BOOST_MSVC) && defined(_WIN64) +#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64) // On 64-bit windows std::size_t is a typedef for unsigned long long, which // isn't due to be supported until Boost 1.35. So add support here. // (Technically, Boost.Hash isn't actually documented as supporting // std::size_t. But it would be pretty silly not to). - std::size_t hash_value(std::size_t); + std::size_t hash_value(long long); + std::size_t hash_value(unsigned long long); #endif #if !BOOST_WORKAROUND(__DMC__, <= 0x848) @@ -116,7 +122,7 @@ return static_cast<std::size_t>(v); } -#if defined(_M_X64) && defined(_WIN64) +#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64) inline std::size_t hash_value(long long v) { return v; @@ -588,5 +594,9 @@ #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } +#if defined(BOOST_MSVC) +# pragma warning(pop) #endif +#endif + Modified: dcplusplus/trunk/boost/boost/graph/relax.hpp =================================================================== --- dcplusplus/trunk/boost/boost/graph/relax.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/graph/relax.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -22,16 +22,13 @@ template <class T> struct closed_plus { - // std::abs just isn't portable :( - template <class X> - inline X my_abs(const X& x) const { return x < 0 ? -x : x; } - T operator()(const T& a, const T& b) const { using namespace std; - T inf = (numeric_limits<T>::max)(); - if (b > 0 && my_abs(inf - a) < b) - return inf; - return a + b; + T zero(0); + T result = a + b; + if (result < zero && a >= zero && b >= zero) + return (numeric_limits<T>::max)(); + return result; } }; Modified: dcplusplus/trunk/boost/boost/iostreams/char_traits.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/char_traits.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/char_traits.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -27,8 +27,8 @@ namespace boost { namespace iostreams { -// Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines the -// EOF and WEOF macros to not std:: qualify the wint_t type (and so does +// Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines +// the EOF and WEOF macros to not std:: qualify the wint_t type (and so does // Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope. // NOTE: Use BOOST_WORKAROUND? #if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB)) \ Modified: dcplusplus/trunk/boost/boost/iostreams/checked_operations.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/checked_operations.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/checked_operations.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -127,7 +127,7 @@ template<> struct seek_if_impl<random_access> { template<typename T> - static stream_offset + static std::streampos seek( T& t, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { return iostreams::seek(t, off, way, which); } @@ -136,7 +136,7 @@ template<> struct seek_if_impl<any_tag> { template<typename T> - static stream_offset + static std::streampos seek(T&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode) { throw cant_seek(); } }; Modified: dcplusplus/trunk/boost/boost/iostreams/code_converter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/code_converter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/code_converter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -23,7 +23,7 @@ #include <algorithm> // max. #include <cstring> // memcpy. #include <exception> -#include <boost/config.hpp> // DEDUCED_TYPENAME. +#include <boost/config.hpp> // DEDUCED_TYPENAME, #include <boost/iostreams/char_traits.hpp> #include <boost/iostreams/constants.hpp> // default_filter_buffer_size. #include <boost/iostreams/detail/adapter/concept_adapter.hpp> @@ -57,6 +57,32 @@ namespace detail { +//--------------Definition of strncpy_if_same---------------------------------// + +// Helper template for strncpy_if_same, below. +template<bool B> +struct strncpy_if_same_impl; + +template<> +struct strncpy_if_same_impl<true> { + template<typename Ch> + static Ch* copy(Ch* tgt, const Ch* src, std::streamsize n) + { return BOOST_IOSTREAMS_CHAR_TRAITS(Ch)::copy(tgt, src, n); } +}; + +template<> +struct strncpy_if_same_impl<false> { + template<typename Src, typename Tgt> + static Tgt* copy(Tgt* tgt, const Src*, std::streamsize) { return tgt; } +}; + +template<typename Src, typename Tgt> +Tgt* strncpy_if_same(Tgt* tgt, const Src* src, std::streamsize n) +{ + typedef strncpy_if_same_impl<is_same<Src, Tgt>::value> impl; + return impl::copy(tgt, src, n); +} + //--------------Definition of conversion_buffer-------------------------------// // Buffer and conversion state for reading. @@ -169,7 +195,7 @@ policy_type& dev() { return **dev_; } - enum { + enum flag_type { f_open = 1, f_input_closed = f_open << 1, f_output_closed = f_input_closed << 1 @@ -311,16 +337,18 @@ break; case codecvt_base::ok: break; + case codecvt_base::noconv: + { + streamsize amt = + std::min<streamsize>(next - buf.ptr(), n - total); + detail::strncpy_if_same(s + total, buf.ptr(), amt); + total += amt; + } + break; case codecvt_base::error: + default: buf.state() = state_type(); throw code_conversion_error(); - case codecvt_base::noconv: - default: - buf.state() = state_type(); - intern_type c = intern_type(); - memcpy(&c, (const void*) buf.ptr(), sizeof(extern_type)); - s[total++] = c; - break; } } while (total < n && status != EOF && status != WOULD_BLOCK); @@ -362,24 +390,19 @@ case codecvt_base::ok: total = static_cast<streamsize>(nint - s); break; + case codecvt_base::noconv: + { + streamsize amt = + std::min<streamsize>( nint - total - s, + buf.end() - buf.eptr() ); + detail::strncpy_if_same(buf.eptr(), s + total, amt); + total += amt; + } + break; case codecvt_base::error: + default: buf.state() = state_type(); throw code_conversion_error(); - case codecvt_base::noconv: - { - // This can be shortened to two memcpy's. - const char* c = (const char*) (s + total); - for ( std::size_t index = 0; - index < sizeof(intern_type); - index += sizeof(extern_type), - ++buf.ptr() ) - { - memcpy(buf.ptr(), c + index, sizeof(extern_type)); - if (buf.eptr() == buf.end()) - buf.flush(dev()); - } - ++total; - } } } return total; Modified: dcplusplus/trunk/boost/boost/iostreams/compose.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/compose.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/compose.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -78,9 +78,9 @@ composite_device(const Filter& flt, param_type dev); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); void close(); void close(BOOST_IOS::openmode which); @@ -142,9 +142,9 @@ } template<typename Device> - stream_offset seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ) + std::streampos seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) { composite_device<filter_ref, Device> cmp(boost::ref(filter2_), dev); return iostreams::seek(filter1_, cmp, off, way, which); @@ -325,7 +325,7 @@ { return iostreams::write(filter_, device_, s, n); } template<typename Filter, typename Device, typename Mode> -stream_offset composite_device<Filter, Device, Mode>::seek +std::streampos composite_device<Filter, Device, Mode>::seek (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { return iostreams::seek(filter_, device_, off, way, which); } Modified: dcplusplus/trunk/boost/boost/iostreams/detail/adapter/concept_adapter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/adapter/concept_adapter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/adapter/concept_adapter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -80,16 +80,16 @@ std::streamsize write(const char_type* s, std::streamsize n, Sink* snk) { return output_impl::write(t_, snk, s, n); } - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which ) + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) { return this->seek( off, way, which, (basic_null_device<char_type, seekable>*) 0); } template<typename Device> - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which, Device* dev ) + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which, Device* dev ) { return any_impl::seek(t_, dev, off, way, which); } void close(BOOST_IOS::openmode which) @@ -122,7 +122,7 @@ template<> struct device_wrapper_impl<any_tag> { template<typename Device, typename Dummy> - static stream_offset + static std::streampos seek( Device& dev, Dummy*, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { @@ -131,7 +131,7 @@ } template<typename Device> - static stream_offset + static std::streampos seek( Device&, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) { @@ -139,7 +139,7 @@ } template<typename Device> - static stream_offset + static std::streampos seek( Device& dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access ) @@ -191,7 +191,7 @@ template<> struct flt_wrapper_impl<any_tag> { template<typename Filter, typename Device> - static stream_offset + static std::streampos seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { @@ -200,13 +200,13 @@ } template<typename Filter, typename Device> - static stream_offset + static std::streampos seek( Filter&, Device*, stream_offset, BOOST_IOS::seekdir, BOOST_IOS::openmode, any_tag ) { throw cant_seek(); } template<typename Filter, typename Device> - static stream_offset + static std::streampos seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access tag ) @@ -216,14 +216,14 @@ } template<typename Filter, typename Device> - static stream_offset + static std::streampos seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access, any_tag ) { return f.seek(*dev, off, way); } template<typename Filter, typename Device> - static stream_offset + static std::streampos seek( Filter& f, Device* dev, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which, random_access, two_sequence ) Modified: dcplusplus/trunk/boost/boost/iostreams/detail/adapter/direct_adapter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/adapter/direct_adapter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/adapter/direct_adapter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -111,8 +111,8 @@ std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek( stream_offset, BOOST_IOS::seekdir, - BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out ); + std::streampos seek( stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out ); void close(); void close(BOOST_IOS::openmode which); #ifndef BOOST_IOSTREAMS_NO_LOCALE @@ -214,7 +214,7 @@ } template<typename Direct> -inline stream_offset direct_adapter<Direct>::seek +inline std::streampos direct_adapter<Direct>::seek ( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { @@ -248,7 +248,7 @@ else bad_seek(); } - return static_cast<stream_offset>(next); + return offset_to_position(next); } template<typename Direct> Modified: dcplusplus/trunk/boost/boost/iostreams/detail/adapter/mode_adapter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/adapter/mode_adapter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/adapter/mode_adapter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -48,9 +48,9 @@ std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) void close(BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out); #endif @@ -66,12 +66,12 @@ { return iostreams::write(t_, snk, s, n); } template<typename Device> - stream_offset seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) + std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) { return iostreams::seek(t_, dev, off, way); } template<typename Device> - stream_offset seek( Device& dev, stream_offset off, - BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) + std::streampos seek( Device& dev, stream_offset off, + BOOST_IOS::seekdir way, BOOST_IOS::openmode which ) { return iostreams::seek(t_, dev, off, way, which); } template<typename Device> @@ -102,7 +102,7 @@ { return boost::iostreams::write(t_, s, n); } template<typename Mode, typename T> -stream_offset mode_adapter<Mode, T>::seek +std::streampos mode_adapter<Mode, T>::seek (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { return boost::iostreams::seek(t_, off, way, which); } Modified: dcplusplus/trunk/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/adapter/non_blocking_adapter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -44,9 +44,9 @@ } return result; } - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ) + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ) { return iostreams::seek(device_, off, way, which); } public: Device& device_; Modified: dcplusplus/trunk/boost/boost/iostreams/detail/adapter/range_adapter.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/adapter/range_adapter.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/adapter/range_adapter.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -62,7 +62,7 @@ range_adapter(iterator first, iterator last); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek(stream_offset off, BOOST_IOS::seekdir way); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); private: iterator first_, cur_, last_; }; @@ -89,11 +89,11 @@ template<typename Mode, typename Range> -stream_offset range_adapter<Mode, Range>::seek +std::streampos range_adapter<Mode, Range>::seek (stream_offset off, BOOST_IOS::seekdir way) { impl::seek(first_, cur_, last_, off, way); - return static_cast<stream_offset>(cur_ - first_); + return offset_to_position(cur_ - first_); } //------------------Implementation of range_adapter_impl----------------------// Modified: dcplusplus/trunk/boost/boost/iostreams/detail/resolve.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/resolve.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/resolve.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -47,10 +47,7 @@ struct resolve_traits { typedef typename mpl::if_< - mpl::and_< - boost::detail::is_incrementable<T>, // Must come first - is_dereferenceable<T> // for CW 9.[0-4] - >, + boost::detail::is_incrementable<T>, output_iterator_adapter<Mode, Ch, T>, const T& >::type type; @@ -163,10 +160,7 @@ mode_adapter<Mode, T>, is_iterator_range<T>, range_adapter<Mode, T>, - mpl::and_< - is_dereferenceable<T>, - boost::detail::is_incrementable<T> - >, + is_dereferenceable<T>, output_iterator_adapter<Mode, Ch, T>, is_array<T>, array_adapter<Mode, T>, Modified: dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/direct_streambuf.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -24,6 +24,7 @@ #include <boost/iostreams/detail/streambuf/linked_streambuf.hpp> #include <boost/iostreams/detail/error.hpp> #include <boost/iostreams/operations.hpp> +#include <boost/iostreams/positioning.hpp> #include <boost/iostreams/traits.hpp> // Must come last. @@ -52,7 +53,7 @@ ) streambuf_type; public: // stream needs access. void open(const T& t, int buffer_size, int pback_size); - bool is_open(); + bool is_open() const; void close(); bool auto_close() const { return auto_close_; } void set_auto_close(bool close) { auto_close_ = close; } @@ -85,7 +86,7 @@ BOOST_IOS::openmode which ); pos_type seekpos(pos_type sp, BOOST_IOS::openmode which); private: - pos_type seek_impl( off_type off, BOOST_IOS::seekdir way, + pos_type seek_impl( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which ); void init_input(any_tag) { } void init_input(input); @@ -118,7 +119,8 @@ } template<typename T, typename Tr> -bool direct_streambuf<T, Tr>::is_open() { return ibeg_ != 0 && !obeg_ != 0; } +bool direct_streambuf<T, Tr>::is_open() const +{ return ibeg_ != 0 && !obeg_ != 0; } template<typename T, typename Tr> void direct_streambuf<T, Tr>::close() @@ -185,7 +187,10 @@ inline typename direct_streambuf<T, Tr>::pos_type direct_streambuf<T, Tr>::seekpos (pos_type sp, BOOST_IOS::openmode) -{ return seek_impl(sp, BOOST_IOS::beg, BOOST_IOS::in | BOOST_IOS::out); } +{ + return seek_impl( position_to_offset(sp), BOOST_IOS::beg, + BOOST_IOS::in | BOOST_IOS::out ); +} template<typename T, typename Tr> void direct_streambuf<T, Tr>::close(BOOST_IOS::openmode which) @@ -204,13 +209,13 @@ template<typename T, typename Tr> typename direct_streambuf<T, Tr>::pos_type direct_streambuf<T, Tr>::seek_impl - (off_type off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) + (stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which) { using namespace std; BOOST_IOS::openmode both = BOOST_IOS::in | BOOST_IOS::out; if (two_head() && (which & both) == both) throw bad_seek(); - off_type result = -1; + stream_offset result = -1; bool one = one_head(); if (one && (pptr() != 0 || gptr()== 0)) init_get_area(); // Switch to input mode, for code reuse. @@ -242,7 +247,7 @@ pbump(static_cast<int>(next - (pptr() - obeg_))); result = next; } - return result; + return offset_to_position(result); } template<typename T, typename Tr> Modified: dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/detail/streambuf/indirect_streambuf.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -118,7 +118,7 @@ void sync_impl(); void close_impl(BOOST_IOS::openmode); - enum { + enum flag_type { f_open = 1, f_input_closed = f_open << 1, f_output_closed = f_input_closed << 1, @@ -328,7 +328,10 @@ inline typename indirect_streambuf<T, Tr, Alloc, Mode>::pos_type indirect_streambuf<T, Tr, Alloc, Mode>::seekpos (pos_type sp, BOOST_IOS::openmode) -{ return seek_impl(sp, BOOST_IOS::beg, BOOST_IOS::in | BOOST_IOS::out); } +{ + return seek_impl( position_to_offset(sp), BOOST_IOS::beg, + BOOST_IOS::in | BOOST_IOS::out ); +} template<typename T, typename Tr, typename Alloc, typename Mode> typename indirect_streambuf<T, Tr, Alloc, Mode>::pos_type Modified: dcplusplus/trunk/boost/boost/iostreams/device/file.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/device/file.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/device/file.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -51,9 +51,9 @@ BOOST_IOS::in | BOOST_IOS::out ); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek( stream_offset off, BOOST_IOS::seekdir way, - BOOST_IOS::openmode which = - BOOST_IOS::in | BOOST_IOS::out ); + std::streampos seek( stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = + BOOST_IOS::in | BOOST_IOS::out ); void open( const std::string& path, BOOST_IOS::openmode mode = BOOST_IOS::in | BOOST_IOS::out, @@ -154,7 +154,7 @@ { return pimpl_->file_.sputn(s, n); } template<typename Ch> -stream_offset basic_file<Ch>::seek +std::streampos basic_file<Ch>::seek ( stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode ) { return iostreams::seek(pimpl_->file_, off, way); } Modified: dcplusplus/trunk/boost/boost/iostreams/device/file_descriptor.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/device/file_descriptor.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/device/file_descriptor.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -63,7 +63,7 @@ bool is_open() const { return pimpl_->flags_ != 0; } std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek(stream_offset off, BOOST_IOS::seekdir way); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); void close(); private: struct impl { Modified: dcplusplus/trunk/boost/boost/iostreams/device/mapped_file.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/device/mapped_file.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/device/mapped_file.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -137,7 +137,7 @@ //------------------Definition of mapped_file---------------------------------// -class mapped_file { +class BOOST_IOSTREAMS_DECL mapped_file { private: typedef mapped_file_source delegate_type; delegate_type delegate_; @@ -202,7 +202,7 @@ static int alignment() { return mapped_file_source::alignment(); } }; -struct mapped_file_sink : private mapped_file { +struct BOOST_IOSTREAMS_DECL mapped_file_sink : private mapped_file { friend struct operations<mapped_file_sink>; typedef char char_type; struct category Modified: dcplusplus/trunk/boost/boost/iostreams/device/null.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/device/null.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/device/null.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -30,9 +30,9 @@ { }; std::streamsize read(Ch*, std::streamsize) { return 0; } std::streamsize write(const Ch*, std::streamsize n) { return n; } - stream_offset seek( stream_offset, BOOST_IOS::seekdir, - BOOST_IOS::openmode = - BOOST_IOS::in | BOOST_IOS::out ) + std::streampos seek( stream_offset, BOOST_IOS::seekdir, + BOOST_IOS::openmode = + BOOST_IOS::in | BOOST_IOS::out ) { return -1; } void close(BOOST_IOS::openmode = BOOST_IOS::in | BOOST_IOS::out) { } }; Modified: dcplusplus/trunk/boost/boost/iostreams/filter/aggregate.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/filter/aggregate.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/filter/aggregate.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -145,7 +145,7 @@ do_close(); } - enum { + enum flag_type { f_read = 1, f_write = f_read << 1, f_eof = f_write << 1 Modified: dcplusplus/trunk/boost/boost/iostreams/filter/gzip.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/filter/gzip.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/filter/gzip.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -234,14 +234,20 @@ template<typename Sink> void close(Sink& snk, BOOST_IOS::openmode m) { + namespace io = boost::iostreams; + if (m & BOOST_IOS::out) { // Close zlib compressor. base_type::close(snk, BOOST_IOS::out); - // Write final fields of gzip file format. - write_long(this->crc(), snk); - write_long(this->total_in(), snk); + if (flags_ & f_header_done) { + + // Write final fields of gzip file format. + write_long(this->crc(), snk); + write_long(this->total_in(), snk); + } + } #if BOOST_WORKAROUND(__GNUC__, == 2) && defined(__STL_CONFIG_H) || \ BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) \ @@ -267,7 +273,7 @@ boost::iostreams::put(next, static_cast<char>(0xFF & (n >> 24))); } - enum { + enum flag_type { f_header_done = 1, f_body_done = f_header_done << 1, f_footer_done = f_body_done << 1 @@ -456,7 +462,7 @@ if (static_cast<int>(read_uint32(rng, gzip::bad_footer)) != this->total_out()) throw gzip_error(gzip::bad_length); } - enum { + enum flag_type { f_header_read = 1, f_footer_read = f_header_read << 1, f_text = f_footer_read << 1 @@ -547,11 +553,11 @@ static_cast<streamsize>(str.size() - offset_); streamsize amt = (std::min)(avail, n); std::copy( str.data() + offset_, - str.data() + offset_ + amt, - s ); + str.data() + offset_ + amt, + s ); offset_ += amt; if ( !(flags_ & f_header_done) && - offset_ == static_cast<std::size_t>(str.size()) ) + offset_ == static_cast<std::size_t>(str.size()) ) { flags_ |= f_header_done; } Modified: dcplusplus/trunk/boost/boost/iostreams/filter/line.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/filter/line.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/filter/line.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -193,7 +193,7 @@ pos_ = string_type::npos; } - enum { + enum flag_type { f_read = 1, f_write = f_read << 1 }; Modified: dcplusplus/trunk/boost/boost/iostreams/filter/zlib.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/filter/zlib.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/filter/zlib.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -332,7 +332,7 @@ template<typename Alloc> zlib_compressor_impl<Alloc>::~zlib_compressor_impl() -{ /*reset(true, false);*/ } +{ reset(true, false); } template<typename Alloc> bool zlib_compressor_impl<Alloc>::filter @@ -357,7 +357,7 @@ template<typename Alloc> zlib_decompressor_impl<Alloc>::~zlib_decompressor_impl() -{ /*reset(false, false);*/ } +{ reset(false, false); } template<typename Alloc> zlib_decompressor_impl<Alloc>::zlib_decompressor_impl(int window_bits) Modified: dcplusplus/trunk/boost/boost/iostreams/restrict.hpp =================================================================== --- dcplusplus/trunk/boost/boost/iostreams/restrict.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/iostreams/restrict.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -61,7 +61,7 @@ stream_offset len = -1 ); std::streamsize read(char_type* s, std::streamsize n); std::streamsize write(const char_type* s, std::streamsize n); - stream_offset seek(stream_offset off, BOOST_IOS::seekdir way); + std::streampos seek(stream_offset off, BOOST_IOS::seekdir way); private: stream_offset beg_, pos_, end_; }; @@ -145,7 +145,7 @@ } template<typename Device> - stream_offset seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) + std::streampos seek(Device& dev, stream_offset off, BOOST_IOS::seekdir way) { stream_offset next; if (way == BOOST_IOS::beg) { @@ -159,12 +159,12 @@ pos_ = this->component().seek(dev, off, BOOST_IOS::end); if (pos_ < beg_) bad_seek(); - return pos_ - beg_; + return offset_to_position(pos_ - beg_); } if (next < beg_ || end_ != -1 && next >= end_) bad_seek(); pos_ = this->component().seek(dev, next, BOOST_IOS::cur); - return pos_ - beg_; + return offset_to_position(pos_ - beg_); } private: template<typename Device> @@ -329,7 +329,7 @@ } template<typename Device> -stream_offset restricted_indirect_device<Device>::seek +std::streampos restricted_indirect_device<Device>::seek (stream_offset off, BOOST_IOS::seekdir way) { stream_offset next; @@ -344,12 +344,12 @@ pos_ = iostreams::seek(this->component(), off, BOOST_IOS::end); if (pos_ < beg_) bad_seek(); - return pos_ - beg_; + return offset_to_position(pos_ - beg_); } if (next < beg_ || end_ != -1 && next >= end_) bad_seek(); pos_ = iostreams::seek(this->component(), next - pos_, BOOST_IOS::cur); - return pos_ - beg_; + return offset_to_position(pos_ - beg_); } //--------------Implementation of restricted_direct_device--------------------// Modified: dcplusplus/trunk/boost/boost/limits.hpp =================================================================== --- dcplusplus/trunk/boost/boost/limits.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/limits.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -76,8 +76,8 @@ static BOOST_LLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = false); - BOOST_STATIC_CONSTANT(bool, is_modulo = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); @@ -129,8 +129,8 @@ static BOOST_ULLT denorm_min() throw() { return 0; }; BOOST_STATIC_CONSTANT(bool, is_iec559 = false); - BOOST_STATIC_CONSTANT(bool, is_bounded = false); - BOOST_STATIC_CONSTANT(bool, is_modulo = false); + BOOST_STATIC_CONSTANT(bool, is_bounded = true); + BOOST_STATIC_CONSTANT(bool, is_modulo = true); BOOST_STATIC_CONSTANT(bool, traps = false); BOOST_STATIC_CONSTANT(bool, tinyness_before = false); @@ -141,3 +141,4 @@ #endif #endif + Modified: dcplusplus/trunk/boost/boost/numeric/interval/detail/ppc_rounding_control.hpp =================================================================== --- dcplusplus/trunk/boost/boost/numeric/interval/detail/ppc_rounding_control.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/numeric/interval/detail/ppc_rounding_control.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -51,10 +51,14 @@ } // namespace detail +// Do not declare the following C99 symbols if <math.h> provides them. +// Otherwise, conflicts may occur, due to differences between prototypes. +#if !defined(_ISOC99_SOURCE) && !defined(__USE_ISOC99) extern "C" { float rintf(float); double rint(double); } +#endif template<> struct rounding_control<float>: Modified: dcplusplus/trunk/boost/boost/operators.hpp =================================================================== --- dcplusplus/trunk/boost/boost/operators.hpp 2007-12-20 10:02:19 UTC (rev 947) +++ dcplusplus/trunk/boost/boost/operators.hpp 2007-12-22 22:38:16 UTC (rev 948) @@ -8,6 +8,8 @@ // See http://www.boost.org/libs/utility/operators.htm for documentation. // Revision History +// 24 May 07 Changed empty_base to depend on T, see +// http://svn.boost.org/trac/boost/ticket/979 // 21 Oct 02 Modified implementation of operators to allow compilers with a // correct named return value optimization (NRVO) to produce optimal // code. (Daniel Frey) @@ -90,15 +92,15 @@ namespace boost { namespace detail { +template <typename T> class empty_base { + // Helmut Zeisel, empty base class optimization bug with GCC 3.0.0 #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0 -class empty_base { bool dummy; -}; -#else -class empty_base {}; #endif +}; + } // namespace detail } // namespace boost @@ -119,7 +121,7 @@ // Note that friend functions defined in a class are implicitly inline. // See the C++ std, 11.4 [class.friend] paragraph 5 -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct less_than_comparable2 : B { friend bool operator<=(const T& x, const U& y) { return !(x > y); } @@ -130,7 +132,7 @@ friend bool operator>=(const U& x, const T& y) { return !(y > x); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct less_than_comparable1 : B { friend bool operator>(const T& x, const T& y) { return y < x; } @@ -138,7 +140,7 @@ friend bool operator>=(const T& x, const T& y) { return !(x < y); } }; -template <class T, class U, class B = ::boost::detail::empty_base> +template <class T, class U, class B = ::boost::detail::empty_base<T> > struct equality_comparable2 : B { friend bool operator==(const U& y, const T& x) { return x == y; } @@ -146,7 +148,7 @@ friend bool operator!=(const T& y, const U& x) { return !(y == x); } }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct equality_comparable1 : B { friend bool operator!=(const T& x, const T& y) { return !(x == y); } @@ -165,7 +167,7 @@ // implementation available. #define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ @@ -174,33 +176,33 @@ { T nrv( rhs ); nrv OP##= lhs; return nrv; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; -#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct NAME##2 : B \ -{ \ - friend T operator OP( const T& lhs, const U& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct BOOST_OPERATOR2_LEFT(NAME) : B \ -{ \ - friend T operator OP( const U& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ -}; \ - \ -template <class T, class B = ::boost::detail::empty_base> \ -struct NAME##1 : B \ -{ \ - friend T operator OP( const T& lhs, const T& rhs ) \ - { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( const T& lhs, const U& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct BOOST_OPERATOR2_LEFT(NAME) : B \ +{ \ + friend T operator OP( const U& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ +}; \ + \ +template <class T, class B = ::boost::detail::empty_base<T> > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( const T& lhs, const T& rhs ) \ + { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) @@ -210,35 +212,35 @@ // BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide // optimization opportunities to the compiler :) -#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ -struct NAME##2 : B \ -{ \ - friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ - friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ -}; \ - \ -template <class T, class B = ::boost::detail::empty_base> \ -struct NAME##1 : B \ -{ \ - friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ +#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP ) \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ +struct NAME##2 : B \ +{ \ + friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ + friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; } \ +}; \ + \ +template <class T, class B = ::boost::detail::empty_base<T> > \ +struct NAME##1 : B \ +{ \ + friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ }; #define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct BOOST_OPERATOR2_LEFT(NAME) : B \ { \ friend T operator OP( const U& lhs, const T& rhs ) \ { return T( lhs ) OP##= rhs; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \ @@ -261,7 +263,7 @@ // incrementable and decrementable contributed by Jeremy Siek -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct incrementable : B { friend T operator++(T& x, int) @@ -274,7 +276,7 @@ typedef T incrementable_type; }; -template <class T, class B = ::boost::detail::empty_base> +template <class T, class B = ::boost::detail::empty_base<T> > struct decrementable : B { friend T operator--(T& x, int) @@ -289,7 +291,7 @@ // Iterator operator classes (contributed by Jeremy Siek) ------------------// -template <class T, class P, class B = ::boost::detail::empty_base> +template <class T, class P, class B = ::boost::detail::empty_base<T> > struct dereferenceable : B { P operator->() const @@ -298,7 +300,7 @@ } }; -template <class T, class I, class R, class B = ::boost::detail::empty_base> +template <class T, class I, class R, class B = ::boost::detail::empty_base<T> > struct indexable : B { R operator[](I n) const @@ -313,14 +315,14 @@ #if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( const T& lhs, const U& rhs ) \ { T nrv( lhs ); nrv OP##= rhs; return nrv; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( const T& lhs, const T& rhs ) \ @@ -330,13 +332,13 @@ #else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS) #define BOOST_BINARY_OPERATOR( NAME, OP ) \ -template <class T, class U, class B = ::boost::detail::empty_base> \ +template <class T, class U, class B = ::boost::detail::empty_base<T> > \ struct NAME##2 : B \ { \ friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \ }; \ \ -template <class T, class B = ::boost::detail::empty_base> \ +template <class T, class B = ::boost::detail::empty_base<T> > \ struct NAME##1 : B \ { \ friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \... [truncated message content] |
From: <arn...@us...> - 2007-12-22 22:18:14
|
Revision: 109 http://adchpp.svn.sourceforge.net/adchpp/?rev=109&view=rev Author: arnetheduck Date: 2007-12-22 14:18:06 -0800 (Sat, 22 Dec 2007) Log Message: ----------- Update docs, fix some minor issues Modified Paths: -------------- adchpp/trunk/License.txt adchpp/trunk/SConstruct adchpp/trunk/adchpp/PluginManager.h adchpp/trunk/adchpp/SettingsManager.h adchpp/trunk/adchpp/version.cpp adchpp/trunk/changelog.txt adchpp/trunk/etc/Script.xml adchpp/trunk/etc/adchpp.xml adchpp/trunk/plugins/Script/examples/access.lua adchpp/trunk/plugins/Script/src/ScriptManager.cpp adchpp/trunk/readme.txt adchpp/trunk/unix/main.cpp adchpp/trunk/unix/po/adchppd.pot Modified: adchpp/trunk/License.txt =================================================================== --- adchpp/trunk/License.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/License.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,5 +1,5 @@ adchpp -Copyright (C) 2006 Jacek Sieka, arnetheduck on gmail point com +Copyright (C) 2006-2007 Jacek Sieka, arnetheduck on gmail point com Here follows the full text of the GPL-2: Modified: adchpp/trunk/SConstruct =================================================================== --- adchpp/trunk/SConstruct 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/SConstruct 2007-12-22 22:18:06 UTC (rev 109) @@ -117,7 +117,6 @@ if env['savetemps'] and 'gcc' in env['TOOLS']: env.Append(CCFLAGS = ['-save-temps', '-fverbose-asm']) - if env['CC'] == 'cl': flags = msvc_flags xxflags = msvc_xxflags Modified: adchpp/trunk/adchpp/PluginManager.h =================================================================== --- adchpp/trunk/adchpp/PluginManager.h 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/PluginManager.h 2007-12-22 22:18:06 UTC (rev 109) @@ -205,7 +205,7 @@ } /** @internal */ void shutdown(); - + private: virtual ~PluginManager() throw(); Modified: adchpp/trunk/adchpp/SettingsManager.h =================================================================== --- adchpp/trunk/adchpp/SettingsManager.h 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/SettingsManager.h 2007-12-22 22:18:06 UTC (rev 109) @@ -89,7 +89,7 @@ void set(IntSetting key, bool value) { set(key, (int)value); } void load() { - load(Util::getCfgPath() + _T("adchpp.xml")); + load(Util::getCfgPath() + "adchpp.xml"); } void load(const std::string& aFileName); Modified: adchpp/trunk/adchpp/version.cpp =================================================================== --- adchpp/trunk/adchpp/version.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/adchpp/version.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -18,7 +18,7 @@ #define BUILDSTRING "Release" #endif -#define FULLVERSIONSTRING APPNAME " v" VERSIONSTRING "-" BUILDSTRING +#define FULLVERSIONSTRING APPNAME " v" VERSIONSTRING " " BUILDSTRING namespace adchpp { Modified: adchpp/trunk/changelog.txt =================================================================== --- adchpp/trunk/changelog.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/changelog.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,3 +1,2 @@ --- 2.0 -- -* Initial release - +-- 2.1 -- + * Initial ADC 1.0 release \ No newline at end of file Modified: adchpp/trunk/etc/Script.xml =================================================================== --- adchpp/trunk/etc/Script.xml 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/etc/Script.xml 2007-12-22 22:18:06 UTC (rev 109) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <ScriptPlugin> - <Engine scriptPath="Scripts/"> + <Engine language="lua" scriptPath="Scripts/"> <Script>access.lua</Script> </Engine> </ScriptPlugin> Modified: adchpp/trunk/etc/adchpp.xml =================================================================== --- adchpp/trunk/etc/adchpp.xml 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/etc/adchpp.xml 2007-12-22 22:18:06 UTC (rev 109) @@ -6,7 +6,7 @@ <!-- This is the name of the hub as it should be reported to the clients during login and to the hub registration services. --> <HubName type="string">ADCH++</HubName> - <Description>ADCH++ Test hub</Description> + <Description type="string">ADCH++ Test hub</Description> <!-- Logging --> <!-- Enable/disable logging --> Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-22 22:18:06 UTC (rev 109) @@ -6,10 +6,16 @@ adchpp = luadchpp -- Configuration + +-- Where to read/write user database local users_file = adchpp.Util_getCfgPath() .. "users.txt" +-- Maximum number of non-registered users, -1 = no limit, 0 = no unregistered users allowed +local max_users = -1 + +-- Users with level lower than the specified will not be allowed to run command at all local command_min_levels = { --- [adchpp.CMD_DSC] = 2 +-- [adchpp.AdcCommand.CMD_MSG] = 2 } -- Regexes for the various fields. @@ -159,10 +165,13 @@ end local function dump(c, code, msg) + print("dumping") + print(code) + print(msg) answer = adchpp.AdcCommand(adchpp.AdcCommand_CMD_STA, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) answer:addParam("" .. tostring(adchpp.AdcCommand_SEV_FATAL) .. code):addParam(msg) c:send(answer) - c:disconnect() + c:disconnect(0) end local function reply(c, msg) @@ -171,6 +180,23 @@ c:send(answer) end +local function check_max_users() + + if max_users == -1 then + return + end + + if max_users == 0 then + return adchpp.AdcCommand_ERROR_REGGED_ONLY, "Only registered users are allowed in here" + end + + local count = cm:getClients():size() + if count >= max_users then + return adchpp.AdcCommand_ERROR_HUB_FULL, "Hub full, please try again later" + end + return +end + local function get_user(cid, nick) local user if cid then @@ -291,6 +317,11 @@ local user = get_user(cid, nick) if not user then + local code, err = check_max_users() + if code then + dump(c, code, err) + return command_processed + end return 0 end Modified: adchpp/trunk/plugins/Script/src/ScriptManager.cpp =================================================================== --- adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/plugins/Script/src/ScriptManager.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -62,9 +62,15 @@ xml.fromXML(File(Util::getCfgPath() + "Script.xml", File::READ).read()); xml.stepIn(); while(xml.findChild("Engine")) { - std::string scriptPath = xml.getChildAttrib("scriptPath"); + const std::string& scriptPath = xml.getChildAttrib("scriptPath"); + const std::string& language = xml.getChildAttrib("language"); - engines.push_back(new LuaEngine); + if(language.empty() || language == "lua") { + engines.push_back(new LuaEngine); + } else { + LOG(className, "Unrecognised language " + language); + continue; + } xml.stepIn(); while(xml.findChild("Script")) { @@ -84,7 +90,6 @@ load(); } - void ScriptManager::onReceive(Client& c, AdcCommand& cmd, int& override) { if(cmd.getCommand() != AdcCommand::CMD_MSG) { Modified: adchpp/trunk/readme.txt =================================================================== --- adchpp/trunk/readme.txt 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/readme.txt 2007-12-22 22:18:06 UTC (rev 109) @@ -1,59 +1,98 @@ --- License -- -See license.txt - --- Introduction -- - -ADCH++ is a hub for the ADC network. It implements the ADC protocol, which can -be found here: http://dcplusplus.sf.net/ADC.html. - --- Requirements -- - -Win2k/XP/2k3 (may run on NT4 with a fresh service pack as well...don't know). -or -Linux 2.6.x - -A network card with a correctly configured TCP/IP stack. -A computer that can run the above mentioned OS. -An administrator/root account (to install as service / run on port < 1024 on unix). -A brain (to understand the readme and setup) -gcc 4.2+ (linux or mingw) -scons (http://www.scons.org) -swig 1.3.33 - -** Important!! The hub will _NOT_ run on Win9x/ME. ** - -On the client side, I've only tested with DC++. - --- Building -- -Install swig and scons. Ensure that your compiler is available in the -PATH. To build with gcc (*nix, mingw), run "scons" in the adchpp root folder. -To build with msvc (windows), run "scons tools=default" in the adchpp root -folder. To build a release build, add "mode=release" to the build line. -For additional build options, type "scons -h". - --- Command line options -- - --c <configdir> Run with an alternate config directoy. Must be an absolute path. --i <name> Install the hub service to enable running as a service. * Windows only * --u <name> Remove the service you created earlier. * Windows only * --v Print version information (make sure to include this in any bug reports) --d Run as a daemon. Kill with a standard sigterm. * Linux only * --p <pid-file> Write process pid to <pid-file> * Linux only * - --- Where to find more info -- - -Try http://adchpp.sf.net/ or http://dcpp.net/forum/. - --- Send in patches -- -I'll gladly accept patches, but in order to avoid future licensing issues, I ask you to -give me copyright over any submitted code. Make sure that the code doesn't break support -for any of the platforms supported and that it looks more or less like the rest of the -code (indent, names etc). -Please use unified patches agains latest svn trunk (i e svn diff or diff -u). - --- Donate money -- - -If you feel like helping out but don't know how, this is obviously a good way =)...paste this link in your -browser (goes to paypal): - -https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8 += ADCH++ - A hub software for ADC + +== Introduction + +ADCH++ is a hub for the ADC network. It implements the +http://dcplusplus.sf.net/ADC.html[ADC protocol]. The core application is very +simple, but extensible using plugins. Among the standard plugins there is a +scripting plugin that allows hub owners to further customize the hub using the +http://www.lua.org[Lua] scripting language. The core is also exposed as a +Python module, thus it is possible to use it within a Python application. + +== License +ADCH++ is licensed under the GPL. For details, see license.txt supplied with +the application. A side effect of the license is that any plugins you write +must be released under a license compatible with the GPL. + +== Download +The latest version of ADCH++ can be downloaded from +http://sourceforge.net/projects/adchpp/[SourceForge]. The source code resides +in http://sourceforge.net/svn/?group_id=172105[SVN]. + +== Requirements +To run ADCH++ you will need the following: + +* A computer with a network card +* Linux with a 2.6-based kernel or Windows 2000/XP +* A brain (to understand the readme and do the setup) +* Optional: An administrator account (to install as service / run on port < 1024 on + unix) + +NOTE: The hub will not run on Windows 9x/ME + +To compile the sources you will also need: + +* GCC 4.2+ (Linux or http://www.mingw.org[MinGW]) +* http://www.scons.org[SCons 0.97] +* http://www.swig.org[SWIG 1.3.33] +* http://www.python.org[Python] 2.5 (Windows) or 2.4+ (Linux) + +== Building +To build ADCH++ from source you have to: + +* Install SWIG and ensure it's in your PATH +* Install Python and ensure it's in your PATH +* Install SCons and ensure it's in your PATH +* Windows: Install MinGW and ensure it's in your PATH +* Linux: Install GCC 4.2+ and appropriate header files +* In the source folder, type "scons -h" to see additional compile options +* Type "scons" to create a debug build. "scons mode=release" will create a + release build. + +== Configuration +ADCH++ is configured using an XML file, as are the standard plugins. The +example configuration contains enough comments to get you started. In Linux, +the default location for configuration files is "/etc/adchpp/". In Windows, it's +a directory named "config" under the installation directory. + +== Running +ADCH++ will normally run as a console / terminal application but can also be +convinced to run in the background (daemon/service). It accepts various +command line options such as: + +[separator="|"] +``_ +-c <configdir> | Run with an alternate config directoy. Must be an absolute path. +-i <name> | Install the hub service to enable running as a service. * Windows only * +-u <name> | Remove the service you created earlier. * Windows only * +-v | Print version information (make sure to include this in any bug reports) +-d | Run as a daemon. Kill with a standard sigterm. * Linux only * +-p <pid-file> | Write process pid to <pid-file> * Linux only * +___ + +== Where to find more info +Try its http://adchpp.sf.net/[home page] or the +http://dcplusplus.sf.net/[DC++ home page]. + +== Patches and contributions +I'll gladly accept patches, but in order to avoid future licensing issues, I ask you to +give me copyright over any submitted code. Make sure that the code doesn't break support +for any of the platforms supported and that it looks more or less like the +rest of the code (indent, names etc). + +Patches should be sent to the dcplusplus-devel mailing list. Subscription +information can be found +https://lists.sourceforge.net/lists/listinfo/dcplusplus-devel[here]. + +Please use unified patches agains latest svn trunk (i e svn diff) and supply a +description of what the patch does. + +== Donations + +If you feel like helping out but don't know how, this is obviously a good way +=) + +https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8[Donate!] + +// vim: set syntax=asciidoc: + Modified: adchpp/trunk/unix/main.cpp =================================================================== --- adchpp/trunk/unix/main.cpp 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/unix/main.cpp 2007-12-22 22:18:06 UTC (rev 109) @@ -168,7 +168,6 @@ int main(int argc, char* argv[]) { - // IMHO, argv[0] is the program name... char buf[PATH_MAX + 1]; char* path = buf; if (readlink("/proc/self/exe", buf, sizeof (buf)) == -1) { Modified: adchpp/trunk/unix/po/adchppd.pot =================================================================== --- adchpp/trunk/unix/po/adchppd.pot 2007-12-20 09:53:30 UTC (rev 108) +++ adchpp/trunk/unix/po/adchppd.pot 2007-12-22 22:18:06 UTC (rev 109) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \"adchpp\"--copyright-holder=\"Jacek Sieka\"\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-12-09 20:22+0100\n" +"POT-Creation-Date: 2007-12-22 23:02+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL...@li...>\n" @@ -45,27 +45,27 @@ msgid "Usage: adchpp [[-c <configdir>] [-d]] | [-v] | [-h]\n" msgstr "" -#: unix/main.cpp:189 +#: unix/main.cpp:188 #, c-format msgid "-c <directory>\n" msgstr "" -#: unix/main.cpp:195 +#: unix/main.cpp:194 #, c-format msgid "Config dir must be an absolute path\n" msgstr "" -#: unix/main.cpp:204 +#: unix/main.cpp:203 #, c-format msgid "-p <pid-file>\n" msgstr "" -#: unix/main.cpp:213 +#: unix/main.cpp:212 #, c-format msgid "Unknown parameter: %s\n" msgstr "" -#: unix/main.cpp:222 +#: unix/main.cpp:221 #, c-format msgid "Can't open %s for writing\n" msgstr "" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-20 10:02:21
|
Revision: 947 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=947&view=rev Author: arnetheduck Date: 2007-12-20 02:02:19 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Bloom fixes Modified Paths: -------------- dcplusplus/trunk/dcpp/HashBloom.cpp Modified: dcplusplus/trunk/dcpp/HashBloom.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.cpp 2007-12-17 23:14:47 UTC (rev 946) +++ dcplusplus/trunk/dcpp/HashBloom.cpp 2007-12-20 10:02:19 UTC (rev 947) @@ -6,14 +6,10 @@ namespace dcpp { size_t HashBloom::get_k(size_t n) { - const size_t bits = TTHValue::SIZE * 8; - for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) { - // We only want the k's where the bits will end up on a byte boundary to ease hash implementation - if((bits % k) == 0 && (bits / k) % 8 == 0) { - uint64_t m = get_m(n, k); - if(m >> (TTHValue::SIZE * 8 / k) == 0) { - return k; - } + for(size_t k = TTHValue::SIZE/3; k > 1; --k) { + uint64_t m = get_m(n, k); + if(m >> 24 == 0) { + return k; } } return 1; @@ -32,7 +28,7 @@ bool HashBloom::match(const TTHValue& tth) const { if(bloom.empty()) { - return true; + return false; } for(size_t i = 0; i < k; ++i) { if(!bloom[pos(tth, i)]) { @@ -52,17 +48,21 @@ } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - return (*(size_t*)(tth.data + (TTHValue::SIZE / k) * n )) % bloom.size(); + uint32_t x = 0; + for(size_t i = n*3; i < TTHValue::SIZE; i += 3*k) { + x ^= static_cast<uint32_t>(tth.data[i]) << 2*8; + x ^= static_cast<uint32_t>(tth.data[i+1]) << 8; + x ^= static_cast<uint32_t>(tth.data[i+2]); + } + + return x % bloom.size(); } void HashBloom::copy_to(ByteVector& v) const { - size_t ones = 0; v.resize(bloom.size() / 8); for(size_t i = 0; i < bloom.size(); ++i) { - ones += bloom[i]; - v[i/8] |= bloom[i] << i % 8; + v[i/8] |= bloom[i] << (i % 8); } - dcdebug("Bloom fill: %u/%u = %lf\n", ones, bloom.size(), static_cast<double>(ones)/bloom.size()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-20 09:53:34
|
Revision: 108 http://adchpp.svn.sourceforge.net/adchpp/?rev=108&view=rev Author: arnetheduck Date: 2007-12-20 01:53:30 -0800 (Thu, 20 Dec 2007) Log Message: ----------- Bloom manager fixes, version display format Modified Paths: -------------- adchpp/trunk/adchpp/version.cpp adchpp/trunk/plugins/Bloom/src/BloomManager.cpp adchpp/trunk/plugins/Bloom/src/HashBloom.cpp Modified: adchpp/trunk/adchpp/version.cpp =================================================================== --- adchpp/trunk/adchpp/version.cpp 2007-12-19 09:35:58 UTC (rev 107) +++ adchpp/trunk/adchpp/version.cpp 2007-12-20 09:53:30 UTC (rev 108) @@ -9,8 +9,8 @@ #define strver(s) #s #define APPNAME "ADCH++" -#define VERSIONSTRING "2.0." xstrver(ADCHPP_REVISION) -#define VERSIONFLOAT 2.0 +#define VERSIONSTRING "2.1.0 (r" xstrver(ADCHPP_REVISION) ")" +#define VERSIONFLOAT 2.1 #ifndef NDEBUG #define BUILDSTRING "Debug" @@ -27,5 +27,5 @@ string appName = APPNAME; string versionString = FULLVERSIONSTRING; float versionFloat = VERSIONFLOAT; - + } Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-19 09:35:58 UTC (rev 107) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-20 09:53:30 UTC (rev 108) @@ -57,7 +57,7 @@ size_t k = HashBloom::get_k(n); size_t m = HashBloom::get_m(n, k); - HashBloom bloom = blooms[c.getCID()]; + HashBloom& bloom = blooms[c.getCID()]; bloom.reset(k); @@ -95,7 +95,7 @@ HashBloom& bloom = blooms[c.getCID()]; for(size_t i = 0; i < len; ++i) { for(size_t j = 0; j < 8; ++j) { - bloom.push_back(data[i] & 1 << j); + bloom.push_back(data[i] & (1 << j)); } } } Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-19 09:35:58 UTC (rev 107) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-20 09:53:30 UTC (rev 108) @@ -2,14 +2,10 @@ #include "HashBloom.h" size_t HashBloom::get_k(size_t n) { - const size_t bits = TTHValue::SIZE * 8; - for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) { - // We only want the k's where the bits will end up on a byte boundary to ease hash implementation - if((bits % k) == 0 && (bits / k) % 8 == 0) { - uint64_t m = get_m(n, k); - if(m >> (TTHValue::SIZE * 8 / k) == 0) { - return k; - } + for(size_t k = TTHValue::SIZE/3; k > 1; --k) { + uint64_t m = get_m(n, k); + if(m >> 24 == 0) { + return k; } } return 1; @@ -29,13 +25,15 @@ bool HashBloom::match(const TTHValue& tth) const { if(bloom.empty()) { - return true; + return false; } for(size_t i = 0; i < k; ++i) { if(!bloom[pos(tth, i)]) { + printf("no match\n"); return false; } } + printf("match\n"); return true; } @@ -49,6 +47,12 @@ } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { - return (*(size_t*)(tth.data + (TTHValue::SIZE / k) * n)) % bloom.size(); + uint32_t x = 0; + for(size_t i = n*3; i < TTHValue::SIZE; i += 3*k) { + x ^= static_cast<uint32_t>(tth.data[i]) << 2*8; + x ^= static_cast<uint32_t>(tth.data[i+1]) << 8; + x ^= static_cast<uint32_t>(tth.data[i+2]); + } + return x % bloom.size(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-19 09:36:00
|
Revision: 107 http://adchpp.svn.sourceforge.net/adchpp/?rev=107&view=rev Author: arnetheduck Date: 2007-12-19 01:35:58 -0800 (Wed, 19 Dec 2007) Log Message: ----------- Fix k assignment error Modified Paths: -------------- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-17 23:13:35 UTC (rev 106) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-19 09:35:58 UTC (rev 107) @@ -1,7 +1,6 @@ #include "stdinc.h" #include "HashBloom.h" - size_t HashBloom::get_k(size_t n) { const size_t bits = TTHValue::SIZE * 8; for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) { @@ -18,7 +17,8 @@ uint64_t HashBloom::get_m(size_t n, size_t k) { uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.)))); - return ((m / 8) + 1) * 8; + // 64-bit boundary allows us to use a bitset based on uint64_t's + return ((m / 64) + 1) * 64; } void HashBloom::add(const TTHValue& tth) { @@ -45,7 +45,7 @@ void HashBloom::reset(size_t k_) { bloom.resize(0); - k = k; + k = k_; } size_t HashBloom::pos(const TTHValue& tth, size_t n) const { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-17 23:14:50
|
Revision: 946 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=946&view=rev Author: arnetheduck Date: 2007-12-17 15:14:47 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Patches, initial hub-side bloom filter support Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/AdcHub.cpp dcplusplus/trunk/dcpp/AdcHub.h dcplusplus/trunk/dcpp/BitOutputStream.h dcplusplus/trunk/dcpp/BloomFilter.h dcplusplus/trunk/dcpp/BufferedSocket.cpp dcplusplus/trunk/dcpp/BufferedSocket.h dcplusplus/trunk/dcpp/CID.h dcplusplus/trunk/dcpp/ClientManager.cpp dcplusplus/trunk/dcpp/ClientManager.h dcplusplus/trunk/dcpp/DCPlusPlus.h dcplusplus/trunk/dcpp/DirectoryListing.h dcplusplus/trunk/dcpp/FavoriteManager.h dcplusplus/trunk/dcpp/File.h dcplusplus/trunk/dcpp/HashManager.h dcplusplus/trunk/dcpp/HashValue.h dcplusplus/trunk/dcpp/MerkleTree.h dcplusplus/trunk/dcpp/NmdcHub.cpp dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/QueueManager.h dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/ShareManager.h dcplusplus/trunk/dcpp/Socket.cpp dcplusplus/trunk/win32/AboutDlg.cpp Added Paths: ----------- dcplusplus/trunk/dcpp/HashBloom.cpp dcplusplus/trunk/dcpp/HashBloom.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/changelog.txt 2007-12-17 23:14:47 UTC (rev 946) @@ -1,5 +1,7 @@ -- 0.705 -- * Several patches for better *nix compatibility of the core (thanks steven sheehy et al) +* Improve segmented download file sharing +* Fix search request ip when using multiple ip's (thanks stanislav maslovski) -- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) Modified: dcplusplus/trunk/dcpp/AdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/AdcHub.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -44,6 +44,7 @@ const string AdcHub::BAS0_SUPPORT("ADBAS0"); const string AdcHub::TIGR_SUPPORT("ADTIGR"); const string AdcHub::UCM0_SUPPORT("ADUCM0"); +const string AdcHub::BLO0_SUPPORT("ADBLO0"); AdcHub::AdcHub(const string& aHubURL, bool secure) : Client(aHubURL, '\n', secure), oldPassword(false), sid(0) { TimerManager::getInstance()->addListener(this); @@ -476,6 +477,31 @@ SearchManager::getInstance()->onRES(c, ou->getUser()); } +void AdcHub::handle(AdcCommand::GET, AdcCommand& c) throw() { + if(c.getParameters().size() < 5) { + dcdebug("Get with few parameters"); + // TODO return STA? + return; + } + const string& type = c.getParam(0); + string tmp; + if(type == "blom" && c.getParam("BK", 4, tmp)) { + ByteVector v; + size_t m = Util::toUInt32(c.getParam(3)) * 8; + size_t k = Util::toUInt32(tmp); + + ShareManager::getInstance()->getBloom(v, k, m); + AdcCommand cmd(AdcCommand::CMD_SND, AdcCommand::TYPE_HUB); + cmd.addParam(c.getParam(0)); + cmd.addParam(c.getParam(1)); + cmd.addParam(c.getParam(2)); + cmd.addParam(c.getParam(3)); + cmd.addParam(c.getParam(4)); + send(cmd); + send((char*)&v[0], v.size()); + } +} + void AdcHub::connect(const OnlineUser& user, const string& token) { connect(user, token, CryptoManager::getInstance()->TLSOk() && user.getUser()->isSet(User::TLS)); } @@ -699,6 +725,9 @@ if(BOOLSETTING(HUB_USER_COMMANDS)) { cmd.addParam(UCM0_SUPPORT); } + if(BOOLSETTING(SEND_BLOOM)) { + cmd.addParam(BLO0_SUPPORT); + } send(cmd); } Modified: dcplusplus/trunk/dcpp/AdcHub.h =================================================================== --- dcplusplus/trunk/dcpp/AdcHub.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/AdcHub.h 2007-12-17 23:14:47 UTC (rev 946) @@ -83,7 +83,8 @@ static const string BAS0_SUPPORT; static const string TIGR_SUPPORT; static const string UCM0_SUPPORT; - + static const string BLO0_SUPPORT; + virtual string checkNick(const string& nick); OnlineUser& getUser(const uint32_t aSID, const CID& aCID); @@ -105,6 +106,7 @@ void handle(AdcCommand::SCH, AdcCommand& c) throw(); void handle(AdcCommand::CMD, AdcCommand& c) throw(); void handle(AdcCommand::RES, AdcCommand& c) throw(); + void handle(AdcCommand::GET, AdcCommand& c) throw(); template<typename T> void handle(T, AdcCommand&) { } Modified: dcplusplus/trunk/dcpp/BitOutputStream.h =================================================================== --- dcplusplus/trunk/dcpp/BitOutputStream.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/BitOutputStream.h 2007-12-17 23:14:47 UTC (rev 946) @@ -27,8 +27,8 @@ BitOutputStream(string& aStream) : is(aStream), bitPos(0), next(0) { } ~BitOutputStream() { } - void put(vector<uint8_t>& b) { - for(vector<uint8_t>::iterator i = b.begin(); i != b.end(); ++i) { + void put(const ByteVector& b) { + for(ByteVector::const_iterator i = b.begin(); i != b.end(); ++i) { next |= (*i) << bitPos++; if(bitPos > 7) { Modified: dcplusplus/trunk/dcpp/BloomFilter.h =================================================================== --- dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/BloomFilter.h 2007-12-17 23:14:47 UTC (rev 946) @@ -23,13 +23,7 @@ namespace dcpp { -struct CRC32Hash { - size_t operator()(const void* buf, size_t len) { f(buf, len); return f.getValue(); } -private: - CRC32Filter f; -}; - -template<size_t N, class HashFunc = CRC32Hash> +template<size_t N> class BloomFilter { public: BloomFilter(size_t tableSize) { table.resize(tableSize); } @@ -79,10 +73,15 @@ } } - /* Same functionality, but the old one did not want to compile for some reason. */ + /* This is roughly how boost::hash does it */ size_t getPos(const string& s, size_t i, size_t l) const { - HashFunc hf; - return (hf(&s[i], l) % table.size()); + size_t h = 0; + const char* c = s.data() + i; + const char* end = s.data() + l; + for(; c < end; ++c) { + h ^= *c + 0x9e3779b9 + (h<<6) + (h>>2); + } + return (h % table.size()); } vector<bool> table; Modified: dcplusplus/trunk/dcpp/BufferedSocket.cpp =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/BufferedSocket.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -273,8 +273,8 @@ size_t sockSize = (size_t)sock->getSocketOptInt(SO_SNDBUF); size_t bufSize = max(sockSize, (size_t)64*1024); - vector<uint8_t> readBuf(bufSize); - vector<uint8_t> writeBuf(bufSize); + ByteVector readBuf(bufSize); + ByteVector writeBuf(bufSize); size_t readPos = 0; Modified: dcplusplus/trunk/dcpp/BufferedSocket.h =================================================================== --- dcplusplus/trunk/dcpp/BufferedSocket.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/BufferedSocket.h 2007-12-17 23:14:47 UTC (rev 946) @@ -130,9 +130,9 @@ size_t rollback; bool failed; string line; - vector<uint8_t> inbuf; - vector<uint8_t> writeBuf; - vector<uint8_t> sendBuf; + ByteVector inbuf; + ByteVector writeBuf; + ByteVector sendBuf; Socket* sock; bool disconnecting; Modified: dcplusplus/trunk/dcpp/CID.h =================================================================== --- dcplusplus/trunk/dcpp/CID.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/CID.h 2007-12-17 23:14:47 UTC (rev 946) @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(CID_H) -#define CID_H +#ifndef DCPLUSPLUS_DCPP_CID_H +#define DCPLUSPLUS_DCPP_CID_H #include "Encoder.h" #include "Util.h" @@ -28,9 +28,6 @@ public: enum { SIZE = 192 / 8 }; - struct Hash { - size_t operator()(const CID& c) const { return c.toHash(); } - }; CID() { memset(cid, 0, sizeof(cid)); } explicit CID(const uint8_t* data) { memcpy(cid, data, sizeof(cid)); } explicit CID(const string& base32) { Encoder::fromBase32(base32.c_str(), cid, sizeof(cid)); } @@ -60,4 +57,14 @@ } // namespace dcpp +namespace std { namespace tr1 { +template<> +struct hash<dcpp::CID> { + size_t operator()(const dcpp::CID& rhs) const { + return *reinterpret_cast<const size_t*>(rhs.data()); + } +}; +} +} + #endif // !defined(CID_H) Modified: dcplusplus/trunk/dcpp/ClientManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/ClientManager.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -409,8 +409,6 @@ void ClientManager::search(int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Lock l(cs); - updateCachedIp(); // no point in doing a resolve for every single hub we're searching on - for(Client::Iter i = clients.begin(); i != clients.end(); ++i) { if((*i)->isConnected()) { (*i)->search(aSizeMode, aSize, aFileType, aString, aToken); @@ -421,8 +419,6 @@ void ClientManager::search(StringList& who, int aSizeMode, int64_t aSize, int aFileType, const string& aString, const string& aToken) { Lock l(cs); - updateCachedIp(); // no point in doing a resolve for every single hub we're searching on - for(StringIter it = who.begin(); it != who.end(); ++it) { string& client = *it; for(Client::Iter j = clients.begin(); j != clients.end(); ++j) { @@ -493,25 +489,4 @@ } } -void ClientManager::updateCachedIp() { - // Best case - the server detected it - if((!BOOLSETTING(NO_IP_OVERRIDE) || SETTING(EXTERNAL_IP).empty())) { - for(Client::Iter i = clients.begin(); i != clients.end(); ++i) { - if(!(*i)->getMyIdentity().getIp().empty()) { - cachedIp = (*i)->getMyIdentity().getIp(); - return; - } - } - } - - if(!SETTING(EXTERNAL_IP).empty()) { - cachedIp = Socket::resolve(SETTING(EXTERNAL_IP)); - return; - } - - //if we've come this far just use the first client to get the ip. - if(clients.size() > 0) - cachedIp = (*clients.begin())->getLocalIp(); -} - } // namespace dcpp Modified: dcplusplus/trunk/dcpp/ClientManager.h =================================================================== --- dcplusplus/trunk/dcpp/ClientManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/ClientManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -91,8 +91,6 @@ Client::List& getClients() { return clients; } - string getCachedIp() const { Lock l(cs); return cachedIp; } - CID getMyCID(); const CID& getMyPID(); @@ -100,10 +98,10 @@ typedef unordered_map<string, UserPtr> LegacyMap; typedef LegacyMap::iterator LegacyIter; - typedef unordered_map<CID, UserPtr, CID::Hash> UserMap; + typedef unordered_map<CID, UserPtr> UserMap; typedef UserMap::iterator UserIter; - typedef unordered_multimap<CID, OnlineUser*, CID::Hash> OnlineMap; + typedef unordered_multimap<CID, OnlineUser*> OnlineMap; typedef OnlineMap::iterator OnlineIter; typedef OnlineMap::const_iterator OnlineIterC; typedef pair<OnlineIter, OnlineIter> OnlinePair; @@ -119,7 +117,6 @@ Socket udp; - string cachedIp; CID pid; friend class Singleton<ClientManager>; @@ -132,8 +129,6 @@ TimerManager::getInstance()->removeListener(this); } - void updateCachedIp(); - // ClientListener virtual void on(Connected, Client* c) throw() { fire(ClientManagerListener::ClientConnected(), c); } virtual void on(UserUpdated, Client*, const OnlineUser& user) throw() { fire(ClientManagerListener::UserUpdated(), user); } Modified: dcplusplus/trunk/dcpp/DCPlusPlus.h =================================================================== --- dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/DCPlusPlus.h 2007-12-17 23:14:47 UTC (rev 946) @@ -97,6 +97,8 @@ typedef vector<WStringPair> WStringPairList; typedef WStringPairList::iterator WStringPairIter; +typedef vector<uint8_t> ByteVector; + #if defined(_MSC_VER) || defined(__MINGW32__) #define _LL(x) x##ll #define _ULL(x) x##ull Modified: dcplusplus/trunk/dcpp/DirectoryListing.h =================================================================== --- dcplusplus/trunk/dcpp/DirectoryListing.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/DirectoryListing.h 2007-12-17 23:14:47 UTC (rev 946) @@ -80,7 +80,7 @@ typedef vector<Ptr> List; typedef List::iterator Iter; - typedef unordered_set<TTHValue, TTHValue::Hash> TTHSet; + typedef unordered_set<TTHValue> TTHSet; List directories; File::List files; Modified: dcplusplus/trunk/dcpp/FavoriteManager.h =================================================================== --- dcplusplus/trunk/dcpp/FavoriteManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/FavoriteManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -59,7 +59,7 @@ bool isDownloading() { return (useHttp && running); } // Favorite Users - typedef unordered_map<CID, FavoriteUser, CID::Hash> FavoriteMap; + typedef unordered_map<CID, FavoriteUser> FavoriteMap; FavoriteMap getFavoriteUsers() { Lock l(cs); return users; } void addFavoriteUser(UserPtr& aUser); Modified: dcplusplus/trunk/dcpp/File.h =================================================================== --- dcplusplus/trunk/dcpp/File.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/File.h 2007-12-17 23:14:47 UTC (rev 946) @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(FILE_H) -#define FILE_H +#ifndef DCPLUSPLUS_DCPP_FILE_H +#define DCPLUSPLUS_DCPP_FILE_H #include "SettingsManager.h" Added: dcplusplus/trunk/dcpp/HashBloom.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.cpp (rev 0) +++ dcplusplus/trunk/dcpp/HashBloom.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -0,0 +1,68 @@ +#include "stdinc.h" +#include "DCPlusPlus.h" + +#include "HashBloom.h" + +namespace dcpp { + +size_t HashBloom::get_k(size_t n) { + const size_t bits = TTHValue::SIZE * 8; + for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) { + // We only want the k's where the bits will end up on a byte boundary to ease hash implementation + if((bits % k) == 0 && (bits / k) % 8 == 0) { + uint64_t m = get_m(n, k); + if(m >> (TTHValue::SIZE * 8 / k) == 0) { + return k; + } + } + } + return 1; +} + +uint64_t HashBloom::get_m(size_t n, size_t k) { + uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.)))); + return ((m / 8) + 1) * 8; +} + +void HashBloom::add(const TTHValue& tth) { + for(size_t i = 0; i < k; ++i) { + bloom[pos(tth, i)] = true; + } +} + +bool HashBloom::match(const TTHValue& tth) const { + if(bloom.empty()) { + return true; + } + for(size_t i = 0; i < k; ++i) { + if(!bloom[pos(tth, i)]) { + return false; + } + } + return true; +} + +void HashBloom::push_back(bool v) { + bloom.push_back(v); +} + +void HashBloom::reset(size_t k_, size_t m) { + bloom.resize(m); + k = k_; +} + +size_t HashBloom::pos(const TTHValue& tth, size_t n) const { + return (*(size_t*)(tth.data + (TTHValue::SIZE / k) * n )) % bloom.size(); +} + +void HashBloom::copy_to(ByteVector& v) const { + size_t ones = 0; + v.resize(bloom.size() / 8); + for(size_t i = 0; i < bloom.size(); ++i) { + ones += bloom[i]; + v[i/8] |= bloom[i] << i % 8; + } + dcdebug("Bloom fill: %u/%u = %lf\n", ones, bloom.size(), static_cast<double>(ones)/bloom.size()); +} + +} Added: dcplusplus/trunk/dcpp/HashBloom.h =================================================================== --- dcplusplus/trunk/dcpp/HashBloom.h (rev 0) +++ dcplusplus/trunk/dcpp/HashBloom.h 2007-12-17 23:14:47 UTC (rev 946) @@ -0,0 +1,40 @@ +#ifndef HASHBLOOM_H_ +#define HASHBLOOM_H_ + +#include "MerkleTree.h" + +namespace dcpp { +/** + * According to http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/BloomFilterSurvey.pdf + * the optimal number of hashes k is (m/n)*ln(2), m = number of bits in the filter and n = number + * of items added. The largest k that we can get from a single TTH value depends on the number of + * bits we need to address the bloom structure, which in turn depends on m, so the optimal size + * for our filter is m = n * k / ln(2) where n is the number of TTH values, or in our case, number of + * files in share since each file is identified by one TTH value. We try that for each even dividend + * of the key size (2, 3, 4, 6, 8, 12) and if m fits within the bits we're able to address (2^(keysize/k)), + * we can use that value when requesting the bloom filter. + */ +class HashBloom { +public: + /** Return the largest k such that get_m returns a value smaller than 2^(TTHValue::SIZE/k) */ + static size_t get_k(size_t n); + /** Optimal number of bits to allocate for n elements when using k hashes */ + static uint64_t get_m(size_t n, size_t k); + + void add(const TTHValue& tth); + bool match(const TTHValue& tth) const; + void reset(size_t k, size_t m); + void push_back(bool v); + + void copy_to(ByteVector& v) const; +private: + + size_t pos(const TTHValue& tth, size_t n) const; + + std::vector<bool> bloom; + size_t k; +}; + +} + +#endif /*HASHBLOOM_H_*/ Modified: dcplusplus/trunk/dcpp/HashManager.h =================================================================== --- dcplusplus/trunk/dcpp/HashManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/HashManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -178,7 +178,7 @@ typedef unordered_map<string, FileInfoList> DirMap; typedef DirMap::iterator DirIter; - typedef unordered_map<TTHValue, TreeInfo, TTHValue::Hash> TreeMap; + typedef unordered_map<TTHValue, TreeInfo> TreeMap; typedef TreeMap::iterator TreeIter; friend class HashLoader; Modified: dcplusplus/trunk/dcpp/HashValue.h =================================================================== --- dcplusplus/trunk/dcpp/HashValue.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/HashValue.h 2007-12-17 23:14:47 UTC (rev 946) @@ -16,10 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(HASH_VALUE_H) -#define HASH_VALUE_H +#ifndef DCPLUSPLUS_DCPP_HASH_VALUE_H +#define DCPLUSPLUS_DCPP_HASH_VALUE_H #include "FastAlloc.h" +#include "Encoder.h" namespace dcpp { @@ -27,25 +28,30 @@ struct HashValue : FastAlloc<HashValue<Hasher> >{ static const size_t SIZE = Hasher::HASH_SIZE; - struct Hash { - size_t operator()(const HashValue& rhs) const { return *(size_t*)&rhs; } - }; - HashValue() { } explicit HashValue(uint8_t* aData) { memcpy(data, aData, SIZE); } - explicit HashValue(const string& base32) { Encoder::fromBase32(base32.c_str(), data, SIZE); } + explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, SIZE); } HashValue(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); } HashValue& operator=(const HashValue& rhs) { memcpy(data, rhs.data, SIZE); return *this; } bool operator!=(const HashValue& rhs) const { return !(*this == rhs); } bool operator==(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) == 0; } bool operator<(const HashValue& rhs) const { return memcmp(data, rhs.data, SIZE) < 0; } - string toBase32() const { return Encoder::toBase32(data, SIZE); } - string& toBase32(string& tmp) const { return Encoder::toBase32(data, SIZE, tmp); } + std::string toBase32() const { return Encoder::toBase32(data, SIZE); } + std::string& toBase32(std::string& tmp) const { return Encoder::toBase32(data, SIZE, tmp); } uint8_t data[SIZE]; }; } // namespace dcpp +namespace std { namespace tr1 { +template<> +template<typename T> +struct hash<dcpp::HashValue<T> > { + size_t operator()(const dcpp::HashValue<T>& rhs) const { return *(size_t*)rhs.data; } +}; +} +} + #endif // !defined(HASH_VALUE_H) Modified: dcplusplus/trunk/dcpp/MerkleTree.h =================================================================== --- dcplusplus/trunk/dcpp/MerkleTree.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/MerkleTree.h 2007-12-17 23:14:47 UTC (rev 946) @@ -146,8 +146,8 @@ root = getHash(0, fileSize); } - vector<uint8_t> getLeafData() { - vector<uint8_t> buf(getLeaves().size() * HASH_SIZE); + ByteVector getLeafData() { + ByteVector buf(getLeaves().size() * HASH_SIZE); uint8_t* p = &buf[0]; for(size_t i = 0; i < getLeaves().size(); ++i) { memcpy(p + i * HASH_SIZE, &getLeaves()[i], HASH_SIZE); Modified: dcplusplus/trunk/dcpp/NmdcHub.cpp =================================================================== --- dcplusplus/trunk/dcpp/NmdcHub.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/NmdcHub.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -238,7 +238,7 @@ // Filter own searches if(ClientManager::getInstance()->isActive()) { - if(seeker == (ClientManager::getInstance()->getCachedIp() + ":" + Util::toString(SearchManager::getInstance()->getPort()))) { + if(seeker == (getLocalIp() + ":" + Util::toString(SearchManager::getInstance()->getPort()))) { return; } } else { @@ -810,7 +810,7 @@ int chars = 0; size_t BUF_SIZE; if(ClientManager::getInstance()->isActive()) { - string x = ClientManager::getInstance()->getCachedIp(); + string x = getLocalIp(); BUF_SIZE = x.length() + aString.length() + 64; buf = new char[BUF_SIZE]; chars = snprintf(buf, BUF_SIZE, "$Search %s:%d %c?%c?%s?%d?%s|", x.c_str(), (int)SearchManager::getInstance()->getPort(), c1, c2, Util::toString(aSize).c_str(), aFileType+1, tmp.c_str()); Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -556,7 +556,7 @@ return qi->getPriority(); } namespace { -typedef unordered_map<TTHValue, const DirectoryListing::File*, TTHValue::Hash> TTHMap; +typedef unordered_map<TTHValue, const DirectoryListing::File*> TTHMap; // *** WARNING *** // Lock(cs) makes sure that there's only one thread accessing this Modified: dcplusplus/trunk/dcpp/QueueManager.h =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/QueueManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -135,7 +135,7 @@ CriticalSection cs; } mover; - typedef unordered_map<CID, string, CID::Hash> PfsQueue; + typedef unordered_map<CID, string> PfsQueue; typedef PfsQueue::iterator PfsIter; /** All queue items by target */ Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -77,6 +77,7 @@ "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks", + "SendBloom", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -271,6 +272,7 @@ setDefault(SHOW_SHELL_MENU, false); setDefault(MIN_SEGMENT_SIZE, 1024); setDefault(FOLLOW_LINKS, false); + setDefault(SEND_BLOOM, true); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -89,6 +89,7 @@ USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, + SEND_BLOOM, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -36,6 +36,7 @@ #include "Transfer.h" #include "UserConnection.h" #include "Download.h" +#include "HashBloom.h" #ifndef _WIN32 #include <sys/types.h> @@ -178,7 +179,7 @@ } } - vector<uint8_t> buf = tree.getLeafData(); + ByteVector buf = tree.getLeafData(); return new MemoryInputStream(&buf[0], buf.size()); } @@ -831,6 +832,19 @@ return 0; } +void ShareManager::getBloom(ByteVector& v, size_t k, size_t m) const { + dcdebug("Creating bloom filter, k=%u, m=%u\n", k, m); + Lock l(cs); + + HashBloom bloom; + bloom.reset(k, m); + for(HashFileMap::const_iterator i = tthIndex.begin(); i != tthIndex.end(); ++i) { + bloom.add(i->first); + } + bloom.copy_to(v); +} + + void ShareManager::generateXmlList() { Lock l(cs); if(xmlDirty && (lastXmlUpdate + 15 * 60 * 1000 < GET_TICK() || lastXmlUpdate < lastFullUpdate)) { Modified: dcplusplus/trunk/dcpp/ShareManager.h =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.h 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/ShareManager.h 2007-12-17 23:14:47 UTC (rev 946) @@ -80,6 +80,8 @@ string getShareSizeString() const { return Util::toString(getShareSize()); } string getShareSizeString(const string& aDir) const { return Util::toString(getShareSize(aDir)); } + + void getBloom(ByteVector& v, size_t k, size_t m) const; SearchManager::TypeModes getType(const string& fileName) const throw(); @@ -256,7 +258,7 @@ // Map real name to directory structure Directory::Map directories; - typedef unordered_map<TTHValue, Directory::File::Set::const_iterator, TTHValue::Hash> HashFileMap; + typedef unordered_map<TTHValue, Directory::File::Set::const_iterator> HashFileMap; typedef HashFileMap::iterator HashFileIter; HashFileMap tthIndex; Modified: dcplusplus/trunk/dcpp/Socket.cpp =================================================================== --- dcplusplus/trunk/dcpp/Socket.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/dcpp/Socket.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -179,7 +179,7 @@ socksAuth(timeLeft(start, timeout)); - vector<uint8_t> connStr; + ByteVector connStr; // Authenticated, let's get on with it... connStr.push_back(5); // SOCKSv5 Modified: dcplusplus/trunk/win32/AboutDlg.cpp =================================================================== --- dcplusplus/trunk/win32/AboutDlg.cpp 2007-12-15 22:26:23 UTC (rev 945) +++ dcplusplus/trunk/win32/AboutDlg.cpp 2007-12-17 23:14:47 UTC (rev 946) @@ -41,7 +41,8 @@ "defr, ullner, fleetcommand, liny, xan, olle svensson, mark gillespie, jeremy huddleston, " "bsod, sulan, jonathan stone, tim burton, izzzo, guitarm, paka, nils maier, jens oknelid, yoji, " "krzysztof tyszecki, poison, pothead, pur, bigmuscle, martin, jove, bart vullings, " -"steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman, james ross. " +"steven sheehy, tobias nygren, poy, dorian, stephan hohe, mafa_45, mikael eman, james ross," +"stanislav maslovski. " "Keep it coming!"; AboutDlg::AboutDlg(SmartWin::Widget* parent) : SmartWin::WidgetFactory<SmartWin::WidgetModalDialog>(parent) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-17 23:13:38
|
Revision: 106 http://adchpp.svn.sourceforge.net/adchpp/?rev=106&view=rev Author: arnetheduck Date: 2007-12-17 15:13:35 -0800 (Mon, 17 Dec 2007) Log Message: ----------- Update bloom filter to use multiple hashes, fix access script Modified Paths: -------------- adchpp/trunk/adchpp/CID.h adchpp/trunk/adchpp/ClientManager.cpp adchpp/trunk/adchpp/ClientManager.h adchpp/trunk/plugins/Bloom/src/BloomManager.cpp adchpp/trunk/plugins/Bloom/src/BloomManager.h adchpp/trunk/plugins/Bloom/src/HashBloom.h adchpp/trunk/plugins/Bloom/src/HashValue.h adchpp/trunk/plugins/Script/examples/access.lua Added Paths: ----------- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp Modified: adchpp/trunk/adchpp/CID.h =================================================================== --- adchpp/trunk/adchpp/CID.h 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/adchpp/CID.h 2007-12-17 23:13:35 UTC (rev 106) @@ -29,10 +29,6 @@ enum { SIZE = 192 / 8 }; enum { BASE32_SIZE = 39 }; - struct Hash { - size_t operator()(const CID& c) const { return c.toHash(); } - bool operator()(const CID& a, const CID& b) const { return a < b; } - }; CID() { memset(cid, 0, sizeof(cid)); } explicit CID(const uint8_t* data) { memcpy(cid, data, sizeof(cid)); } explicit CID(const std::string& base32) { Encoder::fromBase32(base32.c_str(), cid, sizeof(cid)); } @@ -62,4 +58,14 @@ } +namespace std { namespace tr1 { +template<> +struct hash<adchpp::CID> { + size_t operator()(const adchpp::CID& rhs) const { + return *reinterpret_cast<const size_t*>(rhs.data()); + } +}; +} +} + #endif Modified: adchpp/trunk/adchpp/ClientManager.cpp =================================================================== --- adchpp/trunk/adchpp/ClientManager.cpp 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/adchpp/ClientManager.cpp 2007-12-17 23:13:35 UTC (rev 106) @@ -431,10 +431,10 @@ setState(c, Client::STATE_IDENTIFY); } -vector<uint8_t> ClientManager::enterVerify(Client& c, bool sendData) throw() { +ByteVector ClientManager::enterVerify(Client& c, bool sendData) throw() { dcassert(c.getState() == Client::STATE_IDENTIFY); dcdebug("%s entering VERIFY\n", AdcCommand::fromSID(c.getSID()).c_str()); - vector<uint8_t> challenge; + ByteVector challenge; if (sendData) { for (int i = 0; i < 32/4; ++i) { uint32_t r = Util::rand(); Modified: adchpp/trunk/adchpp/ClientManager.h =================================================================== --- adchpp/trunk/adchpp/ClientManager.h 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/adchpp/ClientManager.h 2007-12-17 23:13:35 UTC (rev 106) @@ -176,7 +176,7 @@ ClientMap clients; typedef std::tr1::unordered_map<std::string, uint32_t> NickMap; NickMap nicks; - typedef std::tr1::unordered_map<CID, uint32_t, CID::Hash> CIDMap; + typedef std::tr1::unordered_map<CID, uint32_t> CIDMap; CIDMap cids; typedef std::tr1::unordered_set<uint32_t> SIDSet; SIDSet sids; Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.cpp 2007-12-17 23:13:35 UTC (rev 106) @@ -20,9 +20,13 @@ #include "BloomManager.h" #include <adchpp/LogManager.h> +#include <adchpp/Client.h> +#include <adchpp/AdcCommand.h> +#include <adchpp/Util.h> using namespace std; using namespace std::tr1::placeholders; +using namespace adchpp; BloomManager* BloomManager::instance = 0; const string BloomManager::className = "BloomManager"; @@ -38,18 +42,33 @@ LOG(className, "Shutting down"); } -static const std::string FEATURE = "BLOM"; +static const std::string FEATURE = "BLO0"; void BloomManager::onReceive(Client& c, AdcCommand& cmd, int& override) { - std::string tth; + string tmp; if(cmd.getCommand() == AdcCommand::CMD_INF && c.supports(FEATURE)) { - AdcCommand get(AdcCommand::CMD_GET); - get.addParam("blom"); - get.addParam("/"); - get.addParam("0"); - get.addParam("-1"); - c.send(get); + if(cmd.getParam("SF", 0, tmp)) { + size_t n = adchpp::Util::toInt(tmp); + if(n == 0) { + return; + } + + size_t k = HashBloom::get_k(n); + size_t m = HashBloom::get_m(n, k); + + HashBloom bloom = blooms[c.getCID()]; + + bloom.reset(k); + + AdcCommand get(AdcCommand::CMD_GET); + get.addParam("blom"); + get.addParam("/"); + get.addParam("0"); + get.addParam(Util::toString(m/8)); + get.addParam("BK", Util::toString(k)); + c.send(get); + } } else if(cmd.getCommand() == AdcCommand::CMD_SND) { if(cmd.getParameters().size() < 4) { return; @@ -58,14 +77,15 @@ return; } - int64_t bytes = Util::toInt(cmd.getParam(4)); + int64_t bytes = Util::toInt(cmd.getParam(3)); c.setDataMode(std::tr1::bind(&BloomManager::onData, this, _1, _2, _3), bytes); - } else if(cmd.getCommand() == AdcCommand::CMD_SCH && cmd.getParam("TH", 0, tth)) { - + override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; + } else if(cmd.getCommand() == AdcCommand::CMD_SCH && cmd.getParam("TR", 0, tmp)) { BloomMap::const_iterator i = blooms.find(c.getCID()); - if(i != blooms.end() && i->second.match(TTHValue(tth))) { + if(i != blooms.end() && !i->second.match(TTHValue(tmp))) { // Stop it + dcdebug("Stopping search\n"); override |= ClientManager::DONT_DISPATCH | ClientManager::DONT_SEND; } } @@ -83,4 +103,3 @@ void BloomManager::onDisconnected(Client& c) { blooms.erase(c.getCID()); } - Modified: adchpp/trunk/plugins/Bloom/src/BloomManager.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/BloomManager.h 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/plugins/Bloom/src/BloomManager.h 2007-12-17 23:13:35 UTC (rev 106) @@ -64,7 +64,7 @@ friend class Singleton<BloomManager>; static BloomManager* instance; - typedef std::tr1::unordered_map<CID, HashBloom, CID::Hash> BloomMap; + typedef std::tr1::unordered_map<CID, HashBloom> BloomMap; BloomMap blooms; ClientManager::SignalReceive::ManagedConnection receiveConn; Added: adchpp/trunk/plugins/Bloom/src/HashBloom.cpp =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.cpp (rev 0) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.cpp 2007-12-17 23:13:35 UTC (rev 106) @@ -0,0 +1,54 @@ +#include "stdinc.h" +#include "HashBloom.h" + + +size_t HashBloom::get_k(size_t n) { + const size_t bits = TTHValue::SIZE * 8; + for(size_t k = static_cast<size_t>(sqrt(bits)); k > 1; --k) { + // We only want the k's where the bits will end up on a byte boundary to ease hash implementation + if((bits % k) == 0 && (bits / k) % 8 == 0) { + uint64_t m = get_m(n, k); + if(m >> (TTHValue::SIZE * 8 / k) == 0) { + return k; + } + } + } + return 1; +} + +uint64_t HashBloom::get_m(size_t n, size_t k) { + uint64_t m = (static_cast<uint64_t>(ceil(static_cast<double>(n) * k / log(2.)))); + return ((m / 8) + 1) * 8; +} + +void HashBloom::add(const TTHValue& tth) { + for(size_t i = 0; i < k; ++i) { + bloom[pos(tth, i)] = true; + } +} + +bool HashBloom::match(const TTHValue& tth) const { + if(bloom.empty()) { + return true; + } + for(size_t i = 0; i < k; ++i) { + if(!bloom[pos(tth, i)]) { + return false; + } + } + return true; +} + +void HashBloom::push_back(bool v) { + bloom.push_back(v); +} + +void HashBloom::reset(size_t k_) { + bloom.resize(0); + k = k; +} + +size_t HashBloom::pos(const TTHValue& tth, size_t n) const { + return (*(size_t*)(tth.data + (TTHValue::SIZE / k) * n)) % bloom.size(); +} + Modified: adchpp/trunk/plugins/Bloom/src/HashBloom.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/plugins/Bloom/src/HashBloom.h 2007-12-17 23:13:35 UTC (rev 106) @@ -3,19 +3,33 @@ #include "HashValue.h" +/** + * According to http://www.eecs.harvard.edu/~michaelm/NEWWORK/postscripts/BloomFilterSurvey.pdf + * the optimal number of hashes k is (m/n)*ln(2), m = number of bits in the filter and n = number + * of items added. The largest k that we can get from a single TTH value depends on the number of + * bits we need to address the bloom structure, which in turn depends on m, so the optimal size + * for our filter is m = n * k / ln(2) where n is the number of TTH values, or in our case, number of + * files in share since each file is identified by one TTH value. We try that for each even dividend + * of the key size (2, 3, 4, 6, 8, 12) and if m fits within the bits we're able to address (2^(keysize/k)), + * we can use that value when requesting the bloom filter. + */ class HashBloom { public: - void add(const TTHValue& tth) { bloom[pos(tth)] = true; } - bool match(const TTHValue& tth) const { return bloom[pos(tth)]; } - void resize(size_t hashes) { bloom.resize(hashes); std::fill(bloom.begin(), bloom.end(), false); } - void push_back(bool v) { bloom.push_back(v); } + /** Return the largest k such that get_m returns a value smaller than 2^(TTHValue::SIZE/k) */ + static size_t get_k(size_t n); + /** Optimal number of bits to allocate for n elements when using k hashes */ + static uint64_t get_m(size_t n, size_t k); + + void add(const TTHValue& tth); + bool match(const TTHValue& tth) const; + void reset(size_t k); + void push_back(bool v); private: - size_t pos(const TTHValue& tth) const { - return (*(size_t*)tth.data) % bloom.size(); - } + size_t pos(const TTHValue& tth, size_t n) const; std::vector<bool> bloom; + size_t k; }; #endif /*HASHBLOOM_H_*/ Modified: adchpp/trunk/plugins/Bloom/src/HashValue.h =================================================================== --- adchpp/trunk/plugins/Bloom/src/HashValue.h 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/plugins/Bloom/src/HashValue.h 2007-12-17 23:13:35 UTC (rev 106) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point com + * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,24 +16,16 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if !defined(HASH_VALUE_H) -#define HASH_VALUE_H +#ifndef BLOOM_HASH_VALUE_H +#define BLOOM_HASH_VALUE_H #include <adchpp/TigerHash.h> +#include <adchpp/Encoder.h> template<class Hasher> struct HashValue { static const size_t SIZE = Hasher::HASH_SIZE; - struct Hash { -#ifdef _MSC_VER - static const size_t bucket_size = 4; - static const size_t min_buckets = 8; -#endif - size_t operator()(const HashValue& rhs) const { return *(size_t*)&rhs; } - bool operator()(const HashValue& a, const HashValue& b) const { return a < b; } - }; - HashValue() { } explicit HashValue(uint8_t* aData) { memcpy(data, aData, SIZE); } explicit HashValue(const std::string& base32) { Encoder::fromBase32(base32.c_str(), data, SIZE); } @@ -49,6 +41,15 @@ uint8_t data[SIZE]; }; +namespace std { namespace tr1 { +template<> +template<typename T> +struct hash<HashValue<T> > { + size_t operator()(const HashValue<T>& rhs) const { return *(size_t*)rhs.data; } +}; +} +} + typedef HashValue<TigerHash> TTHValue; #endif // !defined(HASH_VALUE_H) Modified: adchpp/trunk/plugins/Script/examples/access.lua =================================================================== --- adchpp/trunk/plugins/Script/examples/access.lua 2007-12-14 15:16:58 UTC (rev 105) +++ adchpp/trunk/plugins/Script/examples/access.lua 2007-12-17 23:13:35 UTC (rev 106) @@ -355,7 +355,7 @@ reply(c, "Welcome back") cm:enterNormal(c, true, true) - if user.level > 1 and (c:supports("UCMD") or c:supports("UCM0") then + if user.level > 1 and (c:supports("UCMD") or c:supports("UCM0")) then for k, v in pairs(user_commands) do ucmd = adchpp.AdcCommand(adchpp.AdcCommand_CMD_CMD, adchpp.AdcCommand_TYPE_INFO, adchpp.AdcCommand_HUB_SID) ucmd:addParam(k) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-15 22:26:25
|
Revision: 945 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=945&view=rev Author: arnetheduck Date: 2007-12-15 14:26:23 -0800 (Sat, 15 Dec 2007) Log Message: ----------- Remove silly sharedfile Modified Paths: -------------- dcplusplus/trunk/dcpp/Download.cpp dcplusplus/trunk/dcpp/Download.h dcplusplus/trunk/dcpp/File.cpp dcplusplus/trunk/dcpp/File.h dcplusplus/trunk/dcpp/QueueManager.cpp dcplusplus/trunk/dcpp/forward.h Removed Paths: ------------- dcplusplus/trunk/dcpp/SharedFile.cpp dcplusplus/trunk/dcpp/SharedFile.h Modified: dcplusplus/trunk/dcpp/Download.cpp =================================================================== --- dcplusplus/trunk/dcpp/Download.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/Download.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -23,7 +23,6 @@ #include "UserConnection.h" #include "QueueItem.h" -#include "SharedFile.h" #include "HashManager.h" namespace dcpp { @@ -120,8 +119,4 @@ params["sfv"] = Util::toString(isSet(Download::FLAG_CRC32_OK) ? 1 : 0); } -void Download::setSharedFile(SharedFile* f) { - file = sharedFile = f; -} - } // namespace dcpp Modified: dcplusplus/trunk/dcpp/Download.h =================================================================== --- dcplusplus/trunk/dcpp/Download.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/Download.h 2007-12-15 22:26:23 UTC (rev 945) @@ -52,9 +52,6 @@ /** @internal */ AdcCommand getCommand(bool zlib); - const SharedFile* getSharedFile() const{ return sharedFile; } - void setSharedFile(SharedFile* f); - GETSET(string, tempTarget, TempTarget); GETSET(OutputStream*, file, File); GETSET(bool, treeValid, TreeValid); @@ -64,7 +61,6 @@ TigerTree tt; string pfs; - SharedFile* sharedFile; }; } // namespace dcpp Modified: dcplusplus/trunk/dcpp/File.cpp =================================================================== --- dcplusplus/trunk/dcpp/File.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/File.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -41,9 +41,10 @@ dcassert(0); } } + DWORD shared = FILE_SHARE_READ | (mode & SHARED ? FILE_SHARE_WRITE : 0); + + h = ::CreateFile(Text::toT(aFileName).c_str(), access, shared, NULL, m, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - h = ::CreateFile(Text::toT(aFileName).c_str(), access, FILE_SHARE_READ, NULL, m, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if(h == INVALID_HANDLE_VALUE) { throw FileException(Util::translateError(GetLastError())); } Modified: dcplusplus/trunk/dcpp/File.h =================================================================== --- dcplusplus/trunk/dcpp/File.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/File.h 2007-12-15 22:26:23 UTC (rev 945) @@ -46,7 +46,8 @@ enum { OPEN = 0x01, CREATE = 0x02, - TRUNCATE = 0x04 + TRUNCATE = 0x04, + SHARED = 0x08 }; #ifdef _WIN32 Modified: dcplusplus/trunk/dcpp/QueueManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/QueueManager.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -31,7 +31,6 @@ #include "ResourceManager.h" #include "SearchManager.h" #include "ShareManager.h" -#include "SharedFile.h" #include "SimpleXML.h" #include "StringTokenizer.h" #include "Transfer.h" @@ -733,19 +732,11 @@ throw QueueException(STRING(TARGET_REMOVED)); } - for(DownloadList::const_iterator i = qi->getDownloads().begin(); i != qi->getDownloads().end(); ++i) { - const Download* d2 = *i; - if(d2->getFile()) { - // Already downloading, reuse same file - d->setSharedFile(new SharedFile(*d2->getSharedFile(), d->getSegment())); - return; - } - } - string target = d->getDownloadTarget(); File::ensureDirectory(target); - - d->setSharedFile(new SharedFile(target, d->getSegment(), qi->getSize())); + File* f = new File(target, File::WRITE, File::OPEN | File::CREATE | File::SHARED); + f->setPos(d->getSegment().getStart()); + d->setFile(f); } else if(d->getType() == Transfer::TYPE_FULL_LIST) { string target = d->getDownloadTarget(); File::ensureDirectory(target); Deleted: dcplusplus/trunk/dcpp/SharedFile.cpp =================================================================== --- dcplusplus/trunk/dcpp/SharedFile.cpp 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/SharedFile.cpp 2007-12-15 22:26:23 UTC (rev 945) @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2001-2007 Jacek Sieka, arnetheduck on gmail point com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "stdinc.h" -#include "DCPlusPlus.h" - -#include "SharedFile.h" - -namespace dcpp { - -SharedFile::FileData::FileData(const string& filename) : f(filename, File::RW, File::OPEN | File::CREATE) { - -} - -SharedFile::SharedFile(const string& filename, const Segment& segment_, int64_t totalSize) : segment(segment_), pos(0) { - file = FileDataPtr(new FileData(filename)); - if(totalSize != -1) { - file->f.setSize(totalSize); - } -} - -size_t SharedFile::write(const void* buf, size_t len) throw(Exception) { - Lock l(file->cs); - file->f.setPos(segment.getStart() + pos); - size_t n = file->f.write(buf, len); - pos += n; - return n; -} - -size_t SharedFile::read(void* buf, size_t& len) throw(Exception) { - Lock l(file->cs); - file->f.setPos(segment.getStart() + pos); - size_t n = file->f.read(buf, len); - pos += n; - return n; -} - -size_t SharedFile::flush() throw(Exception) { - Lock l(file->cs); - return file->f.flush(); -} - -} Deleted: dcplusplus/trunk/dcpp/SharedFile.h =================================================================== --- dcplusplus/trunk/dcpp/SharedFile.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/SharedFile.h 2007-12-15 22:26:23 UTC (rev 945) @@ -1,41 +0,0 @@ -#ifndef DCPLUSPLUS_DCPP_SHAREDFILE_H_ -#define DCPLUSPLUS_DCPP_SHAREDFILE_H_ - -#include "File.h" -#include "CriticalSection.h" -#include "Segment.h" - -namespace dcpp { - -/** A file used by multiple writers */ -class SharedFile : public IOStream { -public: - SharedFile(const string& filename, const Segment& segment, int64_t totalSize); - - SharedFile(const SharedFile& sf, const Segment& segment_) : file(sf.file), segment(segment_), pos(0) { } - - using OutputStream::write; - virtual size_t write(const void* buf, size_t len) throw(Exception); - virtual size_t read(void* buf, size_t& len) throw(Exception); - - virtual size_t flush() throw(Exception); -private: - struct FileData { - FileData(const string& filename); - File f; - CriticalSection cs; - }; - - typedef std::tr1::shared_ptr<FileData> FileDataPtr; - - FileDataPtr file; - - Segment segment; - - /** Bytes written so far */ - size_t pos; - -}; - -} -#endif /*SHAREDFILE_H_*/ Modified: dcplusplus/trunk/dcpp/forward.h =================================================================== --- dcplusplus/trunk/dcpp/forward.h 2007-12-14 19:50:32 UTC (rev 944) +++ dcplusplus/trunk/dcpp/forward.h 2007-12-15 22:26:23 UTC (rev 945) @@ -72,8 +72,6 @@ class ServerSocket; -class SharedFile; - class Socket; class SocketException; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <arn...@us...> - 2007-12-14 19:50:38
|
Revision: 944 http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=944&view=rev Author: arnetheduck Date: 2007-12-14 11:50:32 -0800 (Fri, 14 Dec 2007) Log Message: ----------- linuxdc++ patches Modified Paths: -------------- dcplusplus/trunk/changelog.txt dcplusplus/trunk/dcpp/HashManager.cpp dcplusplus/trunk/dcpp/SettingsManager.cpp dcplusplus/trunk/dcpp/SettingsManager.h dcplusplus/trunk/dcpp/ShareManager.cpp dcplusplus/trunk/dcpp/Text.cpp dcplusplus/trunk/dcpp/Util.h Modified: dcplusplus/trunk/changelog.txt =================================================================== --- dcplusplus/trunk/changelog.txt 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/changelog.txt 2007-12-14 19:50:32 UTC (rev 944) @@ -1,4 +1,7 @@ --- 0.704 2007-12-14 -- +-- 0.705 -- +* Several patches for better *nix compatibility of the core (thanks steven sheehy et al) + +-- 0.704 2007-12-14 -- * Hub lists added to utilize Coral's distributed network (ullner) * Use system header arrows on common controls 6+ (thanks poy) * Fixed badly drawn arrows (thanks poy) Modified: dcplusplus/trunk/dcpp/HashManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/HashManager.cpp 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/HashManager.cpp 2007-12-14 19:50:32 UTC (rev 944) @@ -601,7 +601,7 @@ static const int64_t BUF_SIZE = 0x1000000 - (0x1000000 % getpagesize()); -bool HashManager::Hasher::fastHash(const string& filename, u_int8_t* , TigerTree& tth, int64_t size, CRC32Filter* xcrc32) { +bool HashManager::Hasher::fastHash(const string& filename, uint8_t* , TigerTree& tth, int64_t size, CRC32Filter* xcrc32) { int fd = open(Text::fromUtf8(filename).c_str(), O_RDONLY); if(fd == -1) return false; @@ -611,7 +611,7 @@ int64_t size_read = 0; void *buf = 0; - u_int32_t lastRead = GET_TICK(); + uint32_t lastRead = GET_TICK(); while(pos <= size) { if(size_left > 0) { size_read = std::min(size_left, BUF_SIZE); @@ -624,10 +624,10 @@ madvise(buf, size_read, MADV_SEQUENTIAL | MADV_WILLNEED); if(SETTING(MAX_HASH_SPEED) > 0) { - u_int32_t now = GET_TICK(); - u_int32_t minTime = size_read * 1000LL / (SETTING(MAX_HASH_SPEED) * 1024LL * 1024LL); + uint32_t now = GET_TICK(); + uint32_t minTime = size_read * 1000LL / (SETTING(MAX_HASH_SPEED) * 1024LL * 1024LL); if(lastRead + minTime > now) { - u_int32_t diff = now - lastRead; + uint32_t diff = now - lastRead; Thread::sleep(minTime - diff); } lastRead = lastRead + minTime; @@ -643,7 +643,7 @@ (*xcrc32)(buf, size_read); { Lock l(cs); - currentSize = max(static_cast<u_int64_t>(currentSize - size_read), static_cast<u_int64_t>(0)); + currentSize = max(static_cast<uint64_t>(currentSize - size_read), static_cast<uint64_t>(0)); } if(size_left <= 0) { Modified: dcplusplus/trunk/dcpp/SettingsManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/SettingsManager.cpp 2007-12-14 19:50:32 UTC (rev 944) @@ -76,7 +76,7 @@ "OpenWaitingUsers", "BoldWaitingUsers", "OpenSystemLog", "BoldSystemLog", "AutoRefreshTime", "UseTLS", "AutoSearchLimit", "AltSortOrder", "AutoKickNoFavs", "PromptPassword", "SpyFrameIgnoreTthSearches", "DontDlAlreadyQueued", "MaxCommandLength", "AllowUntrustedHubs", "AllowUntrustedClients", - "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", + "TLSPort", "FastHash", "SortFavUsersFirst", "ShowShellMenu", "MinSegmentSize", "FollowLinks", "SENTRY", // Int64 "TotalUpload", "TotalDownload", @@ -270,6 +270,7 @@ setDefault(SORT_FAVUSERS_FIRST, false); setDefault(SHOW_SHELL_MENU, false); setDefault(MIN_SEGMENT_SIZE, 1024); + setDefault(FOLLOW_LINKS, false); #ifdef _WIN32 setDefault(MAIN_WINDOW_STATE, SW_SHOWNORMAL); Modified: dcplusplus/trunk/dcpp/SettingsManager.h =================================================================== --- dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/SettingsManager.h 2007-12-14 19:50:32 UTC (rev 944) @@ -88,7 +88,7 @@ OPEN_WAITING_USERS, BOLD_WAITING_USERS, OPEN_SYSTEM_LOG, BOLD_SYSTEM_LOG, AUTO_REFRESH_TIME, USE_TLS, AUTO_SEARCH_LIMIT, ALT_SORT_ORDER, AUTO_KICK_NO_FAVS, PROMPT_PASSWORD, SPY_FRAME_IGNORE_TTH_SEARCHES, DONT_DL_ALREADY_QUEUED, MAX_COMMAND_LENGTH, ALLOW_UNTRUSTED_HUBS, ALLOW_UNTRUSTED_CLIENTS, - TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, + TLS_PORT, FAST_HASH, SORT_FAVUSERS_FIRST, SHOW_SHELL_MENU, MIN_SEGMENT_SIZE, FOLLOW_LINKS, INT_LAST }; enum Int64Setting { INT64_FIRST = INT_LAST + 1, Modified: dcplusplus/trunk/dcpp/ShareManager.cpp =================================================================== --- dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/ShareManager.cpp 2007-12-14 19:50:32 UTC (rev 944) @@ -552,6 +552,10 @@ return ((dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) || (cFileName[0] == L'.')); } + bool isLink() { + return false; + } + int64_t getSize() { return (int64_t)nFileSizeLow | ((int64_t)nFileSizeHigh)<<32; } @@ -621,6 +625,12 @@ if (!ent) return false; return ent->d_name[0] == '.'; } + bool isLink() { + struct stat inode; + if (!ent) return false; + if (lstat((base + PATH_SEPARATOR + ent->d_name).c_str(), &inode) == -1) return false; + return S_ISLNK(inode.st_mode); + } int64_t getSize() { struct stat inode; if (!ent) return false; @@ -669,8 +679,10 @@ if(name == "." || name == "..") continue; - if(!BOOLSETTING(SHARE_HIDDEN) && i->isHidden() ) + if(!BOOLSETTING(SHARE_HIDDEN) && i->isHidden()) continue; + if(!BOOLSETTING(FOLLOW_LINKS) && i->isLink()) + continue; if(i->isDirectory()) { string newName = aName + name + PATH_SEPARATOR; Modified: dcplusplus/trunk/dcpp/Text.cpp =================================================================== --- dcplusplus/trunk/dcpp/Text.cpp 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/Text.cpp 2007-12-14 19:50:32 UTC (rev 944) @@ -307,11 +307,15 @@ } const string& toUtf8(const string& str, const string& fromCharset, string& tmp) throw() { - if(str.empty() || fromCharset == utf8 || toLower(fromCharset, tmp) == utf8) { + if(str.empty()) { return str; } - + #ifdef _WIN32 + if (fromCharset == utf8 || toLower(fromCharset, tmp) == utf8) { + return str; + } + return acpToUtf8(str, tmp); #else return convert(str, tmp, fromCharset, utf8); @@ -319,11 +323,15 @@ } const string& fromUtf8(const string& str, const string& toCharset, string& tmp) throw() { - if(str.empty() || toCharset == utf8 || toLower(toCharset, tmp) == utf8) { + if(str.empty()) { return str; } - + #ifdef _WIN32 + if (toCharset == utf8 || toLower(toCharset, tmp) == utf8) { + return str; + } + return utf8ToAcp(str, tmp); #else return convert(str, tmp, utf8, toCharset); @@ -331,10 +339,12 @@ } const string& convert(const string& str, string& tmp, const string& fromCharset, const string& toCharset) throw() { - if(str.empty() || Util::stricmp(fromCharset, toCharset) == 0) + if(str.empty()) return str; #ifdef _WIN32 + if (Util::stricmp(fromCharset, toCharset) == 0) + return str; if(toCharset == utf8 || toLower(toCharset, tmp) == utf8) return acpToUtf8(str, tmp); if(fromCharset == utf8 || toLower(fromCharset, tmp) == utf8) Modified: dcplusplus/trunk/dcpp/Util.h =================================================================== --- dcplusplus/trunk/dcpp/Util.h 2007-12-14 16:40:43 UTC (rev 943) +++ dcplusplus/trunk/dcpp/Util.h 2007-12-14 19:50:32 UTC (rev 944) @@ -207,7 +207,7 @@ #ifdef _WIN32 return _atoi64(aString.c_str()); #else - return atoll(aString.c_str()); + return strtoll(aString.c_str(), (char **)NULL, 10); #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |