diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-10-27 09:24:58 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-10-27 11:16:00 +0200 |
commit | 819f87faee0e8d629f5176a107e4b07422abea73 (patch) | |
tree | d018c77c82f0bba9ddb36c103189cace31d25cda /odk | |
parent | 550eb0d45117836cdea2112ee37a3fd7219a90b5 (diff) |
Explicitly build the ODK examples against C++03
...similarly to how CppunitTest_odk_checkapi already builds with C++03 to detect
inadvertent uses of newer features in code that is meant to be still compatible
with C++03. And fix any uses of newer features that had already crept in.
Change-Id: I9fb4013099c1dff2c1ad5fba8fc93d9aa4efbde8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158523
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'odk')
6 files changed, 20 insertions, 17 deletions
diff --git a/odk/build-examples_common.mk b/odk/build-examples_common.mk index 08b8d5e3c231..e8836f6242fb 100644 --- a/odk/build-examples_common.mk +++ b/odk/build-examples_common.mk @@ -47,7 +47,7 @@ else $(foreach my_dir,$(2), \ && (cd $(INSTDIR)/$(SDKDIRNAME)/examples/$(my_dir) \ && printf 'yes\n' | LC_ALL=C make -j1 \ - CC="$(CXX)" LINK="$(CXX)" LIB="$(CXX)" \ + CC="$(CXX) $(gb_CXX03FLAGS)" LINK="$(CXX)" LIB="$(CXX)" \ $(if $(MACOSX_SHELL_HACK), SHELL="$$$$ODK_BUILD_SHELL", ))) \ $(if $(MACOSX_SHELL_HACK),&& rm -f "$$$$ODK_BUILD_SHELL")) \ >$(call gb_CustomTarget_get_workdir,$(1))/log 2>&1 \ diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx index c2c0df340310..bbd8954036bb 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SPreparedStatement.cxx @@ -50,7 +50,7 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; -IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.skeleton.PreparedStatement","com.sun.star.sdbc.PreparedStatement"); +IMPLEMENT_SERVICE_INFO(OPreparedStatement,"com.sun.star.sdbcx.skeleton.PreparedStatement","com.sun.star.sdbc.PreparedStatement") OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const TTypeInfoVector& _TypeInfo,const ::rtl::OUString& sql) diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx index b04963d052ff..7418b0c7ced7 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SServices.cxx @@ -141,7 +141,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( } return pRet; -}; +} extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx index f2156bc46451..01999dafcfde 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SStatement.cxx @@ -345,7 +345,7 @@ void OStatement_Base::getFastPropertyValue(Any& rValue,sal_Int32 nHandle) const } } -IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement"); +IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement") void SAL_CALL OStatement_Base::acquire() throw() { diff --git a/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx b/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx index bdcac76bec14..a19bfbb02337 100644 --- a/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx +++ b/odk/examples/DevelopersGuide/FirstSteps/cxx/FirstUnoContact.cxx @@ -10,6 +10,7 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <cppuhelper/bootstrap.hxx> +#include <cstddef> #include <iostream> #include <sal/main.h> @@ -20,7 +21,7 @@ SAL_IMPLEMENT_MAIN() css::uno::Reference<css::uno::XComponentContext> xContext(cppu::bootstrap()); std::cout << "Connected to a running office ..." << std::endl; css::uno::Reference<css::lang::XMultiComponentFactory> xMCF = xContext->getServiceManager(); - std::string available = xMCF != nullptr ? "available" : "not available"; + std::string available = xMCF != NULL ? "available" : "not available"; std::cout << "remote ServiceManager is " + available << std::endl; } catch (css::uno::Exception& e) diff --git a/odk/examples/cpp/Convertor/Convertor.cxx b/odk/examples/cpp/Convertor/Convertor.cxx index 765a28317409..6841c58a3311 100644 --- a/odk/examples/cpp/Convertor/Convertor.cxx +++ b/odk/examples/cpp/Convertor/Convertor.cxx @@ -53,11 +53,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) exit(1); } - auto xComponentContext(defaultBootstrap_InitialComponentContext()); - auto xMultiComponentFactoryClient(xComponentContext->getServiceManager()); - auto xInterface = xMultiComponentFactoryClient->createInstanceWithContext( + Reference<XComponentContext> xComponentContext(defaultBootstrap_InitialComponentContext()); + Reference<XMultiComponentFactory> xMultiComponentFactoryClient( + xComponentContext->getServiceManager()); + Reference<XInterface> xInterface = xMultiComponentFactoryClient->createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xComponentContext); - auto resolver = Reference<XUnoUrlResolver>(xInterface, UNO_QUERY); + Reference<XUnoUrlResolver> resolver(xInterface, UNO_QUERY); try { xInterface = Reference<XInterface>(resolver->resolve(sConnectionString), UNO_QUERY_THROW); @@ -70,10 +71,11 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) std::exit(1); } - auto xPropSet = Reference<XPropertySet>(xInterface, UNO_QUERY); + Reference<XPropertySet> xPropSet(xInterface, UNO_QUERY); xPropSet->getPropertyValue("DefaultContext") >>= xComponentContext; - auto xMultiComponentFactoryServer(xComponentContext->getServiceManager()); - auto xComponentLoader = Desktop::create(xComponentContext); + Reference<XMultiComponentFactory> xMultiComponentFactoryServer( + xComponentContext->getServiceManager()); + Reference<XDesktop2> xComponentLoader = Desktop::create(xComponentContext); Sequence<PropertyValue> loadProperties(1); loadProperties[0].Name = "Hidden"; loadProperties[0].Value <<= true; @@ -91,11 +93,11 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) osl::FileBase::getAbsoluteFileURL(sWorkingDir, sOutputUrl, sAbsoluteOutputUrl); std::cout << sAbsoluteOutputUrl << std::endl; - auto xComponent = xComponentLoader->loadComponentFromURL(sAbsoluteInputUrl, "_blank", 0, - loadProperties); - auto xDocument = Reference<XTextDocument>(xComponent, UNO_QUERY_THROW); - auto xStorable = Reference<XStorable>(xDocument, UNO_QUERY_THROW); - auto storeProps = Sequence<PropertyValue>(3); + Reference<XComponent> xComponent = xComponentLoader->loadComponentFromURL( + sAbsoluteInputUrl, "_blank", 0, loadProperties); + Reference<XTextDocument> xDocument(xComponent, UNO_QUERY_THROW); + Reference<XStorable> xStorable(xDocument, UNO_QUERY_THROW); + Sequence<PropertyValue> storeProps(3); storeProps[0].Name = "FilterName"; storeProps[0].Value <<= OUString("writer_pdf_Export"); storeProps[1].Name = "Overwrite"; |