From 1ca35422a252e1b254d6a4823717d39f7988514f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 13 Aug 2015 20:12:02 +0000 Subject: fix for wrong CMString::Mid calls git-svn-id: http://svn.miranda-ng.org/main/trunk@14944 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'plugins/Dropbox/src/dropbox.cpp') diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 2aa36de2d7..6ac4ee8d1b 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -80,17 +80,16 @@ void CDropbox::RequestAccountInfo() JSONNode display_name = root.at("display_name"); if (!display_name.empty()) { - ptrT display_name(mir_utf8decodeT(display_name.as_string().c_str())); - TCHAR *sep = _tcsrchr(display_name, _T(' ')); - if (sep) + CMString tszDisplayName(display_name.as_mstring()); + int pos = tszDisplayName.ReverseFind(' '); + if (pos != -1) { - db_set_ts(hContact, MODULE, "LastName", sep + 1); - display_name[mir_tstrlen(display_name) - mir_tstrlen(sep)] = '\0'; - db_set_ts(hContact, MODULE, "FirstName", display_name); + db_set_ts(hContact, MODULE, "LastName", tszDisplayName.Mid(pos+1)); + db_set_ts(hContact, MODULE, "FirstName", tszDisplayName.Left(pos)); } else { - db_set_ts(hContact, MODULE, "FirstName", display_name); + db_set_ts(hContact, MODULE, "FirstName", tszDisplayName); db_unset(hContact, MODULE, "LastName"); } } @@ -104,8 +103,8 @@ void CDropbox::RequestAccountInfo() db_unset(hContact, MODULE, "Country"); else { - char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0); - db_set_s(hContact, MODULE, "Country", country); + char *szCountry = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0); + db_set_s(hContact, MODULE, "Country", szCountry); } } -- cgit v1.2.3