[Uml-devel] KDE/kdesdk/umbrello/umbrello [POSSIBLY UNSAFE]
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Sep 14 05:32:10 UTC 2007
SVN commit 712264 by okellogg:
Patch by Andi Fischer fixes some warnings for 'upper' and 'ascii'.
CCMAIL: andi.fischer at hispeed.ch
M +1 -1 codegenerators/codegen_utils.cpp
M +1 -1 codegenerators/cppheadercodedocument.cpp
M +2 -2 codegenerators/cppwriter.cpp
M +1 -1 codegenerators/dcodegenerator.cpp
M +1 -1 codegenerators/javawriter.cpp
M +1 -1 codegenerators/perlwriter.cpp
M +2 -2 codegenerators/pythonwriter.cpp
M +1 -1 codeimport/idlimport.cpp [POSSIBLY UNSAFE: popen]
M +1 -1 umlnamespace.h
M +18 -13 umlviewimageexportermodel.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegen_utils.cpp #712263:712264
@@ -406,7 +406,7 @@
QString capitalizeFirstLetter(const QString &string) {
QChar firstChar = string.at(0);
- return firstChar.upper() + string.mid(1);
+ return firstChar.toUpper() + string.mid(1);
}
} // end namespace Codegen_Utils
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppheadercodedocument.cpp #712263:712264
@@ -422,7 +422,7 @@
// Write the hash define stuff to prevent multiple parsing/inclusion of header
QString cppClassName = CodeGenerator::cleanName(c->getName());
- QString hashDefine = CodeGenerator::cleanName(c->getName().upper().simplified());
+ QString hashDefine = CodeGenerator::cleanName(c->getName().toUpper().simplified());
QString defText = "#ifndef "+hashDefine + "_H"+ endLine + "#define "+ hashDefine + "_H";
addOrUpdateTaggedCodeBlockWithComments("hashDefBlock", defText, "", 0, false);
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #712263:712264
@@ -147,7 +147,7 @@
}
// Write the hash define stuff to prevent multiple parsing/inclusion of header
- QString hashDefine = m_classifierInfo->className.upper().simplified().replace(QRegExp(" "), "_");
+ QString hashDefine = m_classifierInfo->className.toUpper().simplified().replace(QRegExp(" "), "_");
writeBlankLine(h);
h << "#ifndef "<< hashDefine + "_H" << m_endl;
h << "#define "<< hashDefine + "_H" << m_endl;
@@ -624,7 +624,7 @@
// from what I can tell, this IS the default behavior for
// cleanName. I dunno why its not working -b.t.
methodBaseName = methodBaseName.trimmed();
- methodBaseName.replace(0,1,methodBaseName.at(0).upper());
+ methodBaseName.replace(0,1,methodBaseName.at(0).toUpper());
writeSingleAttributeAccessorMethods(at->getTypeName(), varName,
methodBaseName, at->getDoc(), Uml::chg_Changeable, isHeaderMethod,
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/dcodegenerator.cpp #712263:712264
@@ -88,7 +88,7 @@
// we could lowercase everything tostart and then capitalize? Nah, it would
// screw up formatting like getMyRadicalVariable() to getMyradicalvariable(). Bah.
QChar firstChar = string.at(0);
- return firstChar.upper() + string.mid(1);
+ return firstChar.toUpper() + string.mid(1);
}
// IF the type is "string" we need to declare it as
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/javawriter.cpp #712263:712264
@@ -395,7 +395,7 @@
// force capitalizing the field name, this is silly,
// from what I can tell, this IS the default behavior for
// cleanName. I dunno why its not working -b.t.
- fieldName.replace(0,1,fieldName.at(0).upper());
+ fieldName.replace(0,1,fieldName.at(0).toUpper());
writeSingleAttributeAccessorMethods(at->getTypeName(),
cleanName(at->getName()),
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/perlwriter.cpp #712263:712264
@@ -222,7 +222,7 @@
//Write class Documentation
if(forceDoc() || !c->getDoc().isEmpty()) {
perl << m_endl << "=head1";
- perl << " " << classname.upper() << m_endl << m_endl;
+ perl << " " << classname.toUpper() << m_endl << m_endl;
perl << c->getDoc();
perl << m_endl << m_endl << "=cut" << m_endl << m_endl;
}
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/pythonwriter.cpp #712263:712264
@@ -62,7 +62,7 @@
QChar first = fileName.at(0);
//Replace the first letter of the filename because
//python class begin with an upper caracter (convention)
- first = first.upper();
+ first = first.toUpper();
fileName = fileName.replace(0, 1, first);
QFile fileh;
@@ -113,7 +113,7 @@
if ( !headerName.isEmpty() ) {
headerName.remove(QRegExp(".py$"));
first = headerName.at(0);
- first = first.upper();
+ first = first.toUpper();
headerName = headerName.replace(0, 1, first);
str = headerName.replace(QChar('/'),QChar('.'));
if (includesList.findIndex(str) < 0) // not yet imported
--- trunk/KDE/kdesdk/umbrello/umbrello/codeimport/idlimport.cpp #712263:712264
@@ -101,7 +101,7 @@
}
command += ' ' + filename;
uDebug() << "importIDL: " << command;
- FILE *fp = popen(command.ascii(), "r");
+ FILE *fp = popen(qPrintable(command), "r");
if (fp == NULL) {
uError() << "cannot popen(" << command << ")" << endl;
return;
--- trunk/KDE/kdesdk/umbrello/umbrello/umlnamespace.h #712263:712264
@@ -368,7 +368,7 @@
const IDType id_None = "-1";
const IDType id_Reserved = "0";
-# define STR2ID(id) id.toAscii().data()
+# define STR2ID(id) qPrintable(id)
# define ID2STR(id) QString(id.c_str())
// convenience macros for console output to the Umbrello area
--- trunk/KDE/kdesdk/umbrello/umbrello/umlviewimageexportermodel.cpp #712263:712264
@@ -16,15 +16,15 @@
#include <math.h>
// include files for Qt
-#include <QApplication>
-#include <QImageWriter>
-#include <qrect.h>
-#include <qimage.h>
-#include <qpicture.h>
-#include <qpainter.h>
-#include <qprinter.h>
-#include <qdir.h>
-#include <qregexp.h>
+#include <QtGui/QApplication>
+#include <QtGui/QImageWriter>
+#include <QtCore/QRect>
+#include <QtGui/QImage>
+#include <QtGui/QPicture>
+#include <QtGui/QPainter>
+#include <QtGui/QPrinter>
+#include <QtCore/QDir>
+#include <QtCore/QRegExp>
// kde include files
#include <kdebug.h>
@@ -325,7 +325,7 @@
}
bool UMLViewImageExporterModel::exportViewToSvg(UMLView* view, const QString &fileName) const {
- bool exportSuccesful;
+ bool exportSuccessful;
QPicture* diagram = new QPicture();
@@ -343,7 +343,7 @@
painter->translate(-rect.x(),-rect.y());
view->getDiagram(rect,*painter);
painter->end();
- exportSuccesful = diagram->save(fileName, QString("SVG").ascii());
+ exportSuccessful = diagram->save(fileName);
// delete painter and printer before we try to open and fix the file
delete painter;
@@ -351,12 +351,17 @@
// next painting will most probably be to a different device (i.e. the screen)
view->forceUpdateWidgetFontMetrics(0);
- return exportSuccesful;
+ uDebug() << "saving to file " << fileName << " successful=" << exportSuccessful << endl;
+ return exportSuccessful;
}
bool UMLViewImageExporterModel::exportViewToPixmap(UMLView* view, const QString &imageType, const QString &fileName) const {
+ bool exportSuccessful;
QRect rect = view->getDiagramRect();
QPixmap diagram(rect.width(), rect.height());
view->getDiagram(rect, diagram);
- return diagram.save(fileName, imageType.upper().ascii());
+ exportSuccessful = diagram.save(fileName, qPrintable(imageType.toUpper()));
+
+ uDebug() << "saving to file " << fileName << " , imageType=" << imageType << " successful=" << exportSuccessful << endl;
+ return exportSuccessful;
}
More information about the umbrello-devel
mailing list