add packages_10.03.2 in preparation for the 10.03.2 interim release
[10.03/packages.git] / libs / ustl / patches / 003-fix_stream_bounds_check_dep.patch
1 --- a/config.h.in
2 +++ b/config.h.in
3 @@ -15,6 +15,9 @@
4  // Define to the address where bug reports for this package should be sent.
5  #define USTL_BUGREPORT "@PACKAGE_BUGREPORT@"
6  
7 +/// Define to 1 if you want to build without libstdc++
8 +#undef WITHOUT_LIBSTDCPP
9 +
10  /// Define to 1 if you want stream operations to throw exceptions on
11  /// insufficient data or insufficient space. All these errors should
12  /// be preventable in output code; the input code should verify the
13 @@ -23,13 +26,10 @@
14  ///
15  #undef WANT_STREAM_BOUNDS_CHECKING
16  
17 -#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG)
18 +#if !defined(WANT_STREAM_BOUNDS_CHECKING) && !defined(NDEBUG) && !defined(WITHOUT_LIBSTDCPP)
19      #define WANT_STREAM_BOUNDS_CHECKING 1
20  #endif
21  
22 -/// Define to 1 if you want to build without libstdc++
23 -#undef WITHOUT_LIBSTDCPP
24 -
25  /// Define to 1 if you don't want the standard streams.
26  /// You will not be able to run bvt tests if you do this.
27  ///
28 --- a/mostream.h
29 +++ b/mostream.h
30 @@ -11,7 +11,9 @@
31  #include "memlink.h"
32  #include "uexception.h"
33  #include "utf8.h"
34 +#ifdef WANT_STREAM_BOUNDS_CHECKING
35  #include <typeinfo>
36 +#endif
37  
38  namespace ustl {
39  
40 --- a/uctrstrm.h
41 +++ b/uctrstrm.h
42 @@ -109,8 +109,12 @@
43      size_type n;
44      is >> n;
45      const size_type expectedSize = n * stream_size_of(value_type());
46 +#ifdef WANT_STREAM_BOUNDS_CHECKING
47      if (expectedSize > is.remaining())
48         throw stream_bounds_exception ("read", typeid(v).name(), is.pos(), expectedSize, is.remaining());
49 +#else
50 +    assert(expectedSize <= is.remaining());
51 +#endif
52      v.resize (n);
53      nr_container_read (is, v);
54      is.align();