put local functions into unnamed namespaces

This commit is contained in:
unK
2008-09-27 20:54:32 +02:00
parent d61cb54653
commit 9b65b39126
7 changed files with 229 additions and 222 deletions

View File

@@ -32,30 +32,33 @@ pthread_mutex_t curl = PTHREAD_MUTEX_INITIALIZER;
bool data_ready = 0;
#endif
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
namespace
{
int result = 0;
if (buffer)
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
{
data += buffer;
result = size*nmemb;
int result = 0;
if (buffer)
{
data += buffer;
result = size*nmemb;
}
return result;
}
return result;
}
void EscapeHtml(string &str)
{
for (int i = str.find("<"); i != string::npos; i = str.find("<"))
void EscapeHtml(string &str)
{
int j = str.find(">")+1;
str.replace(i, j-i, "");
for (int i = str.find("<"); i != string::npos; i = str.find("<"))
{
int j = str.find(">")+1;
str.replace(i, j-i, "");
}
for (int i = str.find("&#039;"); i != string::npos; i = str.find("&#039;"))
str.replace(i, 6, "'");
for (int i = str.find("&quot;"); i != string::npos; i = str.find("&quot;"))
str.replace(i, 6, "\"");
for (int i = str.find("&amp;"); i != string::npos; i = str.find("&amp;"))
str.replace(i, 5, "&");
}
for (int i = str.find("&#039;"); i != string::npos; i = str.find("&#039;"))
str.replace(i, 6, "'");
for (int i = str.find("&quot;"); i != string::npos; i = str.find("&quot;"))
str.replace(i, 6, "\"");
for (int i = str.find("&amp;"); i != string::npos; i = str.find("&amp;"))
str.replace(i, 5, "&");
}
#ifdef HAVE_CURL_CURL_H