Skip to content

Commit ced3602

Browse files
committed
Merge pull request #42 from francoisvdv/master
Use boost::lexical_cast instead of std::stoi for Android compatibility.
2 parents 80b2380 + a32f1ec commit ced3602

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/internal/sio_packet.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <rapidjson/encodedstream.h>
1010
#include <rapidjson/writer.h>
1111
#include <cassert>
12+
#include <boost/lexical_cast.hpp>
1213

1314
#define kBIN_PLACE_HOLDER "_placeholder"
1415

@@ -259,7 +260,7 @@ namespace sio
259260
pos++;
260261
if (_type == type_binary_event || _type == type_binary_ack) {
261262
size_t score_pos = payload_ptr.find('-');
262-
_pending_buffers = stoi(payload_ptr.substr(pos,score_pos));
263+
_pending_buffers = boost::lexical_cast<unsigned>(payload_ptr.substr(pos,score_pos));
263264
pos = score_pos+1;
264265
}
265266
}
@@ -299,7 +300,7 @@ namespace sio
299300

300301
if(pos<json_pos)//we've got pack id.
301302
{
302-
_pack_id = stoi(payload_ptr.substr(pos,json_pos - pos));
303+
_pack_id = boost::lexical_cast<int>(payload_ptr.substr(pos,json_pos - pos));
303304
}
304305
if (_frame == frame_message && (_type == type_binary_event || _type == type_binary_ack)) {
305306
//parse later when all buffers are arrived.

0 commit comments

Comments
 (0)