diff options
author | Naram Qashat <cyberbotx@cyberbotx.com> | 2011-10-24 16:32:29 -0400 |
---|---|---|
committer | Naram Qashat <cyberbotx@cyberbotx.com> | 2011-10-24 16:32:29 -0400 |
commit | 377a7a968b6a906f262a45abea9a563ffc471938 (patch) | |
tree | 3743f5d564bd7b40db5659bf6e18dd102b5c5c19 /src | |
parent | d0513d6506ce34b57874ad265daf38ca67878aa0 (diff) |
Fixed bug #1349 (m_sqlite compiles without error under FreeBSD), as well as use C99's stdint.h (or cstdint if available) to get (u)intX_t types instead of our stupid typedefs. pstdint.h included in case there is no cstdint or stdint.h available.
Diffstat (limited to 'src')
-rw-r--r-- | src/misc.cpp | 22 | ||||
-rw-r--r-- | src/regchannel.cpp | 30 | ||||
-rw-r--r-- | src/sockets.cpp | 8 | ||||
-rw-r--r-- | src/users.cpp | 8 |
4 files changed, 34 insertions, 34 deletions
diff --git a/src/misc.cpp b/src/misc.cpp index 0090dfa3b..9354201b2 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -29,9 +29,9 @@ void ExtensibleItem::OnDelete() struct arc4_stream { - uint8 i; - uint8 j; - uint8 s[256]; + uint8_t i; + uint8_t j; + uint8_t s[256]; } rs; /*************************************************************************/ @@ -325,7 +325,7 @@ bool IsValidIdent(const Anope::string &ident) else return false; } - + return true; } @@ -337,12 +337,12 @@ bool IsValidHost(const Anope::string &host) { if (host.empty() || host.length() > Config->HostLen) return false; - + if (Config->VhostDisallowBE.find_first_of(host[0]) != Anope::string::npos) return false; else if (Config->VhostDisallowBE.find_first_of(host[host.length() - 1]) != Anope::string::npos) return false; - + int dots = 0; for (unsigned i = 0; i < host.length(); ++i) { @@ -459,7 +459,7 @@ static void arc4_addrandom(void *dat, int datlen) for (int n = 0; n < 256; ++n) { ++rs.i; - uint8 si = rs.s[rs.i]; + uint8_t si = rs.s[rs.i]; rs.j = rs.j + si + (static_cast<unsigned char *>(dat))[n % datlen]; rs.s[rs.i] = rs.s[rs.j]; rs.s[rs.j] = si; @@ -545,9 +545,9 @@ unsigned char getrandom8() * Get the random numbers 16 byte deep * @return char */ -uint16 getrandom16() +uint16_t getrandom16() { - uint16 val = getrandom8() << 8; + uint16_t val = getrandom8() << 8; val |= getrandom8(); return val; } @@ -558,9 +558,9 @@ uint16 getrandom16() * Get the random numbers 32 byte deep * @return char */ -uint32 getrandom32() +uint32_t getrandom32() { - uint32 val = getrandom8() << 24; + uint32_t val = getrandom8() << 24; val |= getrandom8() << 16; val |= getrandom8() << 8; val |= getrandom8(); diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 3eec63755..724965962 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -33,7 +33,7 @@ void BadWord::unserialize(SerializableBase::serialized_data &data) SerializableBase::serialized_data AutoKick::serialize() { - serialized_data data; + serialized_data data; if (this->HasFlag(AK_ISNICK) && this->nc) data["nc"] << this->nc->display; @@ -63,7 +63,7 @@ void AutoKick::unserialize(SerializableBase::serialized_data &data) SerializableBase::serialized_data ModeLock::serialize() { - serialized_data data; + serialized_data data; if (this->ci == NULL) return data; @@ -106,7 +106,7 @@ void ModeLock::unserialize(SerializableBase::serialized_data &data) SerializableBase::serialized_data LogSetting::serialize() { - serialized_data data; + serialized_data data; data["service_name"] << service_name; data["command_service"] << command_service; @@ -196,7 +196,7 @@ ChannelInfo::ChannelInfo(ChannelInfo &ci) : Flags<ChannelInfoFlag, CI_END>(Chann for (int i = 0; i < TTB_SIZE; ++i) this->ttb[i] = ci.ttb[i]; - + for (unsigned i = 0; i < ci.GetAccessCount(); ++i) { ChanAccess *taccess = ci.GetAccess(i); @@ -264,7 +264,7 @@ ChannelInfo::~ChannelInfo() SerializableBase::serialized_data ChannelInfo::serialize() { - serialized_data data; + serialized_data data; data["name"].setKey().setMax(255) << this->name; if (this->founder) @@ -282,7 +282,7 @@ SerializableBase::serialized_data ChannelInfo::serialize() data["botflags"] << this->botflags.ToString(); { Anope::string levels_buffer; - for (std::map<Anope::string, int16>::iterator it = this->levels.begin(), it_end = this->levels.end(); it != it_end; ++it) + for (std::map<Anope::string, int16_t>::iterator it = this->levels.begin(), it_end = this->levels.end(); it != it_end; ++it) levels_buffer += it->first + " " + stringify(it->second) + " "; data["levels"] << levels_buffer; } @@ -321,7 +321,7 @@ void ChannelInfo::unserialize(SerializableBase::serialized_data &data) { std::vector<Anope::string> v = BuildStringVector(data["levels"].astr()); for (unsigned i = 0; i + 1 < v.size(); i += 2) - ci->levels[v[i]] = convertTo<int16>(v[i + 1]); + ci->levels[v[i]] = convertTo<int16_t>(v[i + 1]); } if (data.count("bi") > 0) ci->bi = findbot(data["bi"].astr()); @@ -418,16 +418,16 @@ AccessGroup ChannelInfo::AccessFor(User *u) group.SuperAdmin = u->SuperAdmin; group.Founder = IsFounder(u, this); - group.ci = this; + group.ci = this; group.nc = nc; for (unsigned i = 0, end = this->access.size(); i < end; ++i) if (this->access[i]->Matches(u, nc)) group.push_back(this->access[i]); - + if (!group.empty()) this->last_used = Anope::CurTime; - + return group; } @@ -712,7 +712,7 @@ bool ChannelInfo::SetMLock(ChannelMode *mode, bool status, const Anope::string & } } } - + this->mode_locks.insert(ml); return true; @@ -960,7 +960,7 @@ void ChannelInfo::CheckTopic() { if (!this->c) return; - + /* We only compare the topics here, not the time or setter. This is because some (old) IRCds do not * allow us to set the topic as someone else, meaning we have to bump the TS and change the setter to us. * This desyncs what is really set with what we have stored, and we end up resetting the topic often when @@ -989,17 +989,17 @@ void ChannelInfo::RestoreTopic() } } -int16 ChannelInfo::GetLevel(const Anope::string &priv) +int16_t ChannelInfo::GetLevel(const Anope::string &priv) { if (PrivilegeManager::FindPrivilege(priv) == NULL) throw CoreException("Unknown privilege " + priv); - + if (this->levels.count(priv) == 0) this->levels[priv] = 0; return this->levels[priv]; } -void ChannelInfo::SetLevel(const Anope::string &priv, int16 level) +void ChannelInfo::SetLevel(const Anope::string &priv, int16_t level) { this->levels[priv] = level; } diff --git a/src/sockets.cpp b/src/sockets.cpp index 91d3eaac0..fa79d32f2 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -2,8 +2,8 @@ std::map<int, Socket *> SocketEngine::Sockets; -int32 TotalRead = 0; -int32 TotalWritten = 0; +int32_t TotalRead = 0; +int32_t TotalWritten = 0; SocketIO normalSocketIO; @@ -232,7 +232,7 @@ bool cidr::match(sockaddrs &other) default: throw SocketException("Invalid address type"); } - + if (memcmp(ip, their_ip, byte)) return false; @@ -241,7 +241,7 @@ bool cidr::match(sockaddrs &other) byte = this->cidr_len % 8; if ((*ip & byte) != (*their_ip & byte)) return false; - + return true; } diff --git a/src/users.cpp b/src/users.cpp index f09cdeed2..9d23e719f 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -15,8 +15,8 @@ Anope::insensitive_map<User *> UserListByNick; Anope::map<User *> UserListByUID; -int32 opcnt = 0; -uint32 usercnt = 0, maxusercnt = 0; +int32_t opcnt = 0; +uint32_t usercnt = 0, maxusercnt = 0; time_t maxusertime; /*************************************************************************/ @@ -478,7 +478,7 @@ bool User::IsServicesOper() if (match == false) return false; } - + EventReturn MOD_RESULT; FOREACH_RESULT(I_IsServicesOper, IsServicesOper(this)); if (MOD_RESULT == EVENT_STOP) @@ -843,7 +843,7 @@ User *do_nick(const Anope::string &source, const Anope::string &nick, const Anop if (user->server && user->server->IsULined()) exempt = true; FOREACH_MOD(I_OnUserConnect, OnUserConnect(user, exempt)); - + return user; } else |