[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: [PATCH] make kdebase compile with gcc 3.4+
From: Dirk Mueller <mueller () kde ! org>
Date: 2003-12-08 22:32:00
[Download RAW message or body]
Hi,
the font kcontrol stuff uses some unportable STL parts that do no longer
compile. I've spent some time trying to figure out how to make it work again,
but failed.
I just rewrote it to use QFile, which works and is even shorter.
Please review.
["remove_uncompileable_stl_stuff.diff" (text/x-diff)]
Index: fonts/kxftconfig.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/fonts/kxftconfig.cpp,v
retrieving revision 1.25
diff -u -3 -d -p -r1.25 kxftconfig.cpp
--- fonts/kxftconfig.cpp 31 Oct 2003 11:00:27 -0000 1.25
+++ fonts/kxftconfig.cpp 8 Dec 2003 22:28:26 -0000
@@ -415,30 +415,27 @@ bool KXftConfig::reset()
if(m_doc.documentElement().isNull())
m_doc.appendChild(m_doc.createElement("fontconfig"));
#else
- std::ifstream f(QFile::encodeName(m_file));
+ QFile f( m_file );
m_size=0;
-
if(m_data)
{
delete [] m_data;
m_data=NULL;
}
- if(f)
+ if(f.open( IO_Raw| IO_ReadOnly ))
{
- f.seekg(0, std::ios::end);
- m_size=f.tellg();
-
+ m_size = f.size();
ok=true;
+
if(m_size>0)
{
m_data=new char [m_size+1];
if(m_data)
{
- f.seekg(0, std::ios::beg);
- f.read(m_data, m_size);
+ f.readBlock( m_data, m_size );
m_data[m_size]='\0';
readContents();
}
Index: kfontinst/lib/XConfig.cpp
===================================================================
RCS file: /home/kde/kdebase/kcontrol/kfontinst/lib/XConfig.cpp,v
retrieving revision 1.6
diff -u -3 -d -p -r1.6 XConfig.cpp
--- kfontinst/lib/XConfig.cpp 31 Oct 2003 09:49:02 -0000 1.6
+++ kfontinst/lib/XConfig.cpp 8 Dec 2003 22:28:28 -0000
@@ -535,15 +535,14 @@ static char * getItem(char **start, char
bool CXConfig::processXf86(bool read)
{
- ifstream xf86(QFile::encodeName(itsFileName));
+ QFile xf86(itsFileName);
bool ok=false;
- if(xf86)
+ if(xf86.open( IO_Raw|IO_ReadOnly ))
{
bool closed=false;
- xf86.seekg(0, ios::end);
- unsigned int size=xf86.tellg();
+ unsigned int size=xf86.size();
if(read)
itsPaths.clear();
@@ -554,10 +553,7 @@ bool CXConfig::processXf86(bool read)
if(buffer)
{
- xf86.seekg(0, ios::beg);
- xf86.read(buffer, size);
-
- if(xf86.good())
+ if(xf86.readBlock( buffer, size ) == size)
{
char *filesStart=NULL,
*filesEnd=NULL;
@@ -748,15 +744,14 @@ static char * getXfsPath(char *buffer, u
bool CXConfig::processXfs(bool read)
{
- ifstream xfs(QFile::encodeName(itsFileName));
+ QFile xfs(itsFileName);
bool ok=false;
- if(xfs)
+ if(xfs.open( IO_Raw|IO_ReadOnly ))
{
bool closed=false;
- xfs.seekg(0, ios::end);
- unsigned int size=xfs.tellg();
+ unsigned int size=xfs.size();
if(read)
itsPaths.clear();
@@ -767,10 +762,7 @@ bool CXConfig::processXfs(bool read)
if(buffer)
{
- xfs.seekg(0, ios::beg);
- xfs.read(buffer, size);
-
- if(xfs.good())
+ if ( xfs.readBlock(buffer, size) == size )
{
const char *constCatalogueStr="catalogue";
char *cat=NULL;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic