Kaydet (Commit) 5bc1eac4 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Ugly fix for '%ld' vs. 'std::basic_string<char>::size_type' mismatch

Just cast the size() return value to long int, which of course can cause
breakage when the size_type (is that always the same as size_t?) is larger
than long int. For 64-bit Windows code size_t is 64 bits but long is 32
bits. I couldn't think of any simple totally correct solution that would work
also on compilers without <stdint.h> and <inttypes.h> (MSVC2008), or without
the z format specifier (all MSVC versions?).

(Our SAL_PRI_SIZET is not available to a 3rd-party library like
libcmis. Should libcmis grow corresponding configury to find out that?)

Why does a C++ library like libcmis use C-style printf formats anyway? ;)

Change-Id: I093655577bc1a50c137c79b648058f0823cc66c1
üst b6bcbb67
......@@ -200,6 +200,15 @@ diff --git src/libcmis/ws-requests.cxx src/libcmis/ws-requests.cxx
index 2b421b2..e13ae07 100644
--- src/libcmis/ws-requests.cxx
+++ src/libcmis/ws-requests.cxx
@@ -105,7 +105,7 @@
string content( buf, size );
delete[ ] buf;
- xmlTextWriterWriteFormatElement( writer, BAD_CAST( "cmism:length" ), "%ld", content.size( ) );
+ xmlTextWriterWriteFormatElement( writer, BAD_CAST( "cmism:length" ), "%ld", (long int) content.size( ) );
xmlTextWriterWriteElement( writer, BAD_CAST( "cmism:mimeType" ), BAD_CAST( contentType.c_str( ) ) );
if ( !filename.empty( ) )
xmlTextWriterWriteElement( writer, BAD_CAST( "cmism:filename" ), BAD_CAST( filename.c_str( ) ) );
@@ -349,7 +349,7 @@ void UpdateProperties::toXml( xmlTextWriterPtr writer )
xmlTextWriterEndElement( writer );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment