clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name previewer.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D VCL_INTERNALS -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/vcl/source/uipreviewer/previewer.cxx
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | #include <com/sun/star/lang/XComponent.hpp> |
11 | #include <com/sun/star/lang/XMultiComponentFactory.hpp> |
12 | #include <com/sun/star/lang/XMultiServiceFactory.hpp> |
13 | #include <com/sun/star/ucb/UniversalContentBroker.hpp> |
14 | #include <comphelper/processfactory.hxx> |
15 | #include <cppuhelper/bootstrap.hxx> |
16 | #include <osl/file.hxx> |
17 | #include <vcl/builder.hxx> |
18 | #include <vcl/toolkit/dialog.hxx> |
19 | #include <vcl/help.hxx> |
20 | #include <vcl/svapp.hxx> |
21 | #include <vcl/vclmain.hxx> |
22 | |
23 | namespace { |
24 | |
25 | class UIPreviewApp : public Application |
26 | { |
27 | public: |
28 | virtual void Init() override; |
29 | virtual int Main() override; |
30 | }; |
31 | |
32 | } |
33 | |
34 | using namespace com::sun::star; |
35 | |
36 | void UIPreviewApp::Init() |
37 | { |
38 | uno::Reference<uno::XComponentContext> xContext = |
39 | cppu::defaultBootstrap_InitialComponentContext(); |
40 | uno::Reference<lang::XMultiComponentFactory> xFactory = |
41 | xContext->getServiceManager(); |
42 | uno::Reference<lang::XMultiServiceFactory> xSFactory(xFactory, uno::UNO_QUERY_THROW); |
43 | comphelper::setProcessServiceFactory(xSFactory); |
44 | |
45 | |
46 | |
47 | ::ucb::UniversalContentBroker::create( |
48 | comphelper::getProcessComponentContext() ); |
49 | } |
50 | |
51 | int UIPreviewApp::Main() |
52 | { |
53 | std::vector<OUString> uifiles; |
54 | for (sal_uInt16 i = 0; i < GetCommandLineParamCount(); ++i) |
| 1 | Assuming the condition is false | |
|
| 2 | | Loop condition is false. Execution continues on line 61 | |
|
55 | { |
56 | OUString aFileUrl; |
57 | osl::File::getFileURLFromSystemPath(GetCommandLineParam(i), aFileUrl); |
58 | uifiles.push_back(aFileUrl); |
59 | } |
60 | |
61 | if (uifiles.empty()) |
| 3 | | Assuming the condition is false | |
|
| |
62 | { |
63 | fprintf(stderr, "Usage: ui-previewer file.ui\n"); |
64 | return EXIT_FAILURE; |
65 | } |
66 | |
67 | |
68 | Help::EnableQuickHelp(); |
69 | |
70 | int nRet = EXIT_SUCCESS; |
71 | |
72 | try |
73 | { |
74 | VclPtrInstance<Dialog> pDialog(nullptr, WB_STDDIALOG | WB_SIZEABLE, Dialog::InitFlag::NoParent); |
75 | { |
76 | VclBuilder aBuilder(pDialog, OUString(), uifiles[0]); |
77 | vcl::Window *pRoot = aBuilder.get_widget_root(); |
| 5 | | 'pRoot' initialized here | |
|
78 | Dialog *pRealDialog = dynamic_cast<Dialog*>(pRoot); |
79 | |
80 | if (!pRealDialog) |
| 6 | | Assuming 'pRealDialog' is null | |
|
| |
81 | pRealDialog = pDialog; |
82 | |
83 | pRealDialog->SetText("LibreOffice ui-previewer"); |
84 | pRealDialog->SetStyle(pDialog->GetStyle()|WB_CLOSEABLE); |
85 | |
86 | |
87 | |
88 | |
89 | |
90 | pRoot->Hide(); |
| 8 | | Called C++ object pointer is null |
|
91 | pRoot->Show(); |
92 | pRealDialog->Execute(); |
93 | } |
94 | |
95 | pDialog.disposeAndClear(); |
96 | } |
97 | catch (const uno::Exception &e) |
98 | { |
99 | fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr()); |
100 | nRet = EXIT_FAILURE; |
101 | } |
102 | catch (const std::exception &e) |
103 | { |
104 | fprintf(stderr, "fatal error: %s\n", e.what()); |
105 | nRet = EXIT_FAILURE; |
106 | } |
107 | |
108 | return nRet; |
109 | } |
110 | |
111 | void vclmain::createApplication() |
112 | { |
113 | static UIPreviewApp aApp; |
114 | } |
115 | |
116 | |