From b793ff123e5ea067d1283522370e2a5b56890a2d Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 20 Jul 2021 15:06:17 +0800 Subject: [PATCH] Remove test code --- cocos/network/HttpCookie.cpp | 58 +----------------------------------- 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/cocos/network/HttpCookie.cpp b/cocos/network/HttpCookie.cpp index c4625e49da..5ad5f01ad4 100644 --- a/cocos/network/HttpCookie.cpp +++ b/cocos/network/HttpCookie.cpp @@ -30,7 +30,6 @@ #include "yasio/detail/utils.hpp" #include "yasio/cxx17/string_view.hpp" #include "xsbase/fast_split.hpp" -#include "yasio/detail/utils.hpp" #include #include @@ -54,9 +53,8 @@ void HttpCookie::readFile() NAME_INDEX, VALUE__INDEX, }; + std::string inString = cocos2d::FileUtils::getInstance()->getStringFromFile(_cookieFileName); - - long long start = yasio::highp_clock(); if(!inString.empty()) { xsbase::fast_split(inString, '\n', [this](char* s, char* e) { @@ -96,60 +94,6 @@ void HttpCookie::readFile() _cookies.push_back(std::move(cookieInfo)); }); } - CCLOG("Performance with fast_split: %.3lf(ms) ", (yasio::highp_clock() - start) / 1000.0f); - - start = yasio::highp_clock(); - if (!inString.empty()) - { - std::vector cookiesVec; - cookiesVec.clear(); - - std::stringstream stream(inString); - std::string item; - while (std::getline(stream, item, '\n')) - { - cookiesVec.push_back(item); - } - - if (cookiesVec.empty()) - return; - - _cookies.clear(); - - for (auto& cookie : cookiesVec) - { - if (cookie.empty()) - continue; - - if (cookie.find("#HttpOnly_") != std::string::npos) - { - cookie = cookie.substr(10); - } - - if (cookie.at(0) == '#') - continue; - - CookieInfo co; - std::stringstream streamInfo(cookie); - std::vector elems; - std::string elemsItem; - - while (std::getline(streamInfo, elemsItem, '\t')) - { - elems.push_back(elemsItem); - } - - co.domain = elems[0]; - co.tailmatch = true; // strcmp("TRUE", elems[1].c_str()) == 0; - co.path = elems[2]; - co.secure = strcmp("TRUE", elems[3].c_str()) == 0; - co.expires = static_cast(strtoll(elems[4].c_str(), nullptr, 10)); - co.name = elems[5]; - co.value = elems[6]; - _cookies.push_back(co); - } - } - CCLOG("Performance with std::getline: %.3lf(ms) ", (yasio::highp_clock() - start) / 1000.0f); } const std::vector* HttpCookie::getCookies() const