Commit af0c5d6f authored by Steffen Vogel's avatar Steffen Vogel

fix more compiler warnings emitted by Clang on Travis-CI

parent 7d69f710
......@@ -193,7 +193,7 @@ void os_display_string (const zchar *s)
else if (c == ZC_NEW_STYLE)
os_set_text_style(*s++);
else {
os_display_char (c);
os_display_char (c);
}
}
......@@ -268,8 +268,12 @@ static bool will_print_blank(cell c)
static void show_line_prefix(int row, char c)
{
if (show_line_numbers)
printf((row == -1) ? ".." : "%02d", (row + 1) % 100);
if (show_line_numbers) {
if (row == -1)
printf("..");
else
printf("%02d", (row + 1) % 100);
}
if (show_line_types)
putchar(c);
/* Add a separator char (unless there's nothing to separate). */
......@@ -330,7 +334,7 @@ static bool is_blank(cell c)
void dumb_show_screen(bool show_cursor)
{
int r, c, first, last;
char changed_rows[0x100];
char changed_rows[0x100];
/* Easy case */
if (compression_mode == COMPRESSION_NONE) {
......@@ -343,7 +347,7 @@ void dumb_show_screen(bool show_cursor)
/* Check which rows changed, and where the first and last change is. */
first = last = -1;
memset(changed_rows, 0, h_screen_rows);
for (r = hide_lines; r < h_screen_rows; r++) {
for (r = hide_lines; r < h_screen_rows; r++) {
for (c = 0; c < h_screen_cols; c++)
if (dumb_changes_row(r)[c] && !is_blank(dumb_row(r)[c]))
break;
......@@ -368,7 +372,7 @@ void dumb_show_screen(bool show_cursor)
/* Display the appropriate rows. */
if (compression_mode == COMPRESSION_MAX) {
for (r = first; r <= last; r++)
for (r = first; r <= last; r++)
if (changed_rows[r])
show_row(r);
} else {
......
......@@ -714,7 +714,7 @@ void TwitterPlugin::displayTweets(std::string &user, std::string &userRequested,
std::map<std::string, int> lastTweet;
std::map<std::string, int>::iterator it;
for(unsigned i = tweets.size() - 1 ; i >= 0 ; i--) {
for(int i = tweets.size() - 1 ; i >= 0 ; i--) {
if(userdb[user].twitterMode != CHATROOM) {
std::string m = " - " + tweets[i].getUserData().getScreenName() + ": " + tweets[i].getTweet() + " (MsgId: " + (tweets[i].getRetweetID().empty() ? tweets[i].getID() : tweets[i].getRetweetID()) + ")\n";
handleMessage(user, adminLegacyName, m, "", "", tweets[i].getCreationTime(), true);
......
......@@ -45,13 +45,13 @@ namespace utf8
}
else if (cp < 0x10000) { // three octets
*(result++) = static_cast<uint8_t>((cp >> 12) | 0xe0);
*(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80);
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
}
else { // four octets
*(result++) = static_cast<uint8_t>((cp >> 18) | 0xf0);
*(result++) = static_cast<uint8_t>((cp >> 12)& 0x3f | 0x80);
*(result++) = static_cast<uint8_t>((cp >> 6) & 0x3f | 0x80);
*(result++) = static_cast<uint8_t>(((cp >> 12) & 0x3f)| 0x80);
*(result++) = static_cast<uint8_t>(((cp >> 6) & 0x3f) | 0x80);
*(result++) = static_cast<uint8_t>((cp & 0x3f) | 0x80);
}
return result;
......
......@@ -52,7 +52,7 @@ static std::string getArg(const std::string &body) {
class StatusCommand : public AdminInterfaceCommand {
public:
StatusCommand(NetworkPluginServer *server, UserManager *userManager) :
AdminInterfaceCommand("status",
AdminInterfaceCommand::General,
......@@ -83,7 +83,7 @@ class StatusCommand : public AdminInterfaceCommand {
class UptimeCommand : public AdminInterfaceCommand {
public:
UptimeCommand() : AdminInterfaceCommand("uptime",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -108,7 +108,7 @@ class UptimeCommand : public AdminInterfaceCommand {
class OnlineUsersCommand : public AdminInterfaceCommand {
public:
OnlineUsersCommand(UserManager *userManager) : AdminInterfaceCommand("online_users",
AdminInterfaceCommand::Users,
AdminInterfaceCommand::GlobalContext,
......@@ -142,7 +142,7 @@ class OnlineUsersCommand : public AdminInterfaceCommand {
class OnlineUsersCountCommand : public AdminInterfaceCommand {
public:
OnlineUsersCountCommand(UserManager *userManager) : AdminInterfaceCommand("online_users_count",
AdminInterfaceCommand::Users,
AdminInterfaceCommand::GlobalContext,
......@@ -168,7 +168,7 @@ class OnlineUsersCountCommand : public AdminInterfaceCommand {
class OnlineUsersPerBackendCommand : public AdminInterfaceCommand {
public:
OnlineUsersPerBackendCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("online_users_per_backend",
AdminInterfaceCommand::General,
......@@ -209,6 +209,8 @@ class OnlineUsersPerBackendCommand : public AdminInterfaceCommand {
}
id++;
}
return lst;
}
private:
......@@ -217,7 +219,7 @@ class OnlineUsersPerBackendCommand : public AdminInterfaceCommand {
class BackendsCountCommand : public AdminInterfaceCommand {
public:
BackendsCountCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("backends_count",
AdminInterfaceCommand::Backends,
......@@ -244,7 +246,7 @@ class BackendsCountCommand : public AdminInterfaceCommand {
class ReloadCommand : public AdminInterfaceCommand {
public:
ReloadCommand(Component *component) : AdminInterfaceCommand("reload",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -276,7 +278,7 @@ class ReloadCommand : public AdminInterfaceCommand {
class HasOnlineUserCommand : public AdminInterfaceCommand {
public:
HasOnlineUserCommand(UserManager *userManager) : AdminInterfaceCommand("has_online_user",
AdminInterfaceCommand::Users,
AdminInterfaceCommand::GlobalContext,
......@@ -307,7 +309,7 @@ class HasOnlineUserCommand : public AdminInterfaceCommand {
class ResMemoryCommand : public AdminInterfaceCommand {
public:
ResMemoryCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("res_memory",
AdminInterfaceCommand::Memory,
......@@ -341,7 +343,7 @@ class ResMemoryCommand : public AdminInterfaceCommand {
class ShrMemoryCommand : public AdminInterfaceCommand {
public:
ShrMemoryCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("shr_memory",
AdminInterfaceCommand::Memory,
......@@ -375,7 +377,7 @@ class ShrMemoryCommand : public AdminInterfaceCommand {
class UsedMemoryCommand : public AdminInterfaceCommand {
public:
UsedMemoryCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("used_memory",
AdminInterfaceCommand::Memory,
......@@ -411,7 +413,7 @@ class UsedMemoryCommand : public AdminInterfaceCommand {
class AverageMemoryPerUserCommand : public AdminInterfaceCommand {
public:
AverageMemoryPerUserCommand(NetworkPluginServer *server, UserManager *userManager) :
AdminInterfaceCommand("average_memory_per_user",
AdminInterfaceCommand::Memory,
......@@ -452,7 +454,7 @@ class AverageMemoryPerUserCommand : public AdminInterfaceCommand {
class ResMemoryPerBackendCommand : public AdminInterfaceCommand {
public:
ResMemoryPerBackendCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("res_memory_per_backend",
AdminInterfaceCommand::Memory,
......@@ -486,7 +488,7 @@ class ResMemoryPerBackendCommand : public AdminInterfaceCommand {
class ShrMemoryPerBackendCommand : public AdminInterfaceCommand {
public:
ShrMemoryPerBackendCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("shr_memory_per_backend",
AdminInterfaceCommand::Memory,
......@@ -520,7 +522,7 @@ class ShrMemoryPerBackendCommand : public AdminInterfaceCommand {
class UsedMemoryPerBackendCommand : public AdminInterfaceCommand {
public:
UsedMemoryPerBackendCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("used_memory_per_backend",
AdminInterfaceCommand::Memory,
......@@ -554,7 +556,7 @@ class UsedMemoryPerBackendCommand : public AdminInterfaceCommand {
class AverageMemoryPerUserPerBackendCommand : public AdminInterfaceCommand {
public:
AverageMemoryPerUserPerBackendCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("average_memory_per_user_per_backend",
AdminInterfaceCommand::Memory,
......@@ -593,7 +595,7 @@ class AverageMemoryPerUserPerBackendCommand : public AdminInterfaceCommand {
class CrashedBackendsCountCommand : public AdminInterfaceCommand {
public:
CrashedBackendsCountCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("crashed_backends_count",
AdminInterfaceCommand::Backends,
......@@ -619,7 +621,7 @@ class CrashedBackendsCountCommand : public AdminInterfaceCommand {
class CrashedBackendsCommand : public AdminInterfaceCommand {
public:
CrashedBackendsCommand(NetworkPluginServer *server) :
AdminInterfaceCommand("crashed_backends",
AdminInterfaceCommand::Backends,
......@@ -650,7 +652,7 @@ class CrashedBackendsCommand : public AdminInterfaceCommand {
class MessagesFromXMPPCommand : public AdminInterfaceCommand {
public:
MessagesFromXMPPCommand(UserManager *userManager) : AdminInterfaceCommand("messages_from_xmpp",
AdminInterfaceCommand::Messages,
AdminInterfaceCommand::GlobalContext,
......@@ -676,7 +678,7 @@ class MessagesFromXMPPCommand : public AdminInterfaceCommand {
class MessagesToXMPPCommand : public AdminInterfaceCommand {
public:
MessagesToXMPPCommand(UserManager *userManager) : AdminInterfaceCommand("messages_to_xmpp",
AdminInterfaceCommand::Messages,
AdminInterfaceCommand::GlobalContext,
......@@ -760,7 +762,7 @@ class RegisterCommand : public AdminInterfaceCommand {
class UnregisterCommand : public AdminInterfaceCommand {
public:
UnregisterCommand(UserRegistration *userRegistration, Component *component) : AdminInterfaceCommand("unregister",
AdminInterfaceCommand::Users,
AdminInterfaceCommand::UserContext,
......@@ -796,7 +798,7 @@ class UnregisterCommand : public AdminInterfaceCommand {
class SetOAuth2CodeCommand : public AdminInterfaceCommand {
public:
SetOAuth2CodeCommand(Component *component) : AdminInterfaceCommand("set_oauth2_code",
AdminInterfaceCommand::Frontend,
AdminInterfaceCommand::GlobalContext,
......@@ -819,7 +821,7 @@ class SetOAuth2CodeCommand : public AdminInterfaceCommand {
ret = m_component->getFrontend()->setOAuth2Code(args[0], args[1]);
if (ret.empty()) {
return ret;
}
return "OAuth2 code and state set.";
}
......@@ -830,7 +832,7 @@ class SetOAuth2CodeCommand : public AdminInterfaceCommand {
class GetOAuth2URLCommand : public AdminInterfaceCommand {
public:
GetOAuth2URLCommand(Component *component) : AdminInterfaceCommand("get_oauth2_url",
AdminInterfaceCommand::Frontend,
AdminInterfaceCommand::GlobalContext,
......@@ -866,7 +868,7 @@ class GetOAuth2URLCommand : public AdminInterfaceCommand {
class HelpCommand : public AdminInterfaceCommand {
public:
HelpCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("help",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -921,7 +923,7 @@ class HelpCommand : public AdminInterfaceCommand {
class CommandsCommand : public AdminInterfaceCommand {
public:
CommandsCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("commands",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -980,7 +982,7 @@ class CommandsCommand : public AdminInterfaceCommand {
class VariablesCommand : public AdminInterfaceCommand {
public:
VariablesCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("variables",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -1045,7 +1047,7 @@ class VariablesCommand : public AdminInterfaceCommand {
class ArgsCommand : public AdminInterfaceCommand {
public:
ArgsCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("args",
AdminInterfaceCommand::General,
AdminInterfaceCommand::GlobalContext,
......@@ -1236,9 +1238,9 @@ void AdminInterface::handleMessageReceived(Swift::Message::ref message) {
if (std::find(x.begin(), x.end(), message->getFrom().toBare().toString()) == x.end()) {
LOG4CXX_WARN(logger, "Message not from admin user, but from " << message->getFrom().toBare().toString());
return;
}
// Ignore empty messages
#if HAVE_SWIFTEN_3
if (message->getBody().get_value_or("").empty()) {
......
......@@ -35,7 +35,7 @@ class ConfigTest : public CPPUNIT_NS :: TestFixture{
}
void setStringTwice() {
char *argv[3] = {"binary", "--service.jids=localhost", NULL};
const char *argv[3] = {"binary", "--service.jids=localhost", NULL};
Config cfg(2, argv);
std::istringstream ifs("service.jids = irc.freenode.org\n");
cfg.load(ifs);
......@@ -43,7 +43,7 @@ class ConfigTest : public CPPUNIT_NS :: TestFixture{
}
void setUnknownBool() {
char *argv[3] = {"binary", "--service.jids=localhost", NULL};
const char *argv[3] = {"binary", "--service.jids=localhost", NULL};
Config cfg(2, argv);
std::istringstream ifs("service.irc_send_pass = 1\npurple.group-chat-open=0\n");
cfg.load(ifs);
......@@ -52,7 +52,7 @@ class ConfigTest : public CPPUNIT_NS :: TestFixture{
}
void enumerateConfigSection() {
char *argv[3] = {"binary", "--service.jids=localhost", NULL};
const char *argv[3] = {"binary", "--service.jids=localhost", NULL};
Config cfg(2, argv);
std::istringstream ifs("purple.irc_send_pass=1\npurple.group-chat-open=false\npurple.test=passed");
cfg.load(ifs);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment