Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
ad493bec
Commit
ad493bec
authored
Aug 30, 2017
by
Ronan
Browse files
fix(ChatRoom): use Utils::toString instead of to_string (Android problem)
parent
289dc072
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
1 deletion
+36
-1
src/chat/chat-room.cpp
src/chat/chat-room.cpp
+1
-1
src/utils/utils.cpp
src/utils/utils.cpp
+25
-0
src/utils/utils.h
src/utils/utils.h
+10
-0
No files found.
src/chat/chat-room.cpp
View file @
ad493bec
...
...
@@ -247,7 +247,7 @@ string ChatRoomPrivate::createIsComposingXml () const {
}
if
((
err
>=
0
)
&&
isComposing
)
{
int
refreshTimeout
=
lp_config_get_int
(
core
->
config
,
"sip"
,
"composing_refresh_timeout"
,
composingDefaultRefreshTimeout
);
err
=
xmlTextWriterWriteElement
(
writer
,
(
const
xmlChar
*
)
"refresh"
,
(
const
xmlChar
*
)
to_s
tring
(
refreshTimeout
).
c_str
());
err
=
xmlTextWriterWriteElement
(
writer
,
(
const
xmlChar
*
)
"refresh"
,
(
const
xmlChar
*
)
Utils
::
toS
tring
(
refreshTimeout
).
c_str
());
}
if
(
err
>=
0
)
{
/* Close the "isComposing" element. */
...
...
src/utils/utils.cpp
View file @
ad493bec
...
...
@@ -17,6 +17,7 @@
*/
#include <cstdlib>
#include <sstream>
#include <bctoolbox/port.h>
...
...
@@ -52,6 +53,30 @@ vector<string> Utils::split (const string &str, const string &delimiter) {
return
out
;
}
#ifndef __ANDROID__
#define TO_STRING_IMPL(TYPE) \
string Utils::toString(TYPE val) { \
return to_string(val); \
}
#else
#define TO_STRING_IMPL(TYPE) \
string Utils::toString(TYPE val) { \
ostringstream os; \
os << val; \
return os.str(); \
}
#endif // ifndef __ANDROID__
TO_STRING_IMPL
(
int
)
TO_STRING_IMPL
(
long
)
TO_STRING_IMPL
(
long
long
)
TO_STRING_IMPL
(
unsigned
)
TO_STRING_IMPL
(
unsigned
long
)
TO_STRING_IMPL
(
unsigned
long
long
)
TO_STRING_IMPL
(
float
)
TO_STRING_IMPL
(
double
)
TO_STRING_IMPL
(
long
double
)
int
Utils
::
stoi
(
const
string
&
str
,
size_t
*
idx
,
int
base
)
{
char
*
p
;
int
v
=
strtol
(
str
.
c_str
(),
&
p
,
base
);
...
...
src/utils/utils.h
View file @
ad493bec
...
...
@@ -37,6 +37,16 @@ namespace Utils {
return
split
(
str
,
std
::
string
(
1
,
delimiter
));
}
LINPHONE_PUBLIC
std
::
string
toString
(
int
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
long
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
long
long
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
unsigned
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
unsigned
long
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
unsigned
long
long
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
float
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
double
val
);
LINPHONE_PUBLIC
std
::
string
toString
(
long
double
val
);
LINPHONE_PUBLIC
int
stoi
(
const
std
::
string
&
str
,
size_t
*
idx
=
0
,
int
base
=
10
);
// Return a buffer allocated with new.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment