# HG changeset patch # User John W. Eaton # Date 1345671414 14400 # Node ID 9020dddc925a3a28cf98f98918735d2b9226f4e6 # Parent ae6b7ee0a73394b212d5da9b7bdb1bd90026ba7f use std::numeric_limits for integer max and min values * strfind.cc, gl-render.cc, jit-typeinfo.cc, oct-stream.cc, sparse-xpow.cc, xpow.cc, debug.cc, file-io.cc, ls-oct-ascii.cc, oct-hist.cc, pr-output.cc, utils.cc, variables.h, ov-base-int.cc, ov-base.cc, ov-bool-sparse.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-struct.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc, Array.cc, Sparse.cc, chNDArray.cc, dNDArray.cc, data-conv.cc, data-conv.h, fNDArray.cc, kpse.cc, oct-inttypes.h, oct-time.cc: Use std::numeric_limits for max and min integer values. Include , not . diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/corefcn/strfind.cc --- a/libinterp/corefcn/strfind.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/corefcn/strfind.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,10 +25,10 @@ #include #endif -#include -#include #include #include +#include +#include #include "Cell.h" #include "ov.h" @@ -39,13 +39,13 @@ // This allows safe indexing with char. In C++, char may be (and often is) signed! #define ORD(ch) static_cast(ch) -#define TABSIZE (UCHAR_MAX + 1) +#define TABSIZE (std::numeric_limits::max () + 1) // This is the quick search algorithm, as described at // http://www-igm.univ-mlv.fr/~lecroq/string/node19.html static void qs_preprocess (const Array& needle, - octave_idx_type table[TABSIZE]) + octave_idx_type *table) { const char *x = needle.data (); octave_idx_type m = needle.numel (); @@ -60,7 +60,7 @@ static Array qs_search (const Array& needle, const Array& haystack, - const octave_idx_type table[TABSIZE], + const octave_idx_type *table, bool overlaps = true) { const char *x = needle.data (); @@ -261,7 +261,7 @@ static Array qs_replace (const Array& str, const Array& pat, const Array& rep, - const octave_idx_type table[TABSIZE], + const octave_idx_type *table, bool overlaps = true) { Array ret = str; diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interp-core/gl-render.cc --- a/libinterp/interp-core/gl-render.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interp-core/gl-render.cc Wed Aug 22 17:36:54 2012 -0400 @@ -135,7 +135,7 @@ { int m = 1; - while (m < n && m < INT_MAX) + while (m < n && m < std::numeric_limits::max ()) m <<= 1; return m; @@ -1425,7 +1425,7 @@ Matrix z = xform.zscale (props.get_zdata ().matrix_value ()); bool has_z = (z.numel () > 0); - int n = static_cast (::xmin (::xmin (x.numel (), y.numel ()), (has_z ? z.numel () : INT_MAX))); + int n = static_cast (::xmin (::xmin (x.numel (), y.numel ()), (has_z ? z.numel () : std::numeric_limits::max ()))); octave_uint8 clip_mask = (props.is_clipping () ? 0x7F : 0x40), clip_ok (0x40); std::vector clip (n); diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interp-core/jit-typeinfo.cc --- a/libinterp/interp-core/jit-typeinfo.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interp-core/jit-typeinfo.cc Wed Aug 22 17:36:54 2012 -0400 @@ -381,8 +381,8 @@ xisint (double x) { return (D_NINT (x) == x - && ((x >= 0 && x < INT_MAX) - || (x <= 0 && x > INT_MIN))); + && ((x >= 0 && x < std::numeric_limits::max ()) + || (x <= 0 && x > std::numermic_limits::min ()))); } extern "C" Complex diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interp-core/oct-stream.cc --- a/libinterp/interp-core/oct-stream.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interp-core/oct-stream.cc Wed Aug 22 17:36:54 2012 -0400 @@ -1445,7 +1445,7 @@ do \ { \ if (! width) \ - width = INT_MAX; \ + width = std::numeric_limits::max (); \ \ std::ostringstream buf; \ \ @@ -1468,7 +1468,7 @@ buf << static_cast (c); \ } \ \ - if (width == INT_MAX && c != EOF) \ + if (width == std::numeric_limits::max () && c != EOF) \ is.putback (c); \ \ tmp = buf.str (); \ diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interp-core/sparse-xpow.cc --- a/libinterp/interp-core/sparse-xpow.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interp-core/sparse-xpow.cc Wed Aug 22 17:36:54 2012 -0400 @@ -26,7 +26,8 @@ #endif #include -#include + +#include #include "Array-util.h" #include "oct-cmplx.h" @@ -46,8 +47,8 @@ xisint (double x) { return (D_NINT (x) == x - && ((x >= 0 && x < INT_MAX) - || (x <= 0 && x > INT_MIN))); + && ((x >= 0 && x < std::numeric_limits::max ()) + || (x <= 0 && x > std::numeric_limits::min ()))); } diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interp-core/xpow.cc --- a/libinterp/interp-core/xpow.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interp-core/xpow.cc Wed Aug 22 17:36:54 2012 -0400 @@ -26,7 +26,8 @@ #endif #include -#include + +#include #include "Array-util.h" #include "CColVector.h" @@ -59,8 +60,8 @@ xisint (double x) { return (D_NINT (x) == x - && ((x >= 0 && x < INT_MAX) - || (x <= 0 && x > INT_MIN))); + && ((x >= 0 && x < std::numeric_limits::max ()) + || (x <= 0 && x > std::numeric_limits::min ()))); } // Safer pow functions. @@ -1508,8 +1509,8 @@ xisint (float x) { return (D_NINT (x) == x - && ((x >= 0 && x < INT_MAX) - || (x <= 0 && x > INT_MIN))); + && ((x >= 0 && x < std::numeric_limits::max ()) + || (x <= 0 && x > std::numeric_limits::min ()))); } // Safer pow functions. diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/debug.cc --- a/libinterp/interpfcn/debug.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/debug.cc Wed Aug 22 17:36:54 2012 -0400 @@ -825,7 +825,8 @@ dbg_fcn = get_user_code (); if (dbg_fcn) - do_dbtype (octave_stdout, dbg_fcn->name (), 0, INT_MAX); + do_dbtype (octave_stdout, dbg_fcn->name (), 0, + std::numeric_limits::max ()); else error ("dbtype: must be inside a user function to give no arguments to dbtype\n"); break; @@ -848,7 +849,7 @@ int start, end; start = atoi (start_str.c_str ()); if (end_str == "end") - end = INT_MAX; + end = std::numeric_limits::max (); else end = atoi (end_str.c_str ()); @@ -866,7 +867,8 @@ dbg_fcn = get_user_code (arg); if (dbg_fcn) - do_dbtype (octave_stdout, dbg_fcn->name (), 0, INT_MAX); + do_dbtype (octave_stdout, dbg_fcn->name (), 0, + std::numeric_limits::max ()); else error ("dbtype: function <%s> not found\n", arg.c_str ()); } @@ -889,7 +891,7 @@ start = atoi (start_str.c_str ()); if (end_str == "end") - end = INT_MAX; + end = std::numeric_limits::max (); else end = atoi (end_str.c_str ()); } diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/file-io.cc --- a/libinterp/interpfcn/file-io.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/file-io.cc Wed Aug 22 17:36:54 2012 -0400 @@ -39,10 +39,10 @@ #endif #include -#include #include #include +#include #include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/ls-oct-ascii.cc --- a/libinterp/interpfcn/ls-oct-ascii.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/ls-oct-ascii.cc Wed Aug 22 17:36:54 2012 -0400 @@ -428,5 +428,6 @@ variable value is restored when exiting the function.\n\ @end deftypefn") { - return SET_INTERNAL_VARIABLE_WITH_LIMITS (save_precision, -1, INT_MAX); + return SET_INTERNAL_VARIABLE_WITH_LIMITS (save_precision, -1, + std::numeric_limits::max ()); } diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/oct-hist.cc --- a/libinterp/interpfcn/oct-hist.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/oct-hist.cc Wed Aug 22 17:36:54 2012 -0400 @@ -698,7 +698,8 @@ int tmp = old_history_size; octave_value retval = set_internal_variable (tmp, args, nargout, - "history_size", -1, INT_MAX); + "history_size", -1, + std::numeric_limits::max ()); if (tmp != old_history_size) command_history::set_size (tmp); diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/pr-output.cc --- a/libinterp/interpfcn/pr-output.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/pr-output.cc Wed Aug 22 17:36:54 2012 -0400 @@ -356,7 +356,9 @@ s = "1/0"; else if (xisnan (val)) s = "0/0"; - else if (val < INT_MIN || val > INT_MAX || D_NINT (val) == val) + else if (val < std::numeric_limits::min () + || val > std::numeric_limits::max () + || D_NINT (val) == val) { std::ostringstream buf; buf.flags (std::ios::fixed); @@ -385,7 +387,7 @@ double nextd = d; // Have we converged to 1/intmax ? - if (m > 100 || fabs (frac) < 1 / static_cast(INT_MAX)) + if (m > 100 || fabs (frac) < 1 / static_cast (std::numeric_limits::max ())) { lastn = n; lastd = d; @@ -4068,7 +4070,8 @@ @seealso{format, fixed_point_format, output_precision}\n\ @end deftypefn") { - return SET_INTERNAL_VARIABLE_WITH_LIMITS (output_max_field_width, 0, INT_MAX); + return SET_INTERNAL_VARIABLE_WITH_LIMITS (output_max_field_width, 0, + std::numeric_limits::max ()); } DEFUN (output_precision, args, nargout, @@ -4085,5 +4088,6 @@ @seealso{format, fixed_point_format, output_max_field_width}\n\ @end deftypefn") { - return SET_INTERNAL_VARIABLE_WITH_LIMITS (output_precision, -1, INT_MAX); + return SET_INTERNAL_VARIABLE_WITH_LIMITS (output_precision, -1, + std::numeric_limits::max ()); } diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/utils.cc --- a/libinterp/interpfcn/utils.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/utils.cc Wed Aug 22 17:36:54 2012 -0400 @@ -26,11 +26,11 @@ #endif #include -#include #include #include #include +#include #include #include @@ -1266,7 +1266,9 @@ = static_cast (modf (seconds, &t) * 1000000); unsigned int sec - = (t > UINT_MAX) ? UINT_MAX : static_cast (t); + = ((t > std::numeric_limits::max ()) + ? std::numeric_limits::max () + : static_cast (t)); // Versions of these functions that accept unsigned int args are // defined in cutils.c. diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/interpfcn/variables.h --- a/libinterp/interpfcn/variables.h Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/interpfcn/variables.h Wed Aug 22 17:36:54 2012 -0400 @@ -32,11 +32,13 @@ class octave_builtin; class string_vector; -#include #include +#include #include +#include "lo-ieee.h" + #include "ov.h" #include "ov-builtin.h" #include "symtab.h" @@ -97,7 +99,8 @@ extern OCTINTERP_API octave_value set_internal_variable (int& var, const octave_value_list& args, int nargout, const char *nm, - int minval = INT_MIN, int maxval = INT_MAX); + int minval = std::numeric_limits::min (), + int maxval = std::numeric_limits::max ()); extern OCTINTERP_API octave_value set_internal_variable (double& var, const octave_value_list& args, diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-base-int.cc --- a/libinterp/octave-value/ov-base-int.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-base-int.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include #include "lo-ieee.h" @@ -65,7 +64,10 @@ struct octave_base_int_helper { static bool - char_value_out_of_range (T val) { return val < 0 || val > UCHAR_MAX; } + char_value_out_of_range (T val) + { + return val < 0 || val > std::numeric_limits::max (); + } }; template @@ -77,7 +79,10 @@ template struct octave_base_int_helper { - static bool char_value_out_of_range (T val) { return val > UCHAR_MAX; } + static bool char_value_out_of_range (T val) + { + return val > std::numeric_limits::max (); + } }; template diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-base.cc --- a/libinterp/octave-value/ov-base.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-base.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-mappers.h" @@ -450,7 +449,7 @@ os << "no info for type: " << type_name () << "\n"; } -#define INT_CONV_METHOD(T, F, MIN_LIMIT, MAX_LIMIT) \ +#define INT_CONV_METHOD(T, F) \ T \ octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \ { \ @@ -462,10 +461,10 @@ { \ if (require_int && D_NINT (d) != d) \ error_with_cfn ("conversion of %g to " #T " value failed", d); \ - else if (d < MIN_LIMIT) \ - retval = MIN_LIMIT; \ - else if (d > MAX_LIMIT) \ - retval = MAX_LIMIT; \ + else if (d < std::numeric_limits::min ()) \ + retval = std::numeric_limits::min (); \ + else if (d > std::numeric_limits::max ()) \ + retval = std::numeric_limits::max (); \ else \ retval = static_cast (::fix (d)); \ } \ @@ -476,14 +475,14 @@ return retval; \ } -INT_CONV_METHOD (short int, short, SHRT_MIN, SHRT_MAX) -INT_CONV_METHOD (unsigned short int, ushort, 0, USHRT_MAX) +INT_CONV_METHOD (short int, short) +INT_CONV_METHOD (unsigned short int, ushort) -INT_CONV_METHOD (int, int, INT_MIN, INT_MAX) -INT_CONV_METHOD (unsigned int, uint, 0, UINT_MAX) +INT_CONV_METHOD (int, int) +INT_CONV_METHOD (unsigned int, uint) -INT_CONV_METHOD (long int, long, LONG_MIN, LONG_MAX) -INT_CONV_METHOD (unsigned long int, ulong, 0, ULONG_MAX) +INT_CONV_METHOD (long int, long) +INT_CONV_METHOD (unsigned long int, ulong) int octave_base_value::nint_value (bool frc_str_conv) const diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-bool-sparse.cc --- a/libinterp/octave-value/ov-bool-sparse.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-bool-sparse.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include #include "dim-vector.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-cx-sparse.cc --- a/libinterp/octave-value/ov-cx-sparse.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-cx-sparse.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include #include "lo-specfun.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-float.cc --- a/libinterp/octave-value/ov-float.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-float.cc Wed Aug 22 17:36:54 2012 -0400 @@ -115,7 +115,7 @@ { int ival = NINT (scalar); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) { // FIXME -- is there something better we could do? diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-flt-re-mat.cc --- a/libinterp/octave-value/ov-flt-re-mat.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-flt-re-mat.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include #include "data-conv.h" @@ -69,10 +68,6 @@ #include "ls-utils.h" #include "ls-hdf5.h" -#if ! defined (UCHAR_MAX) -#define UCHAR_MAX 255 -#endif - template class octave_base_matrix; DEFINE_OCTAVE_ALLOCATOR (octave_float_matrix); @@ -308,7 +303,7 @@ { int ival = NINT (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) { // FIXME -- is there something // better we could do? diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-int16.cc --- a/libinterp/octave-value/ov-int16.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-int16.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-int32.cc --- a/libinterp/octave-value/ov-int32.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-int32.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-int64.cc --- a/libinterp/octave-value/ov-int64.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-int64.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-int8.cc --- a/libinterp/octave-value/ov-int8.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-int8.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-re-mat.cc --- a/libinterp/octave-value/ov-re-mat.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-re-mat.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include #include "data-conv.h" @@ -69,10 +68,6 @@ #include "ls-utils.h" #include "ls-hdf5.h" -#if ! defined (UCHAR_MAX) -#define UCHAR_MAX 255 -#endif - template class octave_base_matrix; DEFINE_OCTAVE_ALLOCATOR (octave_matrix); @@ -410,7 +405,7 @@ { int ival = NINT (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) { // FIXME -- is there something // better we could do? diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-re-sparse.cc --- a/libinterp/octave-value/ov-re-sparse.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-re-sparse.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,9 +25,8 @@ #include #endif -#include - #include +#include #include #include "lo-specfun.h" @@ -233,7 +232,7 @@ { int ival = NINT (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) { // FIXME -- is there something // better we could do? diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-scalar.cc --- a/libinterp/octave-value/ov-scalar.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-scalar.cc Wed Aug 22 17:36:54 2012 -0400 @@ -130,7 +130,7 @@ { int ival = NINT (scalar); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) { // FIXME -- is there something better we could do? diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-struct.cc --- a/libinterp/octave-value/ov-struct.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-struct.cc Wed Aug 22 17:36:54 2012 -0400 @@ -2212,8 +2212,8 @@ variable value is restored when exiting the function.\n\ @end deftypefn") { - return SET_INTERNAL_VARIABLE_WITH_LIMITS (struct_levels_to_print, - -1, INT_MAX); + return SET_INTERNAL_VARIABLE_WITH_LIMITS (struct_levels_to_print, -1, + std::numeric_limits::max ()); } DEFUN (print_struct_array_contents, args, nargout, diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-uint16.cc --- a/libinterp/octave-value/ov-uint16.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-uint16.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-uint32.cc --- a/libinterp/octave-value/ov-uint32.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-uint32.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-uint64.cc --- a/libinterp/octave-value/ov-uint64.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-uint64.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a libinterp/octave-value/ov-uint8.cc --- a/libinterp/octave-value/ov-uint8.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/libinterp/octave-value/ov-uint8.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,9 +24,8 @@ #include #endif -#include - #include +#include #include "lo-ieee.h" #include "lo-utils.h" diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/Array.cc --- a/liboctave/Array.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/Array.cc Wed Aug 22 17:36:54 2012 -0400 @@ -28,7 +28,6 @@ #endif #include -#include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/Sparse.cc --- a/liboctave/Sparse.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/Sparse.cc Wed Aug 22 17:36:54 2012 -0400 @@ -28,10 +28,10 @@ #endif #include -#include #include #include +#include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/chNDArray.cc --- a/liboctave/chNDArray.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/chNDArray.cc Wed Aug 22 17:36:54 2012 -0400 @@ -79,7 +79,7 @@ { octave_idx_type ival = NINTbig (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) // FIXME -- is there something // better we could do? Should we warn the user? ival = 0; diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/dNDArray.cc --- a/liboctave/dNDArray.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/dNDArray.cc Wed Aug 22 17:36:54 2012 -0400 @@ -776,7 +776,7 @@ { octave_idx_type ival = NINTbig (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) // FIXME -- is there something // better we could do? Should we warn the user? ival = 0; diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/data-conv.cc --- a/liboctave/data-conv.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/data-conv.cc Wed Aug 22 17:36:54 2012 -0400 @@ -25,6 +25,7 @@ #endif #include +#include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/data-conv.h --- a/liboctave/data-conv.h Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/data-conv.h Wed Aug 22 17:36:54 2012 -0400 @@ -23,7 +23,7 @@ #if !defined (octave_data_conv_h) #define octave_data_conv_h 1 -#include +#include #include "mach-info.h" diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/fNDArray.cc --- a/liboctave/fNDArray.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/fNDArray.cc Wed Aug 22 17:36:54 2012 -0400 @@ -736,7 +736,7 @@ { octave_idx_type ival = NINTbig (d); - if (ival < 0 || ival > UCHAR_MAX) + if (ival < 0 || ival > std::numeric_limits::max ()) // FIXME -- is there something // better we could do? Should we warn the user? ival = 0; diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/kpse.cc --- a/liboctave/kpse.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/kpse.cc Wed Aug 22 17:36:54 2012 -0400 @@ -129,7 +129,6 @@ #include #include #include -#include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/oct-inttypes.h --- a/liboctave/oct-inttypes.h Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/oct-inttypes.h Wed Aug 22 17:36:54 2012 -0400 @@ -24,7 +24,6 @@ #if !defined (octave_inttypes_h) #define octave_inttypes_h 1 -#include #include #include diff -r ae6b7ee0a733 -r 9020dddc925a liboctave/oct-time.cc --- a/liboctave/oct-time.cc Wed Aug 22 13:46:29 2012 -0700 +++ b/liboctave/oct-time.cc Wed Aug 22 17:36:54 2012 -0400 @@ -24,7 +24,8 @@ #include #endif -#include +#include + #include #include @@ -121,7 +122,8 @@ DEFINE_SET_INT_FIELD_FCN (hour, 0, 23) DEFINE_SET_INT_FIELD_FCN (mday, 1, 31) DEFINE_SET_INT_FIELD_FCN (mon, 0, 11) -DEFINE_SET_INT_FIELD_FCN (year, INT_MIN, INT_MAX) +DEFINE_SET_INT_FIELD_FCN (year, std::numeric_limits::min (), + std::numeric_limitd::max ()) DEFINE_SET_INT_FIELD_FCN (wday, 0, 6) DEFINE_SET_INT_FIELD_FCN (yday, 0, 365) DEFINE_SET_INT_FIELD_FCN (isdst, 0, 1) @@ -256,7 +258,7 @@ t.tm_hour = 0; t.tm_mday = 0; t.tm_mon = -1; - t.tm_year = INT_MIN; + t.tm_year = std::numeric_limits::min (); t.tm_wday = 0; t.tm_yday = 0; t.tm_isdst = 0; @@ -276,7 +278,8 @@ // Fill in wday and yday, but only if mday is valid and the mon and year // are filled in, avoiding issues with mktime and invalid dates. - if (t.tm_mday != 0 && t.tm_mon >= 0 && t.tm_year != INT_MIN) + if (t.tm_mday != 0 && t.tm_mon >= 0 + && t.tm_year != std::numeric_limits::min ()) { t.tm_isdst = -1; gnulib::mktime (&t); @@ -285,7 +288,7 @@ if (t.tm_mon < 0) t.tm_mon = 0; - if (t.tm_year == INT_MIN) + if (t.tm_year == std::numeric_limits::min ()) t.tm_year = 0; if (q)