Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 1536a29c authored by Joachim Eibl's avatar Joachim Eibl

Patch from Nigel Stewart: Fix for git on Cygwin

git-svn-id: https://kdiff3.svn.sourceforge.net/svnroot/kdiff3/trunk@157 c8aa9fed-2811-0410-8543-893ada326672
parent 7d907c64
// uninstallHelper.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <string>
#include <vector>
#include <list>
......@@ -196,7 +195,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
bool bSuccess = readAndParseMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error reading original map file.\n";
fprintf(stderr, "Error reading original map file.\n");
return -1;
}
......@@ -205,7 +204,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
{
if ( rename( path.c_str(), bakName.c_str() ) )
{
std::cerr << "Error renaming original map file.\n";
fprintf(stderr, "Error renaming original map file.\n");
return -1;
}
}
......@@ -231,9 +230,9 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
if ( !bSuccess )
{
if ( rename( bakName.c_str(), path.c_str() ) )
std::cerr << "Error writing new map file, restoring old file also failed.\n";
fprintf(stderr, "Error writing new map file, restoring old file also failed.\n");
else
std::cerr << "Error writing new map file, old file restored.\n";
fprintf(stderr, "Error writing new map file, old file restored.\n");
return -1;
}
......@@ -244,7 +243,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
bool bSuccess = readAndParseMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error reading original map file\n.";
fprintf(stderr, "Error reading original map file\n.");
return -1;
}
......@@ -252,7 +251,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
bSuccess = readAndParseMapFile( bakName, lineItemListBak );
if ( !bSuccess )
{
std::cerr << "Error reading backup map file.\n";
fprintf(stderr, "Error reading backup map file.\n");
return -1;
}
......@@ -278,8 +277,7 @@ int integrateWithClearCase( const char* subCommand, const char* kdiff3CommandPat
bSuccess = writeMapFile( path, lineItemList );
if ( !bSuccess )
{
std::cerr << "Error writing map file.";
fprintf(stderr, "Error writing map file.");
return -1;
}
}
......@@ -308,7 +306,7 @@ void __declspec(dllexport) nsisPlugin(HWND hwndParent, int string_size,
install( param1.c_str(), param2.c_str() );
return;
}
std::cerr << "Not enough parameters." << std::endl;
fprintf(stderr, "Not enough parameters.\n");
}
}
......
......@@ -16,9 +16,8 @@
***************************************************************************/
#include "stable.h"
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include "diff.h"
#include "fileaccess.h"
......@@ -1879,7 +1878,7 @@ void debugLineCheck( Diff3LineList& d3ll, int size, int idx )
"If it is reproducible please contact the author.\n"
), i18n("Severe Internal Error") );
assert(false);
std::cerr << "Severe Internal Error.\n";
fprintf(stderr, "Severe Internal Error.\n");
::exit(-1);
}
++i;
......@@ -1893,7 +1892,7 @@ void debugLineCheck( Diff3LineList& d3ll, int size, int idx )
"If it is reproducible please contact the author.\n"
), i18n("Severe Internal Error") );
assert(false);
std::cerr << "Severe Internal Error.\n";
fprintf(stderr, "Severe Internal Error.\n");
::exit(-1);
}
}
......
......@@ -115,7 +115,7 @@ struct Diff3Line
pFineAB=0; pFineBC=0; pFineCA=0;
}
bool operator==( const Diff3Line& d3l )
bool operator==( const Diff3Line& d3l ) const
{
return lineA == d3l.lineA && lineB == d3l.lineB && lineC == d3l.lineC
&& bAEqB == d3l.bAEqB && bAEqC == d3l.bAEqC && bBEqC == d3l.bBEqC;
......
......@@ -45,7 +45,6 @@
#include <klocale.h>
#include <ktoggleaction.h>
#include <iostream>
#include <assert.h>
//#include <konq_popupmenu.h>
......
......@@ -25,7 +25,7 @@
#include <vector>
#include <cstdlib>
#include <iostream>
#include <klocale.h>
#include <ktemporaryfile.h>
#include <kio/global.h>
......@@ -308,10 +308,26 @@ void FileAccess::setFile( const QString& name, bool bWantToWrite )
if ( url.isLocalFile() || url.isRelative() || !url.isValid() || bExistsLocal ) // assuming that invalid means relative
{
QString localName = name;
#if defined(Q_WS_WIN)
if ( !bExistsLocal )
{
// git on Cygwin will put files in /tmp
// A workaround for the a native kdiff3 binary to find them...
QString cygwinBin = getenv("CYGWIN_BIN");
if (localName.startsWith("/tmp/") && !cygwinBin.isEmpty() )
{
localName = QString("%1\\..%2").arg(cygwinBin).arg(name);
}
}
#endif
if ( !bExistsLocal && url.isLocalFile() && name.left(5).toLower()=="file:" )
{
localName = url.path(); // I want the path without preceding "file:"
}
QFileInfo fi( localName );
setFile( fi, 0 );
}
......
......@@ -18,8 +18,7 @@
#include "difftextwindow.h"
#include "mergeresultwindow.h"
#include <iostream>
#include <assert.h>
#include <cassert>
// include files for QT
#include <QDir>
......@@ -113,7 +112,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
{
setObjectName( "KDiff3App" );
m_pKDiff3Part = pKDiff3Part;
m_pKDiff3Shell = dynamic_cast<KParts::MainWindow*>(pParent);
m_pKDiff3Shell = qobject_cast<KParts::MainWindow*>(pParent);
setWindowTitle( "KDiff3" );
setOpaqueResize(false); // faster resizing
......@@ -191,8 +190,8 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
pDialog->resize(600,400);
pDialog->exec();
#else
std::cerr << title.toLatin1().constData() << std::endl;
std::cerr << s.toLatin1().constData() << std::endl;
fprintf(stderr, "%s\n", title.toLatin1().constData());
fprintf(stderr, "%s\n", s.toLatin1().constData());
#endif
exit(1);
}
......@@ -216,7 +215,7 @@ KDiff3App::KDiff3App(QWidget* pParent, const char* /*name*/, KDiff3Part* pKDiff3
if ( m_bAutoFlag )
{
//KMessageBox::information(this, i18n("Option --auto used, but no output file specified."));
std::cerr << (const char*)i18n("Option --auto used, but no output file specified.").toLatin1() << std::endl;
fprintf(stderr, "%s\n", (const char*)i18n("Option --auto used, but no output file specified.").toLatin1());
}
m_bAutoMode = false;
}
......@@ -366,7 +365,7 @@ void KDiff3App::completeInit( const QString& fn1, const QString& fn2, const QStr
if ( m_bAutoFlag && m_bAutoMode && m_bDirCompare )
{
std::cerr << (const char*)i18n("Option --auto ignored for directory comparison.").toLatin1()<<std::endl;
fprintf(stderr, "%s\n", (const char*)i18n("Option --auto ignored for directory comparison.").toLatin1());
m_bAutoMode = false;
}
if (!m_bDirCompare)
......
......@@ -33,7 +33,6 @@
#include <kmessagebox.h>
#include <klocale.h>
#include <iostream>
#include "version.h"
......@@ -48,7 +47,7 @@ KDiff3Part::KDiff3Part( QWidget *parentWidget, const char *widgetName,
m_widget = new KDiff3App( parentWidget, widgetName, this );
// This hack is necessary to avoid a crash when the program terminates.
m_bIsShell = dynamic_cast<KParts::MainWindow*>(parentWidget)!=0;
m_bIsShell = qobject_cast<KParts::MainWindow*>(parentWidget)!=0;
// notify the part that this is our internal widget
setWidget(m_widget);
......@@ -111,7 +110,7 @@ static void getNameAndVersion( const QString& str, const QString& lineStart, QSt
{
while (pos2>pos && str[pos2]!=' ' && str[pos2]!='\t') --pos2;
fileName = str.mid( pos, pos2-pos );
std::cerr << "KDiff3: " << fileName.toLatin1().constData() << std::endl;
fprintf(stderr, "KDiff3: %s\n", fileName.toLatin1().constData());
if ( FileAccess(fileName).exists() ) break;
--pos2;
}
......@@ -130,7 +129,7 @@ static void getNameAndVersion( const QString& str, const QString& lineStart, QSt
bool KDiff3Part::openFile()
{
// m_file is always local so we can use QFile on it
std::cerr << "KDiff3: " << localFilePath().toLatin1().constData() << std::endl;
fprintf(stderr, "KDiff3: %s\n", localFilePath().toLatin1().constData());
QFile file(localFilePath());
if (file.open(QIODevice::ReadOnly) == false)
return false;
......@@ -202,7 +201,7 @@ bool KDiff3Part::openFile()
}
else if ( !version1.isEmpty() && !version2.isEmpty() )
{
std::cerr << "KDiff3: f1/2:" << fileName1.toLatin1().constData() <<"<->"<<fileName2.toLatin1().constData()<< std::endl;
fprintf(stderr, "KDiff3: f1/2:%s<->%s\n", fileName1.toLatin1().constData(), fileName2.toLatin1().constData());
// Assuming that files are on CVS: Try to get them
// cvs update -p -r [REV] [FILE] > [OUTPUTFILE]
......
......@@ -36,8 +36,6 @@
#include <kstatusbar.h>
#include <klocale.h>
#include <iostream>
#include <QStatusBar>
#include <QCloseEvent>
#include <ktoolbar.h>
......
......@@ -26,7 +26,11 @@
#include <QMenu>
#include <QMenuBar>
#include <QPainter>
#ifndef QT_NO_COLORDIALOG
#include <QColorDialog>
#endif
#include <QFontDialog>
#include <QLabel>
#include <QTextBrowser>
......@@ -42,7 +46,6 @@
#include <QFileDialog>
#include <vector>
#include <iostream>
#include <algorithm>
......@@ -58,6 +61,7 @@ static KAboutData* s_pAboutData;
#ifdef _WIN32
#include <process.h>
#include <windows.h>
#include <shellapi.h>
#endif
static void showHelp()
......@@ -310,6 +314,8 @@ KMainWindow::KMainWindow( QWidget* parent )
memberList = new QList<KMainWindow*>;
memberList->append(this);
raise();
}
KToolBar* KMainWindow::toolBar(const QString&)
......@@ -836,9 +842,11 @@ void KColorButton::paintEvent( QPaintEvent* e )
void KColorButton::slotClicked()
{
#ifndef QT_NO_COLORDIALOG
// Under Windows ChooseColor() should be used. (Nicer if few colors exist.)
QColor c = QColorDialog::getColor ( m_color, this );
if ( c.isValid() ) m_color = c;
#endif
update();
}
......@@ -1143,7 +1151,7 @@ KApplication::KApplication()
if ( 0==QMessageBox::information(0, i18n("KDiff3-Usage"), s, i18n("Ignore"),i18n("Exit") ) )
continue;
#else
std::cerr << s.toLatin1().constData() << std::endl;
fprintf(stderr, "%s\n", s.toLatin1().constData());
#endif
::exit(-1);
......@@ -1215,7 +1223,7 @@ KLibFactory* KLibLoader::factory(QString const&)
QObject* KLibFactory::create(QObject* pParent, const QString& name, const QString& classname )
{
KParts::Factory* f = dynamic_cast<KParts::Factory*>(this);
KParts::Factory* f = qobject_cast<KParts::Factory*>(this);
if (f!=0)
return f->createPartObject( (QWidget*)pParent, name.toAscii(),
pParent, name.toAscii(),
......
......@@ -577,6 +577,7 @@ namespace KParts
{
class MainWindow : public KMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget* parent=0 ) : KMainWindow(parent) {}
void setXMLFile(const QString&){}
......
......@@ -87,7 +87,7 @@ static bool isOptionUsed(const QString& s, int argc, char* argv[])
{
for(int j=0; j<argc; ++j )
{
if( "-"+s == argv[j] || "--"+s==argv[j] )
if( QString("-"+s) == argv[j] || QString("--"+s)==argv[j] )
{
return true;
}
......@@ -243,11 +243,13 @@ int main(int argc, char *argv[])
}
#endif
#ifndef QT_NO_SESSIONMANAGER
if (app.isSessionRestored())
{
RESTORE(KDiff3Shell);
}
else
#endif
{
KDiff3Shell* p = new KDiff3Shell();
p->show();
......
......@@ -17,8 +17,6 @@
#include "merger.h"
#include <assert.h>
#include <iostream>
#include <iomanip>
Merger::Merger( const DiffList* pDiffListAB, const DiffList* pDiffListCA )
: md1( pDiffListAB, 0 ), md2( pDiffListCA, 1 )
......
......@@ -50,7 +50,6 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <iostream>
int g_bAutoSolve = true;
......@@ -3222,8 +3221,8 @@ void WindowTitleWidget::setLineEndStyles( e_LineEndStyle eLineEndStyleA, e_LineE
if ( eLineEndStyleC == eLineEndStyleUnix )
unxUsers += (unxUsers.isEmpty() ? "" : ", ") + QString("C");
m_pLineEndStyleSelector->addItem( i18n("Unix") + (unxUsers.isEmpty() ? "" : " (" + unxUsers + ")" ) );
m_pLineEndStyleSelector->addItem( i18n("DOS") + (dosUsers.isEmpty() ? "" : " (" + dosUsers + ")" ) );
m_pLineEndStyleSelector->addItem( i18n("Unix") + (unxUsers.isEmpty() ? QString("") : " (" + unxUsers + ")" ) );
m_pLineEndStyleSelector->addItem( i18n("DOS") + (dosUsers.isEmpty() ? QString("") : " (" + dosUsers + ")" ) );
e_LineEndStyle autoChoice = (e_LineEndStyle)m_pOptionDialog->m_lineEndStyle;
......
......@@ -52,8 +52,6 @@
#include "diff.h"
#include "smalldialogs.h"
#include <iostream>
#ifndef KREPLACEMENTS_H
#include <kglobalsettings.h>
#endif
......@@ -1453,7 +1451,7 @@ static const char* countryMap[]={
for(countryIdx=0; countryIdx< sizeof(countryMap)/sizeof(countryMap[0]); ++countryIdx )
{
QString fullName = countryMap[countryIdx];
if ( languageId+" " == fullName.left(languageId.length()+1) )
if ( QString(languageId+" ") == fullName.left(languageId.length()+1) )
{
languageId += " (" + fullName.mid(languageId.length()+1) + ")";
}
......
......@@ -21,7 +21,6 @@
#include "directorymergewindow.h"
#include "smalldialogs.h"
#include <iostream>
#include <algorithm>
#include <ctype.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment