Skip to content

Commit

Permalink
* r504 release sp build-21862
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-pimenov committed May 5, 2019
1 parent 7046449 commit 099f5c5
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 1,662 deletions.
4 changes: 4 additions & 0 deletions client/OnlineUser.h
Expand Up @@ -652,8 +652,11 @@ class Identity
#ifdef FLYLINKDC_USE_EXT_JSON
private:
bool m_is_ext_json;
#ifdef FLYLINKDC_USE_CHECK_EXT_JSON
string m_lastExtJSON;
#endif
public:
#ifdef FLYLINKDC_USE_LOCATION_DIALOG
string getFlyHubCountry() const
{
return getStringParamExtJSON("F1");
Expand All @@ -666,6 +669,7 @@ class Identity
{
return getStringParamExtJSON("F3");
}
#endif
int getGenderType() const
{
return Util::toInt(getStringParamExtJSON("F4"));
Expand Down
21 changes: 12 additions & 9 deletions client/User.cpp
Expand Up @@ -491,6 +491,7 @@ bool Identity::isUdpActive() const
bool Identity::setExtJSON(const string& p_ExtJSON)
{
bool l_result = true;
#ifdef FLYLINKDC_USE_CHECK_EXT_JSON
if (m_lastExtJSON == p_ExtJSON)
{
l_result = false;
Expand All @@ -503,6 +504,7 @@ bool Identity::setExtJSON(const string& p_ExtJSON)
{
m_lastExtJSON = p_ExtJSON;
}
#endif
m_is_ext_json = true;
return l_result;
}
Expand Down Expand Up @@ -607,9 +609,9 @@ string Identity::getApplication() const

#ifdef _DEBUG

// #define FLYLINKDC_USE_TEST
#define FLYLINKDC_USE_TEST
#ifdef FLYLINKDC_USE_TEST
FastCriticalSection csTest;
static FastCriticalSection g_csTest;
#endif

#endif
Expand Down Expand Up @@ -665,10 +667,10 @@ string Identity::getStringParam(const char* name) const // [!] IRainman fix.
#ifdef FLYLINKDC_USE_TEST
{
static std::map<short, int> g_cnt;
CFlyFastLock(ll(csTest);
auto& j = g_cnt[*(short*)name];
j++;
//if (j % 100 == 0)
CFlyFastLock(g_csTest);
auto& j = g_cnt[*(short*)name];
j++;
if (j % 100 == 0)
{
LogManager::message("Identity::getStringParam = " + string(name) + " count = " + Util::toString(j));
//dcdebug(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! get[%s] = %d \n", name, j);
Expand Down Expand Up @@ -797,7 +799,7 @@ void Identity::setStringParam(const char* name, const string& val) // [!] IRainm
#ifdef FLYLINKDC_USE_TEST
{
static std::map<short, int> g_cnt;
CFlyFastLock(csTest);
CFlyFastLock(g_csTest);
// auto& i = g_cnt[*(short*)name];
// i++;
// if (i % 100 == 0)
Expand All @@ -811,7 +813,7 @@ void Identity::setStringParam(const char* name, const string& val) // [!] IRainm
if (l_key != "AP" && l_key != "EM" && l_key != "DE" && l_key != "VE")
{
//dcdebug(" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! set[%s] '%s' count = %d sizeof(*this) = %d\n", name, val.c_str(), j, sizeof(*this));
LogManager::message("Identity::setStringParam = " + string(name) + " val = " + val);
LogManager::message("Identity::setStringParam = " + string(name) + " val = " + val + " count = " + Util::toString(j));
}
}
#endif
Expand Down Expand Up @@ -1193,10 +1195,11 @@ void Identity::getReport(string& p_report) const
appendIfValueNotEmpty("Support info", getExtJSONSupportInfo());
appendIfValueNotEmpty("Gender", Text::fromT(getGenderTypeAsString()));

#ifdef FLYLINKDC_USE_LOCATION_DIALOG
appendIfValueNotEmpty("Country", getFlyHubCountry());
appendIfValueNotEmpty("City", getFlyHubCity());
appendIfValueNotEmpty("ISP", getFlyHubISP());
#endif
appendIfValueNotEmpty("Count files", getExtJSONCountFilesAsText());
appendIfValueNotEmpty("Last share", getExtJSONLastSharedDateAsText());
appendIfValueNotEmpty("SQLite DB size", getExtJSONSQLiteDBSizeAsText());
Expand Down
17 changes: 13 additions & 4 deletions client/Util.h
Expand Up @@ -833,7 +833,10 @@ class Util

static int toInt(const string& aString)
{
return toInt(aString.c_str());
if (aString.empty())
return 0;
else
return toInt(aString.c_str());
}

static int toInt(const char* aString) // [+] IRainman opt
Expand All @@ -843,17 +846,23 @@ class Util

static int toInt(const wstring& aString) // [+] IRainman opt
{
return toInt(aString.c_str());
if (aString.empty())
return 0;
else
return toInt(aString.c_str());
}

static int toInt(const wchar_t* aString) // [+] IRainman opt
{
return _wtoi(aString);
}

static uint32_t toUInt32(const string& str)
static uint32_t toUInt32(const string& aString)
{
return toUInt32(str.c_str());
if (aString.empty())
return 0;
else
return toUInt32(aString.c_str());
}
static uint32_t toUInt32(const char* c)
{
Expand Down
2 changes: 2 additions & 0 deletions client/nmdchub.cpp
Expand Up @@ -2806,9 +2806,11 @@ bool NmdcHub::extJSONParse(const string& param, bool p_is_disable_fire /*= false
{
if (ou->getIdentity().setExtJSON(param))
{
#ifdef FLYLINKDC_USE_LOCATION_DIALOG
ou->getIdentity().setStringParam("F1", l_root["Country"].asString());
ou->getIdentity().setStringParam("F2", l_root["City"].asString());
ou->getIdentity().setStringParam("F3", l_root["ISP"].asString());
#endif
ou->getIdentity().setStringParam("F4", l_root["Gender"].asString());
ou->getIdentity().setExtJSONSupportInfo(l_root["Support"].asString());
ou->getIdentity().setExtJSONRAMWorkingSet(l_root["RAM"].asInt());
Expand Down
171 changes: 0 additions & 171 deletions client/webrtc/talk/base/basictypes.h

This file was deleted.

0 comments on commit 099f5c5

Please sign in to comment.