Skip to content

Commit f8a36d2

Browse files
committed
Merge remote-tracking branch 'origin/safeintfix' into vs14rc_update
2 parents 3b6e4fc + 7a7d4da commit f8a36d2

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ halex2005
1818
simonlep
1919
jracle
2020
gandziej
21+
adish
2122

2223
AutoDesk Inc.
2324
Cyrille Fauvel (cyrillef)

Release/include/cpprest/details/SafeInt3.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ This header compiles properly at Wall on Visual Studio, -Wall on gcc, and -Wever
5151
5252
Please read the leading comments before using the class.
5353
---------------------------------------------------------------*/
54-
#ifndef SAFEINT_HPP
55-
#define SAFEINT_HPP
54+
#pragma once
5655

5756
// It is a bit tricky to sort out what compiler we are actually using,
5857
// do this once here, and avoid cluttering the code
@@ -7042,7 +7041,6 @@ SafeInt< T, E > operator |( U lhs, SafeInt< T, E > rhs ) SAFEINT_NOTHROW
70427041
#if SAFEINT_COMPILER == CLANG_COMPILER
70437042
#pragma clang diagnostic pop
70447043
#endif
7045-
#endif //SAFEINT_HPP
70467044

70477045
} // utilities
70487046
} // safeint3

Release/src/http/oauth/oauth2.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,20 @@ oauth2_token oauth2_config::_parse_token_from_json(const json::value& token_json
187187

188188
if (token_json.has_field(oauth2_strings::expires_in))
189189
{
190-
result.set_expires_in(token_json.at(oauth2_strings::expires_in).as_number().to_int64());
190+
const auto &json_expires_in_val = token_json.at(oauth2_strings::expires_in);
191+
192+
if (json_expires_in_val.is_number())
193+
result.set_expires_in(json_expires_in_val.as_number().to_int64());
194+
else
195+
{
196+
// Handle the case of a number as a JSON "string".
197+
// Using streams because std::stoll isn't avaliable on Android.
198+
int64_t expires;
199+
utility::istringstream_t iss(json_expires_in_val.as_string());
200+
iss.exceptions(std::ios::badbit | std::ios::failbit);
201+
iss >> expires;
202+
result.set_expires_in(expires);
203+
}
191204
}
192205
else
193206
{

0 commit comments

Comments
 (0)