www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - Debug-build faulty assertion with winstl/system/system_traits.hpp

reply Austin Ziegler <austin.ziegler evault.com> writes:
Hi.

Found a debug-build issue with system_traits.hpp in that it asserts incorrectly
when part of WinSTL is trying to get the necessary size of a buffer. See the
patch below.

==== //depot/agent/main/ThirdPartySource/stlsoft/include/winstl/system
system_traits.hpp#8 (text) -
//depot/agent/main/ThirdPartySource/stlsoft/include/winstl/system
system_traits.hpp#9 (text) ==== content
   -544,7 +544,7   
     static size_type expand_environment_strings(char_type const* src,
char_type* dest, size_type cch_dest)
     {
         WINSTL_ASSERT(NULL != src);
-        WINSTL_ASSERT(NULL != dest);
+        WINSTL_ASSERT(NULL != dest || 0 == cch_dest);

         return class_type::ExpandEnvironmentStringsA(src, dest, cch_dest);
     }
   -881,7 +881,7   
     static size_type expand_environment_strings(char_type const* src,
char_type* dest, size_type cch_dest)
     {
         WINSTL_ASSERT(NULL != src);
-        WINSTL_ASSERT(NULL != dest);
+        WINSTL_ASSERT(NULL != dest || 0 == cch_dest);

         return class_type::ExpandEnvironmentStringsW(src, dest, cch_dest);
     }

-austin
Sep 11 2008
parent "Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
Thanks for that. This is now fixed, and will be in the next release.

"Austin Ziegler" <austin.ziegler evault.com> wrote in message
news:gac02c$fil$1 digitalmars.com...
 Hi.

 Found a debug-build issue with system_traits.hpp in that it asserts
incorrectly when part of WinSTL is trying to get the necessary

 ==== //depot/agent/main/ThirdPartySource/stlsoft/include/winstl/system
system_traits.hpp#8 (text) -

    -544,7 +544,7   
      static size_type expand_environment_strings(char_type const* src,
char_type* dest, size_type cch_dest)
      {
          WINSTL_ASSERT(NULL != src);
 -        WINSTL_ASSERT(NULL != dest);
 +        WINSTL_ASSERT(NULL != dest || 0 == cch_dest);

          return class_type::ExpandEnvironmentStringsA(src, dest, cch_dest);
      }
    -881,7 +881,7   
      static size_type expand_environment_strings(char_type const* src,
char_type* dest, size_type cch_dest)
      {
          WINSTL_ASSERT(NULL != src);
 -        WINSTL_ASSERT(NULL != dest);
 +        WINSTL_ASSERT(NULL != dest || 0 == cch_dest);

          return class_type::ExpandEnvironmentStringsW(src, dest, cch_dest);
      }

 -austin

Sep 11 2008