Fix a bunch of conversion warnings #197

This commit is contained in:
Kyle Fuller
2012-08-13 05:02:18 +07:00
parent e54f423ace
commit 67299ebfa8
36 changed files with 168 additions and 155 deletions
+5 -5
View File
@@ -49,15 +49,15 @@ public:
CBuffer(unsigned int uLineCount = 100);
~CBuffer();
int AddLine(const CString& sFormat, const CString& sText = "", const timeval* ts = 0);
size_type AddLine(const CString& sFormat, const CString& sText = "", const timeval* ts = 0);
/// Same as AddLine, but replaces a line whose format string starts with sMatch if there is one.
int UpdateLine(const CString& sMatch, const CString& sFormat, const CString& sText = "");
size_type UpdateLine(const CString& sMatch, const CString& sFormat, const CString& sText = "");
/// Same as UpdateLine, but does nothing if this exact line already exists.
/// We need this because "/version" sends us the 005 raws again
int UpdateExactLine(const CString& sFormat, const CString& sText = "");
size_type UpdateExactLine(const CString& sFormat, const CString& sText = "");
const CBufLine& GetBufLine(unsigned int uIdx) const;
CString GetLine(unsigned int uIdx, const CClient& Client, const MCString& msParams = MCString::EmptyMap) const;
unsigned int Size() const { return size(); }
CString GetLine(size_type uIdx, const CClient& Client, const MCString& msParams = MCString::EmptyMap) const;
size_type Size() const { return size(); }
bool IsEmpty() const { return empty(); }
void Clear() { clear(); }
+3 -3
View File
@@ -85,7 +85,7 @@ public:
const CBuffer& GetBuffer() const { return m_Buffer; }
unsigned int GetBufferCount() const { return m_Buffer.GetLineCount(); }
bool SetBufferCount(unsigned int u, bool bForce = false) { return m_Buffer.SetLineCount(u, bForce); };
int AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = NULL) { return m_Buffer.AddLine(sFormat, sText, ts); }
size_t AddBuffer(const CString& sFormat, const CString& sText = "", const timeval* ts = NULL) { return m_Buffer.AddLine(sFormat, sText, ts); }
void ClearBuffer() { m_Buffer.Clear(); }
void SendBuffer(CClient* pClient);
// !Buffer
@@ -127,10 +127,10 @@ public:
const CString& GetKey() const { return m_sKey; }
const CString& GetTopic() const { return m_sTopic; }
const CString& GetTopicOwner() const { return m_sTopicOwner; }
unsigned int GetTopicDate() const { return m_ulTopicDate; }
unsigned long GetTopicDate() const { return m_ulTopicDate; }
const CString& GetDefaultModes() const { return m_sDefaultModes; }
const std::map<CString,CNick>& GetNicks() const { return m_msNicks; }
unsigned int GetNickCount() const { return m_msNicks.size(); }
size_t GetNickCount() const { return m_msNicks.size(); }
bool AutoClearChanBuffer() const { return m_bAutoClearChanBuffer; }
bool IsDetached() const { return m_bDetached; }
bool InConfig() const { return m_bInConfig; }
+10
View File
@@ -114,6 +114,16 @@ public:
return false;
}
bool FindUShortEntry(const CString& sName, unsigned short& uRes, unsigned short uDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
uRes = s.ToUShort();
return true;
}
uRes = uDefault;
return false;
}
bool FindDoubleEntry(const CString& sName, double& fRes, double fDefault = 0) {
CString s;
if (FindStringEntry(sName, s)) {
+6 -6
View File
@@ -100,11 +100,11 @@ public:
bool Sync();
bool Open(const CString& sFileName, int iFlags = O_RDONLY, mode_t iMode = 0644);
bool Open(int iFlags = O_RDONLY, mode_t iMode = 0644);
int Read(char *pszBuffer, int iBytes);
ssize_t Read(char *pszBuffer, int iBytes);
bool ReadLine(CString & sData, const CString & sDelimiter = "\n");
bool ReadFile(CString& sData, size_t iMaxSize = 512 * 1024);
int Write(const char *pszBuffer, u_int iBytes);
int Write(const CString & sData);
ssize_t Write(const char *pszBuffer, size_t iBytes);
ssize_t Write(const CString & sData);
void Close();
void ClearBuffer();
@@ -126,7 +126,7 @@ public:
private:
// fcntl() locking wrapper
bool Lock(int iType, bool bBlocking);
bool Lock(short iType, bool bBlocking);
CString m_sBuffer;
int m_iFD;
@@ -165,11 +165,11 @@ public:
clear();
}
int Fill(const CString& sDir) {
size_t Fill(const CString& sDir) {
return FillByWildcard(sDir, "*");
}
int FillByWildcard(const CString& sDir, const CString& sWildcard) {
size_t FillByWildcard(const CString& sDir, const CString& sWildcard) {
CleanUp();
DIR* dir = opendir((sDir.empty()) ? "." : sDir.c_str());
+4 -4
View File
@@ -74,14 +74,14 @@ public:
CString GetRawParam(const CString& sName, bool bPost = true) const;
bool HasParam(const CString& sName, bool bPost = true) const;
const std::map<CString, VCString>& GetParams(bool bPost = true) const;
unsigned int GetParamValues(const CString& sName, VCString& vsRet, bool bPost = true, const CString& sFilter = "\r\n") const;
unsigned int GetParamValues(const CString& sName, std::set<CString>& ssRet, bool bPost = true, const CString& sFilter = "\r\n") const;
size_t GetParamValues(const CString& sName, VCString& vsRet, bool bPost = true, const CString& sFilter = "\r\n") const;
size_t GetParamValues(const CString& sName, std::set<CString>& ssRet, bool bPost = true, const CString& sFilter = "\r\n") const;
// !Parameter access
private:
static CString GetRawParam(const CString& sName, const std::map<CString, VCString>& msvsParams);
static CString GetParam(const CString& sName, const std::map<CString, VCString>& msvsParams, const CString& sFilter);
static unsigned int GetParamValues(const CString& sName, VCString& vsRet, const std::map<CString, VCString>& msvsParams, const CString& sFilter);
static unsigned int GetParamValues(const CString& sName, std::set<CString>& ssRet, const std::map<CString, VCString>& msvsParams, const CString& sFilter);
static size_t GetParamValues(const CString& sName, VCString& vsRet, const std::map<CString, VCString>& msvsParams, const CString& sFilter);
static size_t GetParamValues(const CString& sName, std::set<CString>& ssRet, const std::map<CString, VCString>& msvsParams, const CString& sFilter);
protected:
void PrintPage(const CString& sPage);
+1 -1
View File
@@ -172,7 +172,7 @@ protected:
bool m_bIRCConnectEnabled;
CString m_sIRCServer;
std::vector<CServer*> m_vServers;
unsigned int m_uServerIdx; ///< Index in m_vServers of our current server + 1
size_t m_uServerIdx; ///< Index in m_vServers of our current server + 1
CNick m_IRCNick;
bool m_bIRCAway;
+1 -1
View File
@@ -28,7 +28,7 @@ public:
void Reset();
void Parse(const CString& sNickMask);
CString GetHostMask() const;
unsigned int GetCommonChans(std::vector<CChan*>& vChans, CIRCNetwork* pNetwork) const;
size_t GetCommonChans(std::vector<CChan*>& vChans, CIRCNetwork* pNetwork) const;
// Setters
void SetNetwork(CIRCNetwork* pNetwork);
+5 -4
View File
@@ -44,19 +44,20 @@
// just defines these in inttypes.h which is also part of C99 and is supposed to
// include stdint.h. Solaris 9 is a weirdo. :(
#include <inttypes.h>
#include <cstddef>
typedef struct {
unsigned int tot_len;
unsigned int len;
size_t tot_len;
size_t len;
unsigned char block[2 * SHA256_BLOCK_SIZE];
uint32_t h[8];
} sha256_ctx;
void sha256_init(sha256_ctx * ctx);
void sha256_update(sha256_ctx *ctx, const unsigned char *message,
unsigned int len);
size_t len);
void sha256_final(sha256_ctx *ctx, unsigned char *digest);
void sha256(const unsigned char *message, unsigned int len,
void sha256(const unsigned char *message, size_t len,
unsigned char *digest);
#endif /* !SHA2_H */
+1 -1
View File
@@ -88,7 +88,7 @@ public:
const CString& GetName() const { return m_sName; }
unsigned long GetFilePosition() const { return m_uFilePosition; }
unsigned int GetRowIndex() const { return m_uRowIndex; }
unsigned int GetRowCount() { return m_pvRows->size(); }
size_t GetRowCount() { return m_pvRows->size(); }
std::vector<CTemplate*>* GetRows() { return m_pvRows; }
CTemplate* GetNextRow() { return GetRow(IncRowIndex()); }
CTemplate* GetCurRow() { return GetRow(m_uRowIndex); }
+4 -4
View File
@@ -138,7 +138,7 @@ public:
* After calling this you can fill the row with content.
* @return The index of this row
*/
unsigned int AddRow();
size_type AddRow();
/** Sets a given cell in the table to a value.
* @param sColumn The name of the column you want to fill.
@@ -147,7 +147,7 @@ public:
* If this is not given, the last row will be used.
* @return True if setting the cell was successful.
*/
bool SetCell(const CString& sColumn, const CString& sValue, unsigned int uRowIdx = ~0);
bool SetCell(const CString& sColumn, const CString& sValue, size_type uRowIdx = ~0);
/** Get a line of the table's output
* @param uIdx The index of the line you want.
@@ -162,7 +162,7 @@ public:
* @param uIdx The index of the column you are interested in.
* @return The width of the column.
*/
unsigned int GetColumnWidth(unsigned int uIdx) const;
CString::size_type GetColumnWidth(unsigned int uIdx) const;
/// Completely clear the table.
void Clear();
@@ -177,7 +177,7 @@ private:
protected:
std::vector<CString> m_vsHeaders;
std::map<CString, unsigned int> m_msuWidths; // Used to cache the width of a column
std::map<CString, CString::size_type> m_msuWidths; // Used to cache the width of a column
};
+13 -13
View File
@@ -210,12 +210,12 @@ public:
* @param uCount The number of characters to keep.
* @return The resulting string.
*/
CString Left(unsigned int uCount) const;
CString Left(size_type uCount) const;
/** Return the right part of the string.
* @param uCount The number of characters to keep.
* @return The resulting string.
*/
CString Right(unsigned int uCount) const;
CString Right(size_type uCount) const;
/** Get the first line of this string.
* @return The first line of text.
@@ -237,17 +237,17 @@ public:
* after it.
* @see Split() if you need a string split into all of its tokens.
*/
CString Token(unsigned int uPos, bool bRest = false, const CString& sSep = " ", bool bAllowEmpty = false) const;
CString Token(size_t uPos, bool bRest = false, const CString& sSep = " ", bool bAllowEmpty = false) const;
/** Get a token out of this string. This function behaves much like the
* other Token() function in this class. The extra arguments are
* handled similarly to Split().
*/
CString Token(unsigned int uPos, bool bRest, const CString& sSep, bool bAllowEmpty, const CString& sLeft, const CString& sRight, bool bTrimQuotes = true) const;
CString Token(size_t uPos, bool bRest, const CString& sSep, bool bAllowEmpty, const CString& sLeft, const CString& sRight, bool bTrimQuotes = true) const;
unsigned int URLSplit(MCString& msRet) const;
unsigned int OptionSplit(MCString& msRet, bool bUpperKeys = false) const;
unsigned int QuoteSplit(VCString& vsRet) const;
size_type URLSplit(MCString& msRet) const;
size_type OptionSplit(MCString& msRet, bool bUpperKeys = false) const;
size_type QuoteSplit(VCString& vsRet) const;
/** Split up this string into tokens.
* Via sLeft and sRight you can define "markers" like with Replace().
@@ -264,7 +264,7 @@ public:
* each token.
* @return The number of tokens found.
*/
unsigned int Split(const CString& sDelim, VCString& vsRet, bool bAllowEmpty = true,
size_type Split(const CString& sDelim, VCString& vsRet, bool bAllowEmpty = true,
const CString& sLeft = "", const CString& sRight = "", bool bTrimQuotes = true,
bool bTrimWhiteSpace = false) const;
@@ -272,7 +272,7 @@ public:
* This function is identical to the other CString::Split(), except that
* the result is returned as a SCString instead of a VCString.
*/
unsigned int Split(const CString& sDelim, SCString& ssRet, bool bAllowEmpty = true,
size_type Split(const CString& sDelim, SCString& ssRet, bool bAllowEmpty = true,
const CString& sLeft = "", const CString& sRight = "", bool bTrimQuotes = true,
bool bTrimWhiteSpace = false) const;
@@ -438,24 +438,24 @@ public:
* @param uLen The number of characters to remove.
* @return true if this string was modified.
*/
bool LeftChomp(unsigned int uLen = 1);
bool LeftChomp(size_type uLen = 1);
/** Remove characters from the end of this string.
* @param uLen The number of characters to remove.
* @return true if this string was modified.
*/
bool RightChomp(unsigned int uLen = 1);
bool RightChomp(size_type uLen = 1);
/** Remove characters from the beginning of this string.
* This string object isn't modified.
* @param uLen The number of characters to remove.
* @return The result of the conversion.
*/
CString LeftChomp_n(unsigned int uLen = 1) const;
CString LeftChomp_n(size_type uLen = 1) const;
/** Remove characters from the end of this string.
* This string object isn't modified.
* @param uLen The number of characters to remove.
* @return The result of the conversion.
*/
CString RightChomp_n(unsigned int uLen = 1) const;
CString RightChomp_n(size_type uLen = 1) const;
private:
protected:
+1 -1
View File
@@ -140,7 +140,7 @@ public:
// Listener yummy
CListener* FindListener(u_short uPort, const CString& BindHost, EAddrType eAddr);
bool AddListener(CListener*);
bool AddListener(unsigned int uPort, const CString& sBindHost, bool bSSL,
bool AddListener(unsigned short uPort, const CString& sBindHost, bool bSSL,
EAddrType eAddr, CListener::EAcceptType eAccept, CString& sError);
bool DelListener(CListener*);