Skip to content
Snippets Groups Projects
Commit 0274f175 authored by Bertrand Bellenot's avatar Bertrand Bellenot
Browse files

Fix several coverity reports (uninitialized variables and possible buffer overflows)

git-svn-id: http://root.cern.ch/svn/root/trunk@33896 27541ba8-7e3a-0410-8455-c3a389f83636
parent 43ec8f65
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,12 @@ TQCanvasMenu::TQCanvasMenu(QWidget* parent, TCanvas *canvas)
{
// ctor, create the popup menu
fc=canvas;
fPopup = new QPopupMenu;
fCurrObj=0;
fParent= parent;
fTabWin=0;
fc = canvas;
fPopup = new QPopupMenu;
fCurrObj = 0;
fParent = parent;
fTabWin = 0;
fDialog = 0;
}
//______________________________________________________________________________
......@@ -54,11 +55,12 @@ TQCanvasMenu::TQCanvasMenu(QWidget* parent, QWidget *tabWin, TCanvas *canvas)
{
// ctor, create the popup menu
fc=canvas;
fPopup = new QPopupMenu;
fParent = parent;
fTabWin = tabWin;
fCurrObj=0;
fc = canvas;
fPopup = new QPopupMenu;
fParent = parent;
fTabWin = tabWin;
fCurrObj = 0;
fDialog = 0;
}
//______________________________________________________________________________
......@@ -92,10 +94,11 @@ char *TQCanvasMenu::CreateArgumentTitle(TMethodArg *argument)
static Char_t argTitle[128];
if (argument) {
snprintf(argTitle, 127, "(%s) %s", argument->GetTitle(), argument->GetName());
if (argument->GetDefault() && *(argument->GetDefault())) {
strcat(argTitle, " [default: ");
strcat(argTitle, argument->GetDefault());
strcat(argTitle, "]");
const char *arg_def = argument->GetDefault();
if (arg_def && *arg_def) {
strncat(argTitle, " [default: ", 127 - strlen(argTitle));
strncat(argTitle, arg_def, 127 - strlen(argTitle));
strncat(argTitle, "]", 127 - strlen(argTitle));
}
}
else
......
......@@ -43,12 +43,13 @@ void qMessageOutput( QtMsgType type, const char *msg )
}
//______________________________________________________________________________
TQRootApplication::TQRootApplication(int &argc, char **argv, int poll):QApplication(argc,argv)
TQRootApplication::TQRootApplication(int &argc, char **argv, int poll) :
QApplication(argc,argv), fQTimer(0), fRTimer(0)
{
// Connect ROOT via Timer call back.
if (poll == 0) {
QTimer *fQTimer= new QTimer( this );
fQTimer = new QTimer( this );
QObject::connect( fQTimer, SIGNAL(timeout()),this, SLOT(Execute()) );
fQTimer->start( 20, FALSE );
fRTimer = new TTimer(20);
......@@ -56,7 +57,7 @@ TQRootApplication::TQRootApplication(int &argc, char **argv, int poll):QApplicat
}
// install a msg-handler
fgWarning=fgDebug=kFALSE;
fgWarning = fgDebug = kFALSE;
qInstallMsgHandler( qMessageOutput );
}
......
......@@ -155,11 +155,12 @@ void TQRootCanvas::mousePressEvent( QMouseEvent *e )
selectedOpt = pickobj->GetOption();
}
}
pad->cd();
fCanvas->SetSelectedPad(pad);
}
pad->cd();
fCanvas->SetSelectedPad(pad);
gROOT->SetSelectedPrimitive(selected);
fContextMenu->Popup(selected,gPad->AbsPixeltoX(gPad->GetEventX()), gPad->AbsPixeltoY(gPad->GetEventY()), e);
fContextMenu->Popup(selected, gPad->AbsPixeltoX(gPad->GetEventX()),
gPad->AbsPixeltoY(gPad->GetEventY()), e);
break;
case MidButton :
......
......@@ -86,20 +86,20 @@ void TQRootDialog::ExecuteMethod()
}
}
else if ( strcmp(fCurMethod->GetName(),"SetCanvasSize") == 0 ) {
int value[2];
int value[2] = {0,0};
int l=0;
#if (QT_VERSION > 0x039999) // Added by cholm@nbi.dk - for Qt 4
for (iter st = fList.begin(); st != fList.end(); ++st) {
QString s = (*st)->text();
value[l++] = atoi ( s );
}
for (iter st = fList.begin(); st != fList.end(); ++st) {
QString s = (*st)->text();
value[l++] = atoi ( s );
}
#else
for ( QLineEdit* st = fList.first(); st; st = fList.next()) {
QString s = st->text();
value[l++] = atoi ( s );
}
#endif
fParent->resize(value[0],value[1]);
fParent->resize(value[0], value[1]);
}
else {
// here call cint call
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment