Use boost for case insensitive comparison.
This commit is contained in:
@@ -18,12 +18,13 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "avatarmanager.h"
|
#include "avatarmanager.h"
|
||||||
|
#include <net/socket_msg.h>
|
||||||
|
#include <core/loghelper.h>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/lambda/lambda.hpp>
|
#include <boost/lambda/lambda.hpp>
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#include <net/socket_msg.h>
|
|
||||||
#include <core/loghelper.h>
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -37,12 +38,6 @@
|
|||||||
#define GIF_HEADER_SIZE (sizeof(GIF_HEADER_1) - 1)
|
#define GIF_HEADER_SIZE (sizeof(GIF_HEADER_1) - 1)
|
||||||
#define MAX_HEADER_SIZE PNG_HEADER_SIZE
|
#define MAX_HEADER_SIZE PNG_HEADER_SIZE
|
||||||
|
|
||||||
// Not using boost::algorithm here because of STL issues.
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define STRCASECMP _stricmp
|
|
||||||
#else
|
|
||||||
#define STRCASECMP strcasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
@@ -100,11 +95,11 @@ AvatarManager::OpenAvatarFileForChunkRead(const std::string &fileName, unsigned
|
|||||||
{
|
{
|
||||||
path filePath(fileName);
|
path filePath(fileName);
|
||||||
string ext(extension(filePath));
|
string ext(extension(filePath));
|
||||||
if (STRCASECMP(ext.c_str(), ".png") == 0)
|
if (boost::algorithm::iequals(ext, ".png") == 0)
|
||||||
outFileType = AVATAR_FILE_TYPE_PNG;
|
outFileType = AVATAR_FILE_TYPE_PNG;
|
||||||
else if (STRCASECMP(ext.c_str(), ".jpg") == 0 || STRCASECMP(ext.c_str(), ".jpeg") == 0)
|
else if (boost::algorithm::iequals(ext, ".jpg") == 0 || boost::algorithm::iequals(ext, ".jpeg") == 0)
|
||||||
outFileType = AVATAR_FILE_TYPE_JPG;
|
outFileType = AVATAR_FILE_TYPE_JPG;
|
||||||
else if (STRCASECMP(ext.c_str(), ".gif") == 0)
|
else if (boost::algorithm::iequals(ext, ".gif") == 0)
|
||||||
outFileType = AVATAR_FILE_TYPE_GIF;
|
outFileType = AVATAR_FILE_TYPE_GIF;
|
||||||
boost::shared_ptr<AvatarFileState> fileState(new AvatarFileState);
|
boost::shared_ptr<AvatarFileState> fileState(new AvatarFileState);
|
||||||
fileState->inputStream.open(fileName.c_str(), ios_base::in | ios_base::binary);
|
fileState->inputStream.open(fileName.c_str(), ios_base::in | ios_base::binary);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <net/socket_helper.h>
|
#include <net/socket_helper.h>
|
||||||
#include <net/socket_msg.h>
|
#include <net/socket_msg.h>
|
||||||
#include <libircclient.h>
|
#include <libircclient.h>
|
||||||
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -30,13 +31,6 @@ using namespace std;
|
|||||||
|
|
||||||
#define IRC_WAIT_TERMINATION_MSEC 500
|
#define IRC_WAIT_TERMINATION_MSEC 500
|
||||||
|
|
||||||
// Not using boost::algorithm here because of STL issues.
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#define STRCASECMP _stricmp
|
|
||||||
#else
|
|
||||||
#define STRCASECMP strcasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
struct IrcContext
|
struct IrcContext
|
||||||
{
|
{
|
||||||
@@ -163,7 +157,7 @@ irc_event_channel(irc_session_t *session, const char * /*irc_event*/, const char
|
|||||||
{
|
{
|
||||||
IrcContext *context = (IrcContext *) irc_get_ctx(session);
|
IrcContext *context = (IrcContext *) irc_get_ctx(session);
|
||||||
|
|
||||||
if (count >= 2 && STRCASECMP(context->channel.c_str(),params[0]) == 0) // check whether this message is for our channel
|
if (count >= 2 && boost::algorithm::iequals(context->channel, params[0]) == 0) // check whether this message is for our channel
|
||||||
{
|
{
|
||||||
// Signal the message (if any) to GUI.
|
// Signal the message (if any) to GUI.
|
||||||
if (*params[1] != 0)
|
if (*params[1] != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user