Loading src/connection.cpp +10 −7 Changes for src/connection.cpp: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -208,29 +208,32 @@ HAVEDATA: } int netplus::con::copyValue(con::condata* startblock, size_t startpos, con::condata* endblock, size_t endpos, std::string& buffer) { con::condata* endblock, size_t endpos, std::vector<char>& buffer) { con::condata* curdat = startblock; do { if (curdat == startblock && curdat == endblock) { buffer += curdat->_Data.substr(startpos, endpos - startpos); std::copy(curdat->_Data.begin()+startpos, curdat->_Data.begin()+endpos, std::inserter<std::vector<char>>(buffer,buffer.end())); break; } else if (curdat == startblock) { size_t len = curdat->_Data.length(); buffer += curdat->_Data.substr(startpos, len - startpos); std::copy(curdat->_Data.begin()+startpos,curdat->_Data.end(), std::inserter<std::vector<char>>(buffer,buffer.end())); } else if (curdat == endblock) { buffer += curdat->_Data.substr(0, endpos); std::copy(curdat->_Data.begin(),curdat->_Data.begin()+endpos, std::inserter<std::vector<char>>(buffer,buffer.end())); } else { buffer += curdat->_Data; std::copy(curdat->_Data.begin(),curdat->_Data.end(), std::inserter<std::vector<char>>(buffer,buffer.end())); } curdat = curdat->nextcondata(); } while (curdat != endblock); return buffer.length(); //not include termination return buffer.size(); //not include termination } int netplus::con::searchValue(con::condata* startblock, con::condata** findblock, Loading src/connection.h +2 −1 Changes for src/connection.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <vector> #include <memory> #include <atomic> Loading Loading @@ -55,7 +56,7 @@ namespace netplus { /*Cache helper functions*/ int copyValue(condata* startblock, size_t startpos, condata* endblock, size_t endpos, std::string &buffer); condata* endblock, size_t endpos, std::vector<char> &buffer); int searchValue(condata* startblock, condata** findblock, const char* keyword); int searchValue(condata* startblock, condata** findblock, Loading src/linux/event.cpp +7 −0 Changes for src/linux/event.cpp: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdint.h> #include <mutex> #include <cstring> #include <errno.h> #include "socket.h" #include "exception.h" #include "eventapi.h" Loading @@ -46,6 +49,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define BLOCKSIZE 16384 #ifdef __GNU_SOURCE #undef __GNU_SOURCE #endif struct poll_event { uint32_t events; epoll_data_t data; Loading Loading
src/connection.cpp +10 −7 Changes for src/connection.cpp: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -208,29 +208,32 @@ HAVEDATA: } int netplus::con::copyValue(con::condata* startblock, size_t startpos, con::condata* endblock, size_t endpos, std::string& buffer) { con::condata* endblock, size_t endpos, std::vector<char>& buffer) { con::condata* curdat = startblock; do { if (curdat == startblock && curdat == endblock) { buffer += curdat->_Data.substr(startpos, endpos - startpos); std::copy(curdat->_Data.begin()+startpos, curdat->_Data.begin()+endpos, std::inserter<std::vector<char>>(buffer,buffer.end())); break; } else if (curdat == startblock) { size_t len = curdat->_Data.length(); buffer += curdat->_Data.substr(startpos, len - startpos); std::copy(curdat->_Data.begin()+startpos,curdat->_Data.end(), std::inserter<std::vector<char>>(buffer,buffer.end())); } else if (curdat == endblock) { buffer += curdat->_Data.substr(0, endpos); std::copy(curdat->_Data.begin(),curdat->_Data.begin()+endpos, std::inserter<std::vector<char>>(buffer,buffer.end())); } else { buffer += curdat->_Data; std::copy(curdat->_Data.begin(),curdat->_Data.end(), std::inserter<std::vector<char>>(buffer,buffer.end())); } curdat = curdat->nextcondata(); } while (curdat != endblock); return buffer.length(); //not include termination return buffer.size(); //not include termination } int netplus::con::searchValue(con::condata* startblock, con::condata** findblock, Loading
src/connection.h +2 −1 Changes for src/connection.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <vector> #include <memory> #include <atomic> Loading Loading @@ -55,7 +56,7 @@ namespace netplus { /*Cache helper functions*/ int copyValue(condata* startblock, size_t startpos, condata* endblock, size_t endpos, std::string &buffer); condata* endblock, size_t endpos, std::vector<char> &buffer); int searchValue(condata* startblock, condata** findblock, const char* keyword); int searchValue(condata* startblock, condata** findblock, Loading
src/linux/event.cpp +7 −0 Changes for src/linux/event.cpp: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <stdint.h> #include <mutex> #include <cstring> #include <errno.h> #include "socket.h" #include "exception.h" #include "eventapi.h" Loading @@ -46,6 +49,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define BLOCKSIZE 16384 #ifdef __GNU_SOURCE #undef __GNU_SOURCE #endif struct poll_event { uint32_t events; epoll_data_t data; Loading