Bug#548616: fails to build with gcc-4.4
Package: licq
Version: 1.3.6-2
Severity: normal
Tags: patch
Hi,
during Ubuntu's rebuild test, licq failed to build with gcc-4.4 [1].
The reason is that the c++ string functions have changed signatures.
Attached is a small patch to fix this problem. The hunks referring
to plugins/msn are still a little bit ugly, as actually a const argument
gets modified (which was also the case before), and the fix in the patch
is to use the const_cast hammer :/.
Cheers,
Stefan.
[1]:
<http://launchpadlibrarian.net/31885185/buildlog_ubuntu-karmic-amd64.licq_1.3.6-2_FAILEDTOBUILD.txt.gz>
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/plugins/msn/src/msn-sb.cpp licq-1.3.6.new/plugins/msn/src/msn-sb.cpp
--- licq-1.3.6/plugins/msn/src/msn-sb.cpp 2008-08-17 15:34:41.000000000 +0200
+++ licq-1.3.6.new/plugins/msn/src/msn-sb.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -441,7 +441,7 @@
const char *szParam = strServer.c_str();
char szServer[16];
char *szPort;
- if ((szPort = strchr(szParam, ':')))
+ if ((szPort = const_cast<char *>(strchr(szParam, ':'))))
{
strncpy(szServer, szParam, szPort - szParam);
szServer[szPort - szParam] = '\0';
@@ -504,7 +504,7 @@
const char *szParam = strServer.c_str();
char szServer[16];
char *szPort;
- if ((szPort = strchr(szParam, ':')))
+ if ((szPort = const_cast<char *>(strchr(szParam, ':'))))
{
strncpy(szServer, szParam, szPort - szParam);
szServer[szPort - szParam] = '\0';
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/plugins/msn/src/msn-srv.cpp licq-1.3.6.new/plugins/msn/src/msn-srv.cpp
--- licq-1.3.6/plugins/msn/src/msn-srv.cpp 2008-08-11 18:06:38.000000000 +0200
+++ licq-1.3.6.new/plugins/msn/src/msn-srv.cpp 2009-09-27 15:47:42.000000000 +0200
@@ -76,7 +76,7 @@
const char *szParam = strServer.c_str();
char szNewServer[16];
char *szPort;
- if ((szPort = strchr(szParam, ':')))
+ if ((szPort = const_cast<char *>(strchr(szParam, ':'))))
{
strncpy(szNewServer, szParam, szPort - szParam);
szNewServer[szPort - szParam] = '\0';
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/plugins/msn/src/msn-ssl.cpp licq-1.3.6.new/plugins/msn/src/msn-ssl.cpp
--- licq-1.3.6/plugins/msn/src/msn-ssl.cpp 2008-09-07 16:03:53.000000000 +0200
+++ licq-1.3.6.new/plugins/msn/src/msn-ssl.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -68,7 +68,7 @@
if (strFirstLine == "HTTP/1.1 200 OK")
{
m_pSSLPacket->ParseHeaders();
- char *fromPP = strstr(m_pSSLPacket->GetValue("Authentication-Info").c_str(), "from-PP=");
+ const char *fromPP = strstr(m_pSSLPacket->GetValue("Authentication-Info").c_str(), "from-PP=");
char *tag;
if (fromPP == 0)
@@ -76,7 +76,7 @@
else
{
fromPP+= 9; // skip to the tag
- char *endTag = strchr(fromPP, '\'');
+ const char *endTag = strchr(fromPP, '\'');
tag = strndup(fromPP, endTag - fromPP); // Thanks, this is all we need
}
@@ -146,7 +146,7 @@
m_pNexusBuff->ParseHeaders();
- char *szLogin = strstr(m_pNexusBuff->GetValue("PassportURLs").c_str(), "DALogin=");
+ const char *szLogin = strstr(m_pNexusBuff->GetValue("PassportURLs").c_str(), "DALogin=");
szLogin += 8; // skip to the tag
//char *szEndURL = strchr(szLogin, '/');
//char *szServer = strndup(szLogin, szEndURL - szLogin); // this is all we need
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/file.cpp licq-1.3.6.new/src/file.cpp
--- licq-1.3.6/src/file.cpp 2008-09-13 15:58:45.000000000 +0200
+++ licq-1.3.6.new/src/file.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -552,7 +552,7 @@
bool bTrim, int _nMax)
{
//static char s_szData[MAX_LINE_LEN];
- char *szPostEquals;
+ const char *szPostEquals;
char szData[MAX_LINE_LEN];
int nMax = (_nMax > 0 ? _nMax : MAX_LINE_LEN);
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/icqd-filetransfer.cpp licq-1.3.6.new/src/icqd-filetransfer.cpp
--- licq-1.3.6/src/icqd-filetransfer.cpp 2008-07-25 22:34:44.000000000 +0200
+++ licq-1.3.6.new/src/icqd-filetransfer.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -102,7 +102,7 @@
m_bValid = true;
m_nError = 0;
- char *pcNoPath = NULL;
+ const char *pcNoPath = NULL;
struct stat buf;
// Remove any path from the filename
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/icqpacket.cpp licq-1.3.6.new/src/icqpacket.cpp
--- licq-1.3.6/src/icqpacket.cpp 2008-08-23 18:04:35.000000000 +0200
+++ licq-1.3.6.new/src/icqpacket.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -5874,7 +5874,7 @@
}
// Remove path from filename (if it exists)
- char *pcEndOfPath = strrchr(_szFilename, '/');
+ const char *pcEndOfPath = strrchr(_szFilename, '/');
if (pcEndOfPath != NULL)
m_szFilename = strdup(pcEndOfPath + 1);
else
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/licq.cpp licq-1.3.6.new/src/licq.cpp
--- licq-1.3.6/src/licq.cpp 2008-06-11 20:34:35.000000000 +0200
+++ licq-1.3.6.new/src/licq.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -183,14 +183,14 @@
/*-----Helper functions for CLicq::UpgradeLicq-----------------------------*/
int SelectUserUtility(const struct dirent *d)
{
- char *pcDot = strrchr(d->d_name, '.');
+ const char *pcDot = strrchr(d->d_name, '.');
if (pcDot == NULL) return (0);
return (strcmp(pcDot, ".uin") == 0);
}
int SelectHistoryUtility(const struct dirent *d)
{
- char *pcDot = strchr(d->d_name, '.');
+ const char *pcDot = strchr(d->d_name, '.');
if (pcDot == NULL) return (0);
return (strcmp(pcDot, ".history") == 0 ||
strcmp(pcDot, ".history.removed") == 0);
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/rtf.cc licq-1.3.6.new/src/rtf.cc
--- licq-1.3.6/src/rtf.cc 2007-06-20 23:41:54.000000000 +0200
+++ licq-1.3.6.new/src/rtf.cc 2009-09-27 15:47:12.000000000 +0200
@@ -2141,7 +2141,7 @@
return;
}
if (m_bFontName){
- char *pp = strchr(str, ';');
+ const char *pp = strchr(str, ';');
unsigned size = strlen(pp);
if (pp){
size = (pp - str);
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/translate.cpp licq-1.3.6.new/src/translate.cpp
--- licq-1.3.6/src/translate.cpp 2008-07-02 16:02:49.000000000 +0200
+++ licq-1.3.6.new/src/translate.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -76,7 +76,7 @@
bool CTranslator::setTranslationMap(const char* mapFileName)
{
// Map name is the file name with no path
- char* sep = strrchr(mapFileName, '/');
+ const char* sep = strrchr(mapFileName, '/');
const char* mapName = (sep == NULL ? mapFileName : sep + 1);
if (strcmp(mapName, "LATIN_1") == 0)
diff -Nur -x '*.orig' -x '*~' licq-1.3.6/src/utility.cpp licq-1.3.6.new/src/utility.cpp
--- licq-1.3.6/src/utility.cpp 2008-07-25 22:34:44.000000000 +0200
+++ licq-1.3.6.new/src/utility.cpp 2009-09-27 15:47:12.000000000 +0200
@@ -46,7 +46,7 @@
//=====CUtilityManager==========================================================
int SelectUtility(const struct dirent *d)
{
- char *pcDot = strrchr(d->d_name, '.');
+ const char *pcDot = strrchr(d->d_name, '.');
if (pcDot == NULL) return (0);
return (strcmp(pcDot, ".utility") == 0);
}
Reply to: