Why perform the same logic twice?
#1
Question 
Dear:

From:

http://xbmc.svn.sourceforge.net/viewvc/x...iew=markup


2809 int CXbmcHttp::xbmcGetSystemInfoByName(int numParas, CStdString paras[])
2810 {
2811 if (numParas<1)
2812 return SetResponse(openTag+"Error:Missing Parameter");
2813 else
2814 {
2815 CStdString strInfo = "";
2816 int i;
2817 for (i=0; i<numParas; i++)
2818 {
2819 CStdString strTemp = (CStdString) g_infoManager.GetLabel(g_infoManager.TranslateString(paras[i]));
2820 if (strTemp.IsEmpty())
2821 strTemp = "Error:No information retrieved for " + paras[i];
2822 strInfo += openTag + strTemp;
2823 }
2824 if(strInfo.Find("�") && strInfo.Find("�"))
2825 {
2826 // The Charset Converter ToUtf8() will add. only in this case= "�" a char "°" during converting,
2827 // which is the right value for the GUI!
2828 // A length depending fix in CCharsetConverter:ConfusedtringCharsetToUtf8() will couse a wrong char in GUI.
2829 // So just for http, we remove the "�", to fix BUG ID:[1586251]
2830 strInfo.Replace("�","");
2831 }
2832 return SetResponse(strInfo);
2833 }
2834 }

I fail to understand the logic of line 2824 in XBMChttp.cpp

2824 if(strInfo.Find("�") && strInfo.Find("�"))

why do we find the same thing twice?
Reply
#2
Note:

my system fail to display the string in strInfo.Find("")

I must modify it as
if(strInfo.Find("\xEF\xBF\xBD") && strInfo.Find("\xEF\xBF\xBD"))
{
// The Charset Converter ToUtf8() will add. only in this case= "�" a char "°" during converting,
// which is the right value for the GUI!
// A length depending fix in CCharsetConverter:ConfusedtringCharsetToUtf8() will couse a wrong char in GUI.
// So just for http, we remove the "�", to fix BUG ID:[1586251]
strInfo.Replace("\xEF\xBF\xBD","");
}

after the modification, I just find the code find the same string twice
Why?
Reply
#3
if you plan to paste code in the forums (which is highly dubious in the first place!), atleast use a friggan [code] block! Wink
Reply
#4
Don't bother digging in the httpd/api related code. The current stuff is garbage. There is a branch reaching merge to completely rip it out for something much cleaner.
Reply
#5
althekiller Wrote:Don't bother digging in the httpd/api related code. The current stuff is garbage. There is a branch reaching merge to completely rip it out for something much cleaner.

Good News, thanks
Reply

Logout Mark Read Team Forum Stats Members Help
Why perform the same logic twice?0