mirror of
https://github.com/serde-rs/json.git
synced 2025-10-03 07:46:05 +00:00
Merge pull request #426 from mtn/exp_pos
Replace instances of "exp_pos" with "exp_positive"
This commit is contained in:
commit
415dead816
10
src/de.rs
10
src/de.rs
@ -430,7 +430,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
|
|||||||
) -> Result<f64> {
|
) -> Result<f64> {
|
||||||
self.eat_char();
|
self.eat_char();
|
||||||
|
|
||||||
let pos_exp = match try!(self.peek_or_null()) {
|
let positive_exp = match try!(self.peek_or_null()) {
|
||||||
b'+' => {
|
b'+' => {
|
||||||
self.eat_char();
|
self.eat_char();
|
||||||
true
|
true
|
||||||
@ -455,13 +455,13 @@ impl<'de, R: Read<'de>> Deserializer<R> {
|
|||||||
let digit = (c - b'0') as i32;
|
let digit = (c - b'0') as i32;
|
||||||
|
|
||||||
if overflow!(exp * 10 + digit, i32::max_value()) {
|
if overflow!(exp * 10 + digit, i32::max_value()) {
|
||||||
return self.parse_exponent_overflow(positive, significand, pos_exp);
|
return self.parse_exponent_overflow(positive, significand, positive_exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
exp = exp * 10 + digit;
|
exp = exp * 10 + digit;
|
||||||
}
|
}
|
||||||
|
|
||||||
let final_exp = if pos_exp {
|
let final_exp = if positive_exp {
|
||||||
starting_exp.saturating_add(exp)
|
starting_exp.saturating_add(exp)
|
||||||
} else {
|
} else {
|
||||||
starting_exp.saturating_sub(exp)
|
starting_exp.saturating_sub(exp)
|
||||||
@ -478,10 +478,10 @@ impl<'de, R: Read<'de>> Deserializer<R> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
positive: bool,
|
positive: bool,
|
||||||
significand: u64,
|
significand: u64,
|
||||||
pos_exp: bool,
|
positive_exp: bool,
|
||||||
) -> Result<f64> {
|
) -> Result<f64> {
|
||||||
// Error instead of +/- infinity.
|
// Error instead of +/- infinity.
|
||||||
if significand != 0 && pos_exp {
|
if significand != 0 && positive_exp {
|
||||||
return Err(self.error(ErrorCode::NumberOutOfRange));
|
return Err(self.error(ErrorCode::NumberOutOfRange));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user