[Libreoffice-commits] core.git: include/systools sal/Library_uwinapi.mk sal/systools solenv/gbuild

David Ostrovsky david at ostrovsky.org
Wed Sep 2 13:40:42 PDT 2015


 include/systools/win32/snprintf.h      |    5 +++++
 sal/Library_uwinapi.mk                 |    3 ++-
 sal/systools/win32/uwinapi/sntprintf.c |    4 ++++
 solenv/gbuild/platform/windows.mk      |    7 +++++++
 4 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 0c9ddb24ee0388d03c313caf5a45f1aa26049781
Author: David Ostrovsky <david at ostrovsky.org>
Date:   Thu Jul 2 08:06:07 2015 +0200

    Don't redefine snprintf as VS 2015 supports ISO standard
    
    Make the workaround in snprintf.h conditional on older MSVC version.
    
    Investigation reveals that the GetShortPathNameW is presumably used by
    legacy Duden extension that was built by Sun in a setsolar environment.
    The uwinapi.lib was never part of the SDK, so ordinary extensions cannot
    link against it. The PRIVATE export of the symbol that is only possible
    with DEF file therefore does not matter much. With VC2015 there is no
    need for LO code to use uwinapi.dll at all and gb_UWINAPI can be unset
    in this case.
    
    Change-Id: I23a5636db9431b0fa4350b665a6a69613d625264
    Reviewed-on: https://gerrit.libreoffice.org/16677
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/include/systools/win32/snprintf.h b/include/systools/win32/snprintf.h
index 92e571f..62abfc8 100644
--- a/include/systools/win32/snprintf.h
+++ b/include/systools/win32/snprintf.h
@@ -69,6 +69,9 @@ extern "C" {
 
 #if !defined(__MINGW32__) || defined (__NO_ISOCEXT)
 
+/* VS 2015 and above support ISO C snprintf */
+#if _MSC_VER < 1900
+
 /* UNICODE version */
 _SNPRINTF_DLLIMPORT int __cdecl snwprintf( wchar_t *buffer, size_t count, const wchar_t *format, ... );
 
@@ -77,6 +80,8 @@ _SNPRINTF_DLLIMPORT int __cdecl snprintf( char *buffer, size_t count, const char
 
 #endif
 
+#endif
+
 /* Conflict with STL_port inline implementation */
 
 #ifdef __cplusplus
diff --git a/sal/Library_uwinapi.mk b/sal/Library_uwinapi.mk
index 089ab59..ed4efde 100644
--- a/sal/Library_uwinapi.mk
+++ b/sal/Library_uwinapi.mk
@@ -33,14 +33,15 @@ $(eval $(call gb_Library_add_cobjects,uwinapi,\
 
 ifeq ($(COM),MSC)
 
-
 $(eval $(call gb_Library_add_cobjects,uwinapi,\
 	sal/systools/win32/uwinapi/legacy \
 ))
 
+ifeq ($(VCVER),120)
 $(eval $(call gb_Library_add_ldflags,uwinapi,\
 	/DEF:$(SRCDIR)/sal/systools/win32/uwinapi/uwinapi.def \
 ))
+endif
 
 endif
 
diff --git a/sal/systools/win32/uwinapi/sntprintf.c b/sal/systools/win32/uwinapi/sntprintf.c
index 7098030..cbebed5 100644
--- a/sal/systools/win32/uwinapi/sntprintf.c
+++ b/sal/systools/win32/uwinapi/sntprintf.c
@@ -90,6 +90,9 @@ static _TCHAR *GetLastBufferChar( _TCHAR *buffer, size_t count )
     return last;
 }
 
+/* VS 2015 and above support ISO C snprintf */
+#if _MSC_VER < 1900
+
 /* Implementation of snprintf following the ISO/IEC 9899:1999 (ISO C99) standard */
 
 _SNPRINTF_DLLIMPORT int __cdecl vsntprintf( _TCHAR *buffer, size_t count, const _TCHAR *format, va_list list )
@@ -141,6 +144,7 @@ _SNPRINTF_DLLIMPORT int __cdecl sntprintf( _TCHAR *buffer, size_t count, const _
 
     return retval;
 }
+#endif
 
 #endif
 
diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk
index ea0e476..a2e621d 100644
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -32,8 +32,15 @@ gb_OSDEFS := \
 	-DWNT \
 	-DNOMINMAX \
 
+
+gb_UWINAPI :=
+
+ifeq ($(VCVER),120)
+
 gb_UWINAPI := uwinapi
 
+endif
+
 gb_Executable_LAYER := \
 	$(foreach exe,$(gb_Executable_UREBIN),$(exe):UREBIN) \
 	$(foreach exe,$(gb_Executable_SDK),$(exe):SDKBIN) \


More information about the Libreoffice-commits mailing list