Changeset - af0c5d6f194a
[Not reviewed]
0 5 0
Steffen Vogel - 8 years ago 2017-10-30 16:20:47
post@steffenvogel.de
fix more compiler warnings emitted by Clang on Travis-CI
5 files changed with 49 insertions and 43 deletions:
0 comments (0 inline, 0 general)
backends/frotz/dfrotz/dumb/dumb_output.c
Show inline comments
 
@@ -190,13 +190,13 @@ void os_display_string (const zchar *s)
 
  while ((c = *s++) != 0)
 
    if (c == ZC_NEW_FONT)
 
      s++;
 
    else if (c == ZC_NEW_STYLE)
 
      os_set_text_style(*s++);
 
    else {
 
     os_display_char (c); 
 
     os_display_char (c);
 
     }
 
}
 

	
 
void os_erase_area (int top, int left, int bottom, int right)
 
{
 
  int row, col;
 
@@ -265,14 +265,18 @@ static bool will_print_blank(cell c)
 
	  || ((cell_char(c) == ' ')
 
	      && ((cell_style(c) != REVERSE_STYLE) || (rv_blank_char == ' '))));
 
}
 

	
 
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).  */
 
  if (show_line_numbers || show_line_types)
 
    putchar(' ');
 
}
 
@@ -327,26 +331,26 @@ static bool is_blank(cell c)
 
 * last nonblank character on the last line that would be shown, then
 
 * don't show that line (because it will be redundant with the prompt
 
 * line just below it).  */
 
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) {
 
    for (r = hide_lines; r < h_screen_rows; r++)
 
      show_row(r);
 
    mark_all_unchanged();
 
    return;
 
  }
 

	
 
  /* 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;
 
    changed_rows[r] = (c != h_screen_cols);
 
    if (changed_rows[r]) {
 
      first = (first != -1) ? first : r;
 
@@ -365,13 +369,13 @@ void dumb_show_screen(bool show_cursor)
 
    if (c == h_screen_cols)
 
      last--;
 
  }
 

	
 
  /* 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 {
 
    /* COMPRESSION_SPANS */
 
    for (r = first; r <= last; r++) {
 
      if (changed_rows[r] || changed_rows[r + 1])
backends/twitter/TwitterPlugin.cpp
Show inline comments
 
@@ -711,13 +711,13 @@ void TwitterPlugin::displayFriendlist(std::string &user, std::vector<User> &frie
 
void TwitterPlugin::displayTweets(std::string &user, std::string &userRequested, std::vector<Status> &tweets , Error &errMsg)
 
{
 
	if(errMsg.getMessage().length() == 0) {
 
		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);
 

	
 
				std::string scrname = tweets[i].getUserData().getScreenName();
 
				if(lastTweet.count(scrname) == 0 || cmp(tweets[lastTweet[scrname]].getID(), tweets[i].getID()) <= 0) lastTweet[scrname] = i;
include/transport/utf8/unchecked.h
Show inline comments
 
@@ -42,19 +42,19 @@ namespace utf8
 
            else if (cp < 0x800) {                // two octets
 
                *(result++) = static_cast<uint8_t>((cp >> 6)          | 0xc0);
 
                *(result++) = static_cast<uint8_t>((cp & 0x3f)        | 0x80);
 
            }
 
            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;
 
        }
 

	
 
        template <typename octet_iterator>
libtransport/AdminInterface.cpp
Show inline comments
 
@@ -49,13 +49,13 @@ static std::string getArg(const std::string &body) {
 

	
 
	return body.substr(body.find(" ") + 1);
 
}
 

	
 
class StatusCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		StatusCommand(NetworkPluginServer *server, UserManager *userManager) :
 
												AdminInterfaceCommand("status",
 
												AdminInterfaceCommand::General,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -80,13 +80,13 @@ class StatusCommand : public AdminInterfaceCommand {
 
		NetworkPluginServer *m_server;
 
		UserManager *m_userManager;
 
};
 

	
 
class UptimeCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		UptimeCommand() : AdminInterfaceCommand("uptime",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Get) {
 
			m_start = time(NULL);
 
@@ -105,13 +105,13 @@ class UptimeCommand : public AdminInterfaceCommand {
 
	private:
 
		time_t m_start;
 
};
 

	
 
class OnlineUsersCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		OnlineUsersCommand(UserManager *userManager) : AdminInterfaceCommand("online_users",
 
							AdminInterfaceCommand::Users,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute,
 
							"Online users") {
 
@@ -139,13 +139,13 @@ class OnlineUsersCommand : public AdminInterfaceCommand {
 
	private:
 
		UserManager *m_userManager;
 
};
 

	
 
class OnlineUsersCountCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		OnlineUsersCountCommand(UserManager *userManager) : AdminInterfaceCommand("online_users_count",
 
							AdminInterfaceCommand::Users,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Get) {
 
			m_userManager = userManager;
 
@@ -165,13 +165,13 @@ class OnlineUsersCountCommand : public AdminInterfaceCommand {
 
	private:
 
		UserManager *m_userManager;
 
};
 

	
 
class OnlineUsersPerBackendCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		OnlineUsersPerBackendCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("online_users_per_backend",
 
												AdminInterfaceCommand::General,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -206,21 +206,23 @@ class OnlineUsersPerBackendCommand : public AdminInterfaceCommand {
 
						lst += " - non-active for " + boost::lexical_cast<std::string>(now - user->getLastActivity()) + " seconds";
 
						lst += "\n";
 
					}
 
				}
 
				id++;
 
			}
 

	
 
			return lst;
 
		}
 

	
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class BackendsCountCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		BackendsCountCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("backends_count",
 
												AdminInterfaceCommand::Backends,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -241,13 +243,13 @@ class BackendsCountCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class ReloadCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ReloadCommand(Component *component) : AdminInterfaceCommand("reload",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute,
 
							"Reload Spectrum 2 configuration") {
 
@@ -273,13 +275,13 @@ class ReloadCommand : public AdminInterfaceCommand {
 
	private:
 
		Component *m_component;
 
};
 

	
 
class HasOnlineUserCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		HasOnlineUserCommand(UserManager *userManager) : AdminInterfaceCommand("has_online_user",
 
							AdminInterfaceCommand::Users,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute, "Has online user") {
 
			m_userManager = userManager;
 
@@ -304,13 +306,13 @@ class HasOnlineUserCommand : public AdminInterfaceCommand {
 
	private:
 
		UserManager *m_userManager;
 
};
 

	
 
class ResMemoryCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ResMemoryCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("res_memory",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -338,13 +340,13 @@ class ResMemoryCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class ShrMemoryCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ShrMemoryCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("shr_memory",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -372,13 +374,13 @@ class ShrMemoryCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class UsedMemoryCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		UsedMemoryCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("used_memory",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -408,13 +410,13 @@ class UsedMemoryCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class AverageMemoryPerUserCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		AverageMemoryPerUserCommand(NetworkPluginServer *server, UserManager *userManager) :
 
												AdminInterfaceCommand("average_memory_per_user",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -449,13 +451,13 @@ class AverageMemoryPerUserCommand : public AdminInterfaceCommand {
 
		NetworkPluginServer *m_server;
 
		UserManager *m_userManager;
 
};
 

	
 
class ResMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ResMemoryPerBackendCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("res_memory_per_backend",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -483,13 +485,13 @@ class ResMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class ShrMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ShrMemoryPerBackendCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("shr_memory_per_backend",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -517,13 +519,13 @@ class ShrMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class UsedMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		UsedMemoryPerBackendCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("used_memory_per_backend",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -551,13 +553,13 @@ class UsedMemoryPerBackendCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class AverageMemoryPerUserPerBackendCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		AverageMemoryPerUserPerBackendCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("average_memory_per_user_per_backend",
 
												AdminInterfaceCommand::Memory,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -590,13 +592,13 @@ class AverageMemoryPerUserPerBackendCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class CrashedBackendsCountCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		CrashedBackendsCountCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("crashed_backends_count",
 
												AdminInterfaceCommand::Backends,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -616,13 +618,13 @@ class CrashedBackendsCountCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class CrashedBackendsCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		CrashedBackendsCommand(NetworkPluginServer *server) :
 
												AdminInterfaceCommand("crashed_backends",
 
												AdminInterfaceCommand::Backends,
 
												AdminInterfaceCommand::GlobalContext,
 
												AdminInterfaceCommand::AdminMode,
 
												AdminInterfaceCommand::Get) {
 
@@ -647,13 +649,13 @@ class CrashedBackendsCommand : public AdminInterfaceCommand {
 
	private:
 
		NetworkPluginServer *m_server;
 
};
 

	
 
class MessagesFromXMPPCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		MessagesFromXMPPCommand(UserManager *userManager) : AdminInterfaceCommand("messages_from_xmpp",
 
							AdminInterfaceCommand::Messages,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Get) {
 
			m_userManager = userManager;
 
@@ -673,13 +675,13 @@ class MessagesFromXMPPCommand : public AdminInterfaceCommand {
 
	private:
 
		UserManager *m_userManager;
 
};
 

	
 
class MessagesToXMPPCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		MessagesToXMPPCommand(UserManager *userManager) : AdminInterfaceCommand("messages_to_xmpp",
 
							AdminInterfaceCommand::Messages,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Get) {
 
			m_userManager = userManager;
 
@@ -757,13 +759,13 @@ class RegisterCommand : public AdminInterfaceCommand {
 
	private:
 
		UserRegistration *m_userRegistration;
 
};
 

	
 
class UnregisterCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		UnregisterCommand(UserRegistration *userRegistration, Component *component) : AdminInterfaceCommand("unregister",
 
							AdminInterfaceCommand::Users,
 
							AdminInterfaceCommand::UserContext,
 
							AdminInterfaceCommand::UserMode,
 
							AdminInterfaceCommand::Execute,
 
							"Unregister") {
 
@@ -793,13 +795,13 @@ class UnregisterCommand : public AdminInterfaceCommand {
 
	private:
 
		UserRegistration *m_userRegistration;
 
};
 

	
 
class SetOAuth2CodeCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		SetOAuth2CodeCommand(Component *component) : AdminInterfaceCommand("set_oauth2_code",
 
							AdminInterfaceCommand::Frontend,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute) {
 
			m_component = component;
 
@@ -816,24 +818,24 @@ class SetOAuth2CodeCommand : public AdminInterfaceCommand {
 
				return "Error: Bad argument count";
 
			}
 

	
 
			ret = m_component->getFrontend()->setOAuth2Code(args[0], args[1]);
 
			if (ret.empty()) {
 
				return ret;
 
				
 

	
 
			}
 
			return "OAuth2 code and state set.";
 
		}
 

	
 
	private:
 
		Component *m_component;
 
};
 

	
 
class GetOAuth2URLCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		GetOAuth2URLCommand(Component *component) : AdminInterfaceCommand("get_oauth2_url",
 
							AdminInterfaceCommand::Frontend,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute) {
 
			m_component = component;
 
@@ -863,13 +865,13 @@ class GetOAuth2URLCommand : public AdminInterfaceCommand {
 
	private:
 
		Component *m_component;
 
};
 

	
 
class HelpCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		HelpCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("help",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute,
 
							"Help") {
 
@@ -918,13 +920,13 @@ class HelpCommand : public AdminInterfaceCommand {
 
	private:
 
		std::map<std::string, AdminInterfaceCommand *> *m_commands;
 
};
 

	
 
class CommandsCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		CommandsCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("commands",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute,
 
							"Available commands") {
 
@@ -977,13 +979,13 @@ class CommandsCommand : public AdminInterfaceCommand {
 
		std::map<std::string, AdminInterfaceCommand *> *m_commands;
 
};
 

	
 

	
 
class VariablesCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		VariablesCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("variables",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute,
 
							"Available variables") {
 
@@ -1042,13 +1044,13 @@ class VariablesCommand : public AdminInterfaceCommand {
 
	private:
 
		std::map<std::string, AdminInterfaceCommand *> *m_commands;
 
};
 

	
 
class ArgsCommand : public AdminInterfaceCommand {
 
	public:
 
		
 

	
 
		ArgsCommand(std::map<std::string, AdminInterfaceCommand *> *commands) : AdminInterfaceCommand("args",
 
							AdminInterfaceCommand::General,
 
							AdminInterfaceCommand::GlobalContext,
 
							AdminInterfaceCommand::AdminMode,
 
							AdminInterfaceCommand::Execute, "Command's arguments") {
 
			m_commands = commands;
 
@@ -1233,15 +1235,15 @@ void AdminInterface::handleMessageReceived(Swift::Message::ref message) {
 
		return;
 

	
 
	std::vector<std::string> const &x = CONFIG_VECTOR(m_component->getConfig(),"service.admin_jid");
 
	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()) {
 
		return;
 
	}
 
#else
tests/libtransport/config.cpp
Show inline comments
 
@@ -32,30 +32,30 @@ class ConfigTest : public CPPUNIT_NS :: TestFixture{
 

	
 
		void tearDown (void) {
 

	
 
		}
 

	
 
	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);
 
		CPPUNIT_ASSERT_EQUAL(std::string("localhost"), CONFIG_STRING(&cfg, "service.jids"));
 
	}
 

	
 
	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);
 
		CPPUNIT_ASSERT_EQUAL(true, CONFIG_BOOL_DEFAULTED(&cfg, "service.irc_send_pass", false));
 
		CPPUNIT_ASSERT_EQUAL(false, CONFIG_BOOL_DEFAULTED(&cfg, "purple.group-chat-open", true));
 
	}
 

	
 
	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);
 
		Config::SectionValuesCont purpleConfigValues = cfg.getSectionValues("purple");
 
		CPPUNIT_ASSERT_EQUAL(true, purpleConfigValues["purple.irc_send_pass"].as<bool>());
 
		CPPUNIT_ASSERT_EQUAL(false, purpleConfigValues["purple.group-chat-open"].as<bool>());
0 comments (0 inline, 0 general)