summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-11-17 00:02:03 +0000
committerPeter Powell <petpow@saberuk.com>2017-11-17 15:33:01 +0000
commit36040be2952186d56a6646ee7d972aaafdd4e31a (patch)
tree72be7108a94dd6bd0ea2842c53ba8890c44d12d8 /include
parent3b51dfb1d611a874c3f1138d1c1ec1bb8984334c (diff)
Fix a ton of -Wsign-conversion warnings.
Diffstat (limited to 'include')
-rw-r--r--include/channels.h2
-rw-r--r--include/configreader.h4
-rw-r--r--include/convto.h4
-rw-r--r--include/ctables.h8
-rw-r--r--include/inspircd.h2
-rw-r--r--include/inspsocket.h13
-rw-r--r--include/membership.h4
-rw-r--r--include/socket.h4
-rw-r--r--include/timer.h2
-rw-r--r--include/users.h4
10 files changed, 26 insertions, 21 deletions
diff --git a/include/channels.h b/include/channels.h
index be872b7fe..365cdeabd 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -149,7 +149,7 @@ class CoreExport Channel : public Extensible
*
* @return The number of users on this channel
*/
- long GetUserCounter() const { return userlist.size(); }
+ size_t GetUserCounter() const { return userlist.size(); }
/** Add a user pointer to the internal reference list
* @param user The user to add
diff --git a/include/configreader.h b/include/configreader.h
index fc8c99d62..69c98a55e 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -285,12 +285,12 @@ class CoreExport ServerConfig
/** Clones CIDR range for ipv4 (0-32)
* Defaults to 32 (checks clones on all IPs seperately)
*/
- int c_ipv4_range;
+ unsigned char c_ipv4_range;
/** Clones CIDR range for ipv6 (0-128)
* Defaults to 128 (checks on all IPs seperately)
*/
- int c_ipv6_range;
+ unsigned char c_ipv6_range;
/** Holds the server name of the local server
* as defined by the administrator.
diff --git a/include/convto.h b/include/convto.h
index eaf14f6dc..c306283fc 100644
--- a/include/convto.h
+++ b/include/convto.h
@@ -100,9 +100,9 @@ template<typename T> inline long ConvToInt(const T& in)
return atol(tmp.str().c_str());
}
-inline uint64_t ConvToUInt64(const std::string& in)
+template<typename TOut> inline TOut ConvToNum(const std::string& in)
{
- uint64_t ret;
+ TOut ret;
std::istringstream tmp(in);
if (!(tmp >> ret))
return 0;
diff --git a/include/ctables.h b/include/ctables.h
index 9376dbbcc..bba395919 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -112,7 +112,7 @@ class CoreExport CommandBase : public ServiceProvider
public:
/** User flags needed to execute the command or 0
*/
- char flags_needed;
+ unsigned char flags_needed;
/** Minimum number of parameters command takes
*/
@@ -157,7 +157,7 @@ class CoreExport CommandBase : public ServiceProvider
/** How many seconds worth of penalty does this command have?
*/
- int Penalty;
+ unsigned int Penalty;
/** Create a new command.
* @param me The module which created this command.
@@ -175,7 +175,7 @@ class CoreExport CommandBase : public ServiceProvider
* @param parameter The parameter to encode. Can be modified in place.
* @param index The parameter index (0 == first parameter).
*/
- virtual void EncodeParameter(std::string& parameter, int index);
+ virtual void EncodeParameter(std::string& parameter, unsigned int index);
/** Disable or enable this command.
* @param setting True to disable the command.
@@ -234,7 +234,7 @@ class CoreExport Command : public CommandBase
class CoreExport SplitCommand : public Command
{
public:
- SplitCommand(Module* me, const std::string &cmd, int minpara = 0, int maxpara = 0)
+ SplitCommand(Module* me, const std::string &cmd, unsigned int minpara = 0, unsigned int maxpara = 0)
: Command(me, cmd, minpara, maxpara) {}
virtual CmdResult Handle(const std::vector<std::string>& parameters, User* user);
virtual CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user);
diff --git a/include/inspircd.h b/include/inspircd.h
index 839cccb6a..5f5493350 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -339,7 +339,7 @@ class CoreExport InspIRCd
* @param printable if false, the string will use characters 0-255; otherwise,
* it will be limited to 0x30-0x7E ('0'-'~', nonspace printable characters)
*/
- std::string GenRandomStr(int length, bool printable = true);
+ std::string GenRandomStr(unsigned int length, bool printable = true);
/** Generate a random integer.
* This is generally more secure than rand()
*/
diff --git a/include/inspsocket.h b/include/inspsocket.h
index 5c9c1059a..258d186b9 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -89,7 +89,12 @@ class CoreExport SocketTimeout : public Timer
* @param thesock BufferedSocket to attach to
* @param secs_from_now Seconds from now to time out
*/
- SocketTimeout(int fd, BufferedSocket* thesock, long secs_from_now) : Timer(secs_from_now), sock(thesock), sfd(fd) { }
+ SocketTimeout(int fd, BufferedSocket* thesock, unsigned int secs_from_now)
+ : Timer(secs_from_now)
+ , sock(thesock)
+ , sfd(fd)
+ {
+ }
/** Handle tick event
*/
@@ -361,7 +366,7 @@ class CoreExport BufferedSocket : public StreamSocket
* @param maxtime Time to wait for connection
* @param connectbindip Address to bind to (if NULL, no bind will be done)
*/
- void DoConnect(const std::string &ipaddr, int aport, unsigned long maxtime, const std::string &connectbindip);
+ void DoConnect(const std::string& ipaddr, int aport, unsigned int maxtime, const std::string& connectbindip);
/** This method is called when an outbound connection on your socket is
* completed.
@@ -387,8 +392,8 @@ class CoreExport BufferedSocket : public StreamSocket
virtual ~BufferedSocket();
protected:
void OnEventHandlerWrite() CXX11_OVERRIDE;
- BufferedSocketError BeginConnect(const irc::sockets::sockaddrs& dest, const irc::sockets::sockaddrs& bind, unsigned long timeout);
- BufferedSocketError BeginConnect(const std::string &ipaddr, int aport, unsigned long maxtime, const std::string &connectbindip);
+ BufferedSocketError BeginConnect(const irc::sockets::sockaddrs& dest, const irc::sockets::sockaddrs& bind, unsigned int timeout);
+ BufferedSocketError BeginConnect(const std::string& ipaddr, int aport, unsigned int maxtime, const std::string& connectbindip);
};
inline IOHook* StreamSocket::GetIOHook() const { return iohook; }
diff --git a/include/membership.h b/include/membership.h
index c952d09ae..8630bb673 100644
--- a/include/membership.h
+++ b/include/membership.h
@@ -20,7 +20,7 @@
#pragma once
-uint64_t ConvToUInt64(const std::string& in);
+#include "convto.h"
/**
* Represents a member of a channel.
@@ -60,7 +60,7 @@ class CoreExport Membership : public Extensible, public insp::intrusive_list_nod
*/
static Id IdFromString(const std::string& str)
{
- return ConvToUInt64(str);
+ return ConvToNum<Id>(str);
}
/** Constructor, sets the user and chan fields to the parameters, does NOT update any bookkeeping
diff --git a/include/socket.h b/include/socket.h
index 8c7cc2e4e..aec06b526 100644
--- a/include/socket.h
+++ b/include/socket.h
@@ -60,7 +60,7 @@ namespace irc
struct sockaddr_in in4;
struct sockaddr_in6 in6;
/** Return the size of the structure for syscall passing */
- int sa_size() const;
+ socklen_t sa_size() const;
/** Return port number or -1 if invalid */
int port() const;
/** Return IP only */
@@ -84,7 +84,7 @@ namespace irc
/** Construct a CIDR mask from the string. Will normalize (127.0.0.1/8 => 127.0.0.0/8). */
cidr_mask(const std::string& mask);
/** Construct a CIDR mask of a given length from the given address */
- cidr_mask(const irc::sockets::sockaddrs& addr, int len);
+ cidr_mask(const irc::sockets::sockaddrs& addr, unsigned char len);
/** Equality of bits, type, and length */
bool operator==(const cidr_mask& other) const;
/** Ordering defined for maps */
diff --git a/include/timer.h b/include/timer.h
index a597427e3..a116d456c 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -76,7 +76,7 @@ class CoreExport Timer
/** Sets the interval between two ticks.
*/
- void SetInterval(time_t interval);
+ void SetInterval(unsigned int interval);
/** Called when the timer ticks.
* You should override this method with some useful code to
diff --git a/include/users.h b/include/users.h
index ef5964699..40c99517d 100644
--- a/include/users.h
+++ b/include/users.h
@@ -353,7 +353,7 @@ class CoreExport User : public Extensible
unsigned int quitting:1;
/** What type of user is this? */
- const unsigned int usertype:2;
+ const UserType usertype:2;
/** Get client IP string from sockaddr, using static internal buffer
* @return The IP string
@@ -385,7 +385,7 @@ class CoreExport User : public Extensible
/** Constructor
* @throw CoreException if the UID allocated to the user already exists
*/
- User(const std::string& uid, Server* srv, int objtype);
+ User(const std::string& uid, Server* srv, UserType objtype);
/** Returns the full displayed host of the user
* This member function returns the hostname of the user as seen by other users