Mercurial > jwe > octave
comparison libinterp/octave-value/ov-scalar.cc @ 21118:3ac9f47fb04b
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
* daspk.cc, dasrt.cc, dassl.cc, data.cc, debug.cc, load-save.cc, lsode.cc,
quad.cc, xnorm.cc, xpow.cc, ov-base-diag.cc, ov-base-mat.cc, ov-base-scalar.cc,
ov-base.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-ch-mat.cc,
ov-class.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-float.cc, ov-flt-cx-mat.cc,
ov-flt-re-mat.cc, ov-intx.h, ov-perm.cc, ov-range.cc, ov-re-mat.cc,
ov-re-sparse.cc, ov-scalar.cc, ov-struct.cc, ov.cc, pt-idx.cc, Array-util.cc,
Array.cc, Sparse.cc, lo-specfun.cc, mx-inlines.cc, oct-binmap.h:
Invert pattern if/code/else/err_XXX to if !/err_XXX/code.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 20 Jan 2016 16:08:30 -0800 |
parents | dfcb9d74b253 |
children | fcac5dbbf9ed |
comparison
equal
deleted
inserted
replaced
21117:c1df36373272 | 21118:3ac9f47fb04b |
---|---|
125 { | 125 { |
126 octave_value retval; | 126 octave_value retval; |
127 | 127 |
128 if (xisnan (scalar)) | 128 if (xisnan (scalar)) |
129 err_nan_to_character_conversion (); | 129 err_nan_to_character_conversion (); |
130 else | 130 |
131 { | 131 int ival = NINT (scalar); |
132 int ival = NINT (scalar); | 132 |
133 | 133 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) |
134 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ()) | 134 { |
135 { | 135 // FIXME: is there something better we could do? |
136 // FIXME: is there something better we could do? | 136 |
137 | 137 ival = 0; |
138 ival = 0; | 138 |
139 | 139 ::warning ("range error for conversion to character value"); |
140 ::warning ("range error for conversion to character value"); | 140 } |
141 } | 141 |
142 | 142 retval = octave_value (std::string (1, static_cast<char> (ival)), type); |
143 retval = octave_value (std::string (1, static_cast<char> (ival)), type); | |
144 } | |
145 | 143 |
146 return retval; | 144 return retval; |
147 } | 145 } |
148 | 146 |
149 bool | 147 bool |