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>
This commit is contained in:
Stephan Bergmann
2023-10-27 11:16:00 +02:00
parent 550eb0d451
commit 819f87faee
6 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -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 \
@@ -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)
@@ -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(
@@ -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()
{
@@ -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)
+14 -12
View File
@@ -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";