Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
louiz’
biboumi
Commits
720e31a5
Commit
720e31a5
authored
Dec 17, 2014
by
louiz’
Browse files
Fix a few issues reported by static analyzers
parent
0ab5ecea
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/bridge/bridge.cpp
View file @
720e31a5
...
...
@@ -480,7 +480,7 @@ void Bridge::send_user_join(const std::string& hostname,
affiliation
,
role
,
this
->
user_jid
,
self
);
}
void
Bridge
::
send_topic
(
const
std
::
string
&
hostname
,
const
std
::
string
&
chan_name
,
const
std
::
string
topic
)
void
Bridge
::
send_topic
(
const
std
::
string
&
hostname
,
const
std
::
string
&
chan_name
,
const
std
::
string
&
topic
)
{
this
->
xmpp
->
send_topic
(
chan_name
+
"%"
+
hostname
,
this
->
make_xmpp_body
(
topic
),
this
->
user_jid
);
}
...
...
src/bridge/bridge.hpp
View file @
720e31a5
...
...
@@ -114,7 +114,7 @@ public:
/**
* Send the topic of the MUC to the user
*/
void
send_topic
(
const
std
::
string
&
hostname
,
const
std
::
string
&
chan_name
,
const
std
::
string
topic
);
void
send_topic
(
const
std
::
string
&
hostname
,
const
std
::
string
&
chan_name
,
const
std
::
string
&
topic
);
/**
* Send a MUC message from some participant
*/
...
...
src/bridge/colors.cpp
View file @
720e31a5
...
...
@@ -166,10 +166,8 @@ Xmpp::body irc_format_to_xhtmlim(const std::string& s)
{
current_node
->
close
();
result
->
add_child
(
current_node
);
current_node
=
result
.
get
();
}
result
->
close
();
Xmpp
::
body
body_res
=
std
::
make_tuple
(
cleaned
,
std
::
move
(
result
));
return
body_res
;
...
...
src/config/config.cpp
View file @
720e31a5
...
...
@@ -28,13 +28,6 @@ int Config::get_int(const std::string& option, const int& def)
return
def
;
}
void
Config
::
set_int
(
const
std
::
string
&
option
,
const
int
&
value
,
bool
save
)
{
std
::
ostringstream
os
;
os
<<
value
;
Config
::
set
(
option
,
os
.
str
(),
save
);
}
void
Config
::
set
(
const
std
::
string
&
option
,
const
std
::
string
&
value
,
bool
save
)
{
Config
*
self
=
Config
::
instance
().
get
();
...
...
src/config/config.hpp
View file @
720e31a5
...
...
@@ -52,14 +52,6 @@ public:
* @param save if true, save the config file
*/
static
void
set
(
const
std
::
string
&
,
const
std
::
string
&
,
bool
save
=
false
);
/**
* Set a value for the given option. And write all the config
* in the file from which it was read if boolean is set.
* @param option The option to set
* @param value The value to use
* @param save if true, save the config file
*/
static
void
set_int
(
const
std
::
string
&
,
const
int
&
,
bool
save
=
false
);
/**
* Adds a function to a list. This function will be called whenever a
* configuration change occurs.
...
...
src/irc/irc_channel.cpp
View file @
720e31a5
...
...
@@ -12,7 +12,7 @@ void IrcChannel::set_self(const std::string& name)
}
IrcUser
*
IrcChannel
::
add_user
(
const
std
::
string
&
name
,
const
std
::
map
<
char
,
char
>
prefix_to_mode
)
const
std
::
map
<
char
,
char
>
&
prefix_to_mode
)
{
this
->
users
.
emplace_back
(
std
::
make_unique
<
IrcUser
>
(
name
,
prefix_to_mode
));
return
this
->
users
.
back
().
get
();
...
...
src/irc/irc_channel.hpp
View file @
720e31a5
...
...
@@ -21,7 +21,7 @@ public:
void
set_self
(
const
std
::
string
&
name
);
IrcUser
*
get_self
()
const
;
IrcUser
*
add_user
(
const
std
::
string
&
name
,
const
std
::
map
<
char
,
char
>
prefix_to_mode
);
const
std
::
map
<
char
,
char
>
&
prefix_to_mode
);
IrcUser
*
find_user
(
const
std
::
string
&
name
)
const
;
void
remove_user
(
const
IrcUser
*
user
);
void
remove_all_users
();
...
...
src/network/poller.cpp
View file @
720e31a5
...
...
@@ -133,7 +133,7 @@ void Poller::stop_watching_send_events(SocketHandler* socket_handler)
int
Poller
::
poll
(
const
std
::
chrono
::
milliseconds
&
timeout
)
{
if
(
this
->
socket_handlers
.
size
()
==
0
)
if
(
this
->
socket_handlers
.
empty
()
)
return
-
1
;
#if POLLER == POLL
int
nb_events
=
::
poll
(
this
->
fds
,
this
->
nfds
,
timeout
.
count
());
...
...
src/test.cpp
View file @
720e31a5
...
...
@@ -222,7 +222,7 @@ int main()
IrcUser
user2
(
"coucou!~other@host.bla"
,
prefixes
);
assert
(
user2
.
nick
==
"coucou"
);
assert
(
user2
.
host
==
"~other@host.bla"
);
assert
(
user2
.
modes
.
size
()
==
0
);
assert
(
user2
.
modes
.
empty
()
);
assert
(
user2
.
modes
.
find
(
'a'
)
==
user2
.
modes
.
end
());
/**
...
...
src/utils/encoding.cpp
View file @
720e31a5
...
...
@@ -197,6 +197,7 @@ namespace utils
case
E2BIG
:
// This should never happen
done
=
true
;
break
;
default:
// This should happen even neverer
done
=
true
;
...
...
src/xmpp/adhoc_commands_handler.cpp
View file @
720e31a5
...
...
@@ -29,7 +29,7 @@ const std::map<const std::string, const AdhocCommand>& AdhocCommandsHandler::get
return
this
->
commands
;
}
XmlNode
&&
AdhocCommandsHandler
::
handle_request
(
const
std
::
string
&
executor_jid
,
XmlNode
command_node
)
XmlNode
AdhocCommandsHandler
::
handle_request
(
const
std
::
string
&
executor_jid
,
XmlNode
command_node
)
{
std
::
string
action
=
command_node
.
get_tag
(
"action"
);
if
(
action
.
empty
())
...
...
@@ -127,7 +127,7 @@ XmlNode&& AdhocCommandsHandler::handle_request(const std::string& executor_jid,
command_node
.
add_child
(
std
::
move
(
error
));
}
}
return
std
::
move
(
command_node
)
;
return
command_node
;
}
void
AdhocCommandsHandler
::
remove_session
(
const
std
::
string
&
session_id
,
const
std
::
string
&
initiator_jid
)
...
...
src/xmpp/adhoc_commands_handler.hpp
View file @
720e31a5
...
...
@@ -36,7 +36,7 @@ public:
* Takes a copy of the <command/> node so we can actually edit it and use
* it as our return value.
*/
XmlNode
&&
handle_request
(
const
std
::
string
&
executor_jid
,
XmlNode
command_node
);
XmlNode
handle_request
(
const
std
::
string
&
executor_jid
,
XmlNode
command_node
);
/**
* Remove the session from the list. This is done to avoid filling the
* memory with waiting session (for example due to a client that starts
...
...
src/xmpp/xmpp_component.cpp
View file @
720e31a5
...
...
@@ -286,7 +286,6 @@ void XmppComponent::handle_handshake(const Stanza& stanza)
uint64_t
usec
;
if
(
sd_watchdog_enabled
(
0
,
&
usec
)
>
0
)
{
std
::
chrono
::
microseconds
delay
(
usec
);
TimedEventsManager
::
instance
().
add_event
(
TimedEvent
(
std
::
chrono
::
duration_cast
<
std
::
chrono
::
milliseconds
>
(
std
::
chrono
::
microseconds
(
usec
/
2
)),
[]()
{
sd_notify
(
0
,
"WATCHDOG=1"
);
}));
...
...
src/xmpp/xmpp_stanza.hpp
View file @
720e31a5
...
...
@@ -151,7 +151,7 @@ private:
/**
* An XMPP stanza is just an XML node of level 2 in the XMPP document (the
* level 1 ones are the <stream::stream/>, and the ones abo
ut
2 are just the
* level 1 ones are the <stream::stream/>, and the ones abo
ve
2 are just the
* content of the stanzas)
*/
typedef
XmlNode
Stanza
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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