Browse Source

Merge pull request #1363 from Diapolo/remove_strncasecmp

remove strncasecmp() + strnicmp() calls use boost::algorithm::istarts_with()
0.8
Pieter Wuille 13 years ago
parent
commit
6e86c4700b
  1. 3
      src/init.cpp
  2. 13
      src/qt/bitcoin.cpp

3
src/init.cpp

@ -13,6 +13,7 @@
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/interprocess/sync/file_lock.hpp> #include <boost/interprocess/sync/file_lock.hpp>
#include <boost/algorithm/string/predicate.hpp>
#ifndef WIN32 #ifndef WIN32
#include <signal.h> #include <signal.h>
@ -126,7 +127,7 @@ bool AppInit(int argc, char* argv[])
// Command-line RPC // Command-line RPC
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
if (!IsSwitchChar(argv[i][0]) && !(strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0)) if (!IsSwitchChar(argv[i][0]) && !boost::algorithm::istarts_with(argv[i], "bitcoin:"))
fCommandLine = true; fCommandLine = true;
if (fCommandLine) if (fCommandLine)

13
src/qt/bitcoin.cpp

@ -21,6 +21,7 @@
#include <QLibraryInfo> #include <QLibraryInfo>
#include <boost/interprocess/ipc/message_queue.hpp> #include <boost/interprocess/ipc/message_queue.hpp>
#include <boost/algorithm/string/predicate.hpp>
#if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED) #if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED)
#define _BITCOIN_QT_PLUGINS_INCLUDED #define _BITCOIN_QT_PLUGINS_INCLUDED
@ -160,9 +161,6 @@ void HelpMessageBox::exec()
#endif #endif
} }
#ifdef WIN32
#define strncasecmp strnicmp
#endif
#ifndef BITCOIN_QT_TEST #ifndef BITCOIN_QT_TEST
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -172,7 +170,7 @@ int main(int argc, char *argv[])
// Do this early as we don't want to bother initializing if we are just calling IPC // Do this early as we don't want to bother initializing if we are just calling IPC
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0) if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))
{ {
const char *strURI = argv[i]; const char *strURI = argv[i];
try { try {
@ -312,17 +310,16 @@ int main(int argc, char *argv[])
{ {
window.show(); window.show();
} }
#if !defined(MAC_OSX) && !defined(WIN32)
// TODO: implement qtipcserver.cpp for Mac and Windows
// Place this here as guiref has to be defined if we dont want to lose URIs // Place this here as guiref has to be defined if we dont want to lose URIs
ipcInit(); ipcInit();
#if !defined(MAC_OSX) && !defined(WIN32)
// TODO: implement qtipcserver.cpp for Mac and Windows
// Check for URI in argv // Check for URI in argv
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0) if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))
{ {
const char *strURI = argv[i]; const char *strURI = argv[i];
try { try {

Loading…
Cancel
Save