Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Imported upstream 1.9.104

Signed-off-by: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
  • Loading branch information...
commit 88f3cacc117e0b69b3c196eb6fd75b3fcca8976d 1 parent 6d7342e
Stefan Naewe authored
View
24 CHANGES.txt
@@ -2,7 +2,7 @@
STLSoft - Changes
; Created: 29th March 2002
-; Updated: 21st November 2010
+; Updated: 22nd November 2010
============================================================================
@@ -19,6 +19,28 @@ STLSoft - Changes
============================================================================
+Changes for 1.9.104 (22nd November 2010)
+
+Summary:
+========
+
+ * refactored wide string exception string access shim functions, to avoid so-called "deprecated" (standard) functions when using VC++
+ * expanded internal buffers of shim strings for exception string access shims, from 10 to 100
+
+
+Changes:
+========
+
+ STLSoft:
+ ========
+
+ ~ include/stlsoft/shims/access/string/std/exception.hpp:
+ ~ refactored wide-string string access shim functions, to avoid so-called "deprecated" (standard) functions when using VC++
+ ~ expanded internal buffers of shim strings for exception string access shims, from 10 to 100
+
+
+============================================================================
+
Changes for 1.9.103 (21st November 2010)
Summary:
View
9 HISTORY.txt
@@ -2,11 +2,18 @@
STLSoft - History
; Created: 29th March 2002
-; Updated: 21st November 2010
+; Updated: 22nd November 2010
============================================================================
+22nd November 2010 - 1.9.104 released
+-------------------------------------
+
+ * refactored wide string exception string access shim functions, to avoid so-called "deprecated" (standard) functions when using VC++
+ * expanded internal buffers of shim strings for exception string access shims, from 10 to 100
+
+
21st November 2010 - 1.9.103 released
-------------------------------------
View
12 INSTALL.txt
@@ -2,7 +2,7 @@
STLSoft - Install
; Created: 29th March 2002
-; Updated: 21st November 2010
+; Updated: 22nd November 2010
============================================================================
@@ -11,16 +11,16 @@ STLSoft - Install
It is recommended that you define an STLSOFT environment variable.
For example, if you're using UNIX and you install
- to /usr/local/stlsoft/stlsoft-1.9.103 then you should set the environment
- variable STLSOFT to /usr/local/stlsoft/stlsoft-1.9.103 in which case the
+ to /usr/local/stlsoft/stlsoft-1.9.104 then you should set the environment
+ variable STLSOFT to /usr/local/stlsoft/stlsoft-1.9.104 in which case the
file stlsoft/stlsoft.h will be located in
$STLSOFT/include/stlsoft/stlsoft.h
Conversely, if you're using Windows and you intall
- to C:\3pty\STLSoft\stlsoft-1.9.103 then you should set the environment
- variable STLSoft to C:\3pty\STLSoft\stlsoft-1.9.103 in which case the
+ to C:\3pty\STLSoft\stlsoft-1.9.104 then you should set the environment
+ variable STLSoft to C:\3pty\STLSoft\stlsoft-1.9.104 in which case the
file stlsoft/stlsoft.h will be located in
- C:\3pty\STLSoft\stlsoft-1.9.103\stlsoft\stlsoft.h
+ C:\3pty\STLSoft\stlsoft-1.9.104\stlsoft\stlsoft.h
The makefiles / project files of several other open-source projects expect
this symbol, including:
View
4 NEWS.txt
@@ -2,13 +2,15 @@
STLSoft - News
; Created: 29th March 2002
-; Updated: 21st November 2010
+; Updated: 22nd November 2010
============================================================================
News:
+ 22nd November 2010 - Release of STLSoft 1.9.104
+
21st November 2010 - Release of STLSoft 1.9.103
8th November 2010 - Release of STLSoft 1.9.102
View
207 include/stlsoft/shims/access/string/std/exception.hpp
@@ -4,7 +4,7 @@
* Purpose: Contains the string access shims for std::exception.
*
* Created: 2nd May 2003
- * Updated: 8th November 2010
+ * Updated: 22nd November 2010
*
* Home: http://stlsoft.org/
*
@@ -51,8 +51,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_MAJOR 2
# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_MINOR 2
-# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_REVISION 2
-# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_EDIT 38
+# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_REVISION 4
+# define _STLSOFT_VER_STLSOFT_SHIMS_ACCESS_STRING_STD_HPP_EXCEPTION_EDIT 40
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* /////////////////////////////////////////////////////////////////////////
@@ -71,12 +71,25 @@
#ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_SHIM_STRING
# include <stlsoft/string/shim_string.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_STRING_HPP_SHIM_STRING */
+#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
+# ifndef STLSOFT_INCL_STLSOFT_ERROR_HPP_CONVERSION_ERROR
+# include <stlsoft/error/conversion_error.hpp>
+# endif /* !STLSOFT_INCL_STLSOFT_ERROR_HPP_CONVERSION_ERROR */
+#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
+#ifndef STLSOFT_INCL_STLSOFT_INTERNAL_H_SAFESTR
+# include <stlsoft/internal/safestr.h>
+#endif /* !STLSOFT_INCL_STLSOFT_INTERNAL_H_SAFESTR */
#ifndef STLSOFT_INCL_EXCEPTION
# define STLSOFT_INCL_EXCEPTION
# include <exception> // for std::exception
#endif /* !STLSOFT_INCL_EXCEPTION */
+#ifndef STLSOFT_INCL_H_ERRNO
+# define STLSOFT_INCL_H_ERRNO
+# include <errno.h>
+#endif /* !STLSOFT_INCL_H_ERRNO */
+
/* /////////////////////////////////////////////////////////////////////////
* Namespace
*/
@@ -87,6 +100,110 @@ namespace stlsoft
#endif /* _STLSOFT_NO_NAMESPACE */
/* /////////////////////////////////////////////////////////////////////////
+ * Helpers
+ */
+
+#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
+struct ximpl_stlsoft_shims_access_string_std_exception_
+{
+public:
+ //
+ // *numConverted excludes the nul-terminator
+ static
+ int
+ mbstowcs_(
+ ss_char_a_t const* mbs
+ , ss_size_t mbsLen
+ , ss_char_w_t* ws
+ , ss_size_t wsSizeInChars
+ , ss_size_t* numConverted
+ )
+ {
+ // Always assume the nul-terminator
+ STLSOFT_ASSERT(NULL != mbs);
+
+#ifdef STLSOFT_USING_SAFE_STR_FUNCTIONS
+
+ int r = ::mbstowcs_s(numConverted, ws, wsSizeInChars, mbs, mbsLen);
+
+ if(0 == r)
+ {
+ STLSOFT_ASSERT(0 != *numConverted);
+
+ --*numConverted; // mbstowcs_s() always adds one for nul-terminator
+ }
+
+ return r;
+
+#else /* ? STLSOFT_USING_SAFE_STR_FUNCTIONS */
+
+ STLSOFT_SUPPRESS_UNUSED(mbsLen);
+ STLSOFT_SUPPRESS_UNUSED(wsSizeInChars);
+
+ *numConverted = ::mbstowcs(ws, mbs, mbsLen);
+ if(static_cast<ss_size_t>(-1) == *numConverted)
+ {
+ return errno;
+ }
+
+ return 0;
+#endif /* STLSOFT_USING_SAFE_STR_FUNCTIONS */
+ }
+
+ //
+ // *numConverted excludes the nul-terminator
+ static
+ int
+ mbstowcs_len(
+ ss_char_a_t const* s
+ , ss_size_t* len
+ )
+ {
+ STLSOFT_ASSERT(NULL != len);
+
+#ifdef STLSOFT_USING_SAFE_STR_FUNCTIONS
+
+ int r = ::mbstowcs_s(len, NULL, 0, s, 0);
+
+ if(0 == r)
+ {
+ STLSOFT_ASSERT(0 != *len);
+
+ --*len; // mbstowcs_s() always adds one for nul-terminator
+ }
+
+ return r;
+
+#else /* ? STLSOFT_USING_SAFE_STR_FUNCTIONS */
+
+ *len = ::mbstowcs(NULL, s, 0);
+ if(static_cast<ss_size_t>(-1) == *len)
+ {
+ return errno;
+ }
+
+ return 0;
+
+#endif /* STLSOFT_USING_SAFE_STR_FUNCTIONS */
+ }
+
+ static
+ int
+ throw_conversion_error_or_return_(
+ int err
+ , char const* message
+ )
+ {
+#ifdef STLSOFT_CF_EXCEPTION_SUPPORT
+ STLSOFT_THROW_X(conversion_error(message, err));
+#endif /* STLSOFT_CF_EXCEPTION_SUPPORT */
+
+ return err;
+ }
+};
+#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
+
+/* /////////////////////////////////////////////////////////////////////////
* c_str_data
*
* This can be applied to an expression, and the return value is either a
@@ -115,19 +232,40 @@ inline ss_char_a_t const* c_str_data_a(stlsoft_ns_qual_std(exception) const& x)
* string of <code>wchar_t</code>.
*/
inline
-basic_shim_string<ss_char_w_t, 10>
+basic_shim_string<ss_char_w_t, 100>
c_str_data_w(stlsoft_ns_qual_std(exception) const& x)
{
- size_t const len = ::mbstowcs(NULL, x.what(), 0);
+ // C-string pointer and length
+ ss_char_a_t const* const s = x.what();
+ ss_size_t const len = ::strlen(s);
+
+ // Calculate the wide-string length
+ ss_size_t wlen;
+ int err = ximpl_stlsoft_shims_access_string_std_exception_::mbstowcs_len(s, &wlen);
- basic_shim_string<ss_char_w_t, 10> s(len);
+ // handle failure to get length
+ if(0 != err)
+ {
+ ximpl_stlsoft_shims_access_string_std_exception_::throw_conversion_error_or_return_(err, "cannot elicit wide-string length of exception message");
+ }
- size_t const len2 = ::mbstowcs(s.data(), x.what(), 1u + s.size());
+ // Create the shim string, which will be returned
+ basic_shim_string<ss_char_w_t, 100> r(wlen);
+ ss_size_t wlen2;
- STLSOFT_ASSERT(len2 == s.size());
- STLSOFT_SUPPRESS_UNUSED(len2);
+ err = ximpl_stlsoft_shims_access_string_std_exception_::mbstowcs_(s, len, r.data(), 1u + r.size(), &wlen2);
- return s;
+ // Sanity checks
+ STLSOFT_ASSERT(wlen2 == r.size());
+ STLSOFT_SUPPRESS_UNUSED(wlen2);
+
+ // handle failure to convert
+ if(0 != err)
+ {
+ ximpl_stlsoft_shims_access_string_std_exception_::throw_conversion_error_or_return_(err, "cannot elicit wide-string equivalent of exception message");
+ }
+
+ return r;
}
/** \brief \ref group__concept__shim__string_access__c_str_data function
@@ -172,7 +310,17 @@ inline
ss_size_t
c_str_len_w(stlsoft_ns_qual_std(exception) const& x)
{
- return ::mbstowcs(NULL, x.what(), 0);
+ ss_size_t len;
+ int err = ximpl_stlsoft_shims_access_string_std_exception_::mbstowcs_len(x.what(), &len);
+
+ if(0 != err)
+ {
+ ximpl_stlsoft_shims_access_string_std_exception_::throw_conversion_error_or_return_(err, "failed to elicit length of multibyte string");
+
+ len = 0;
+ }
+
+ return len;
}
/** \brief \ref group__concept__shim__string_access__c_str_len function
@@ -216,7 +364,7 @@ inline ss_char_a_t const* c_str_ptr_a(stlsoft_ns_qual_std(exception) const& x)
* string of <code>wchar_t</code>.
*/
inline
-basic_shim_string<ss_char_w_t, 10>
+basic_shim_string<ss_char_w_t, 100>
c_str_ptr_w(stlsoft_ns_qual_std(exception) const& x)
{
return c_str_data_w(x);
@@ -264,19 +412,40 @@ inline ss_char_a_t const* c_str_ptr_null_a(stlsoft_ns_qual_std(exception) const&
* string of <code>wchar_t</code>.
*/
inline
-basic_shim_string<ss_char_w_t, 10, true>
+basic_shim_string<ss_char_w_t, 100, true>
c_str_ptr_null_w(stlsoft_ns_qual_std(exception) const& x)
{
- size_t const len = ::mbstowcs(NULL, x.what(), 0);
+ // C-string pointer and length
+ ss_char_a_t const* const s = x.what();
+ ss_size_t const len = ::strlen(s);
+
+ // Calculate the wide-string length
+ ss_size_t wlen;
+ int err = ximpl_stlsoft_shims_access_string_std_exception_::mbstowcs_len(s, &wlen);
+
+ // handle failure to get length
+ if(0 != err)
+ {
+ ximpl_stlsoft_shims_access_string_std_exception_::throw_conversion_error_or_return_(err, "cannot elicit wide-string length of exception message");
+ }
+
+ // Create the shim string, which will be returned
+ basic_shim_string<ss_char_w_t, 100, true> r(wlen);
+ ss_size_t wlen2;
- basic_shim_string<ss_char_w_t, 10, true> s(len);
+ err = ximpl_stlsoft_shims_access_string_std_exception_::mbstowcs_(s, len, r.data(), 1u + r.size(), &wlen2);
- size_t const len2 = ::mbstowcs(s.data(), x.what(), 1u + s.size());
+ // Sanity checks
+ STLSOFT_ASSERT(wlen2 == r.size());
+ STLSOFT_SUPPRESS_UNUSED(wlen2);
- STLSOFT_ASSERT(len2 == s.size());
- STLSOFT_SUPPRESS_UNUSED(len2);
+ // handle failure to convert
+ if(0 != err)
+ {
+ ximpl_stlsoft_shims_access_string_std_exception_::throw_conversion_error_or_return_(err, "cannot elicit wide-string equivalent of exception message");
+ }
- return s;
+ return r;
}
/** \brief \ref group__concept__shim__string_access__c_str_ptr_null function
View
9 include/stlsoft/stlsoft.h
@@ -6,7 +6,7 @@
* types.
*
* Created: 15th January 2002
- * Updated: 19th November 2010
+ * Updated: 22nd November 2010
*
* Home: http://stlsoft.org/
*
@@ -54,8 +54,8 @@
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define STLSOFT_VER_STLSOFT_H_STLSOFT_MAJOR 3
# define STLSOFT_VER_STLSOFT_H_STLSOFT_MINOR 23
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 5
-# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 411
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_REVISION 6
+# define STLSOFT_VER_STLSOFT_H_STLSOFT_EDIT 412
#else /* ? STLSOFT_DOCUMENTATION_SKIP_SECTION */
/* # include "./internal/doxygen_defs.h" */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
@@ -266,12 +266,13 @@
# define _STLSOFT_VER_1_9_101 0x010965ff /*!< Version 1.9.101 (30th September 2010) */
# define _STLSOFT_VER_1_9_102 0x010966ff /*!< Version 1.9.102 (8th November 2010) */
# define _STLSOFT_VER_1_9_103 0x010967ff /*!< Version 1.9.103 (20th November 2010) */
+# define _STLSOFT_VER_1_9_104 0x010968ff /*!< Version 1.9.104 (22nd November 2010) */
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
#define _STLSOFT_VER_MAJOR 1
#define _STLSOFT_VER_MINOR 9
#define _STLSOFT_VER_REVISION 103
-#define _STLSOFT_VER _STLSOFT_VER_1_9_103
+#define _STLSOFT_VER _STLSOFT_VER_1_9_104
/* /////////////////////////////////////////////////////////////////////////
* Basic macros
Please sign in to comment.
Something went wrong with that request. Please try again.