Simplify a bit
[LibreOffice.git] / vcl / workben / xlsfuzzer.cxx
blob4dd38ea228ddf2e6959b3fbbec54b8246981b2f2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <tools/stream.hxx>
11 #include <vcl/FilterConfigItem.hxx>
12 #include <com/sun/star/ucb/XContentProvider.hpp>
13 #include <com/sun/star/ucb/XUniversalContentBroker.hpp>
14 #include "commonfuzzer.hxx"
16 extern "C" void* ScCreateDialogFactory() { return nullptr; }
18 extern "C" bool TestImportXLS(SvStream& rStream);
20 extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
22 if (__lsan_disable)
23 __lsan_disable();
25 CommonInitialize(argc, argv);
27 // initialise unconfigured UCB:
28 css::uno::Reference<css::ucb::XUniversalContentBroker> xUcb(
29 comphelper::getProcessServiceFactory()->createInstance(
30 "com.sun.star.ucb.UniversalContentBroker"),
31 css::uno::UNO_QUERY_THROW);
32 css::uno::Sequence<css::uno::Any> aArgs{ css::uno::Any(OUString("NoConfig")) };
33 css::uno::Reference<css::ucb::XContentProvider> xFileProvider(
34 comphelper::getProcessServiceFactory()->createInstanceWithArguments(
35 "com.sun.star.ucb.FileContentProvider", aArgs),
36 css::uno::UNO_QUERY_THROW);
37 xUcb->registerContentProvider(xFileProvider, "file", true);
39 if (__lsan_enable)
40 __lsan_enable();
42 return 0;
45 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
47 SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
48 (void)TestImportXLS(aStream);
49 return 0;
52 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */