summaryrefslogtreecommitdiffstats
path: root/unodevtools
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-04-28 12:51:24 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2019-04-28 13:15:39 +0200
commit65261babf4fbcba08deb7bc8871b8dbcbafcc26f (patch)
treebddc550d7fea69ee4389178a02b997ceaf42b4a6 /unodevtools
parentRemove redundant checks (diff)
downloadcore-65261babf4fbcba08deb7bc8871b8dbcbafcc26f.tar.gz
core-65261babf4fbcba08deb7bc8871b8dbcbafcc26f.zip
tdf#120703 PVS: fix cleanup checks
pofs is guaranteed to be non-nullptr after getOutputStream, so no need to check that. is_open() only matters to decide if close() is needed. V595 The 'pofs' pointer was utilized before it was verified against nullptr. Check lines: 1033, 1057. Check lines: 1194, 1220. Change-Id: I2dd22d29c465889269f2496f0964bee030cb5964 Reviewed-on: https://gerrit.libreoffice.org/71456 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'unodevtools')
-rw-r--r--unodevtools/source/skeletonmaker/cppcompskeleton.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index c1fec780e9ff..2d0eb0d3e45f 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -1034,18 +1034,19 @@ void generateSkeleton(ProgramOptions const & options,
*pofs << (nm > 0 ? "// closing namespace\n\n" : "\n");
}
- if ( !standardout && pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
- static_cast<std::ofstream*>(pofs)->close();
+ if (!standardout)
+ {
+ if (static_cast<std::ofstream*>(pofs)->is_open())
+ static_cast<std::ofstream*>(pofs)->close();
delete pofs;
OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, false));
}
} catch (CannotDumpException & e) {
std::cerr << "ERROR: " << e.getMessage() << "\n";
if ( !standardout ) {
- if (pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
+ if (static_cast<std::ofstream*>(pofs)->is_open())
static_cast<std::ofstream*>(pofs)->close();
- delete pofs;
- }
+ delete pofs;
// remove existing type file if something goes wrong to ensure
// consistency
if (fileExists(compFileName))
@@ -1193,18 +1194,19 @@ void generateCalcAddin(ProgramOptions const & options,
generateCompFunctions(*pofs, nmspace);
- if ( !standardout && pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
- static_cast<std::ofstream*>(pofs)->close();
+ if (!standardout)
+ {
+ if (static_cast<std::ofstream*>(pofs)->is_open())
+ static_cast<std::ofstream*>(pofs)->close();
delete pofs;
OSL_VERIFY(makeValidTypeFile(compFileName, tmpFileName, false));
}
} catch (CannotDumpException & e) {
std::cerr << "ERROR: " << e.getMessage() << "\n";
if ( !standardout ) {
- if (pofs && static_cast<std::ofstream*>(pofs)->is_open()) {
+ if (static_cast<std::ofstream*>(pofs)->is_open())
static_cast<std::ofstream*>(pofs)->close();
- delete pofs;
- }
+ delete pofs;
// remove existing type file if something goes wrong to ensure
// consistency
if (fileExists(compFileName))