Skip to content

Commit

Permalink
C++11 : rename NULL to nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesyonan committed May 17, 2015
1 parent 68b8f12 commit fe6fcef
Show file tree
Hide file tree
Showing 93 changed files with 369 additions and 369 deletions.
18 changes: 9 additions & 9 deletions client/ovpncli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ namespace openvpn {

void detach_from_parent()
{
parent = NULL;
parent = nullptr;
}

virtual void error(const size_t err, const std::string* text=NULL)
virtual void error(const size_t err, const std::string* text=nullptr)
{
if (err < Error::N_ERRORS)
{
Expand Down Expand Up @@ -240,7 +240,7 @@ namespace openvpn {

void detach_from_parent()
{
parent = NULL;
parent = nullptr;
}

private:
Expand All @@ -251,7 +251,7 @@ namespace openvpn {
class MySocketProtect : public SocketProtect
{
public:
MySocketProtect() : parent(NULL) {}
MySocketProtect() : parent(nullptr) {}

void set_parent(OpenVPNClient* parent_arg)
{
Expand All @@ -268,7 +268,7 @@ namespace openvpn {

void detach_from_parent()
{
parent = NULL;
parent = nullptr;
}

private:
Expand All @@ -278,7 +278,7 @@ namespace openvpn {
class MyReconnectNotify : public ReconnectNotify
{
public:
MyReconnectNotify() : parent(NULL) {}
MyReconnectNotify() : parent(nullptr) {}

void set_parent(OpenVPNClient* parent_arg)
{
Expand All @@ -287,7 +287,7 @@ namespace openvpn {

void detach_from_parent()
{
parent = NULL;
parent = nullptr;
}

virtual bool pause_on_connection_timeout()
Expand All @@ -309,7 +309,7 @@ namespace openvpn {
google_dns_fallback(false), disable_client_cert(false),
default_key_direction(-1), force_aes_cbc_ciphersuites(false),
alt_proxy(false),
io_service(NULL) {}
io_service(nullptr) {}

OptionList options;
EvalConfig eval;
Expand Down Expand Up @@ -737,7 +737,7 @@ namespace openvpn {
{
state->detach();
delete state->io_service;
state->io_service = NULL;
state->io_service = nullptr;
}

OPENVPN_CLIENT_EXPORT void OpenVPNClient::connect_pre_run()
Expand Down
8 changes: 4 additions & 4 deletions openvpn/addr/addrpair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace openvpn {
unsigned int size_;
};

static AddrMaskPair from_string(const std::string& s1, const std::string& s2, const char *title = NULL)
static AddrMaskPair from_string(const std::string& s1, const std::string& s2, const char *title = nullptr)
{
try {
if (s2.empty())
Expand All @@ -125,7 +125,7 @@ namespace openvpn {
return AddrMaskPair(); // NOTREACHED
}

static AddrMaskPair from_string(const std::string& s, const char *title = NULL)
static AddrMaskPair from_string(const std::string& s, const char *title = nullptr)
{
try {
const StringPair pair = Split::by_char<StringPair, NullLex, Split::NullLimit>(s, '/');
Expand All @@ -138,7 +138,7 @@ namespace openvpn {
return AddrMaskPair(); // NOTREACHED
}

static AddrMaskPair from_string(const StringPair& pair, const char *title = NULL)
static AddrMaskPair from_string(const StringPair& pair, const char *title = nullptr)
{
try {
return from_string_impl(pair, title);
Expand Down Expand Up @@ -186,7 +186,7 @@ namespace openvpn {
OPENVPN_THROW(addr_pair_mask_parse_error, "AddrMaskPair parse error '" << title << "': " << s << " : " << e.what());
}

static AddrMaskPair from_string_impl(const StringPair& pair, const char *title = NULL)
static AddrMaskPair from_string_impl(const StringPair& pair, const char *title = nullptr)
{
AddrMaskPair ret;
if (pair.size() == 1 || pair.size() == 2)
Expand Down
8 changes: 4 additions & 4 deletions openvpn/addr/ip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace openvpn {
V6_SIZE = IPv6::Addr::SIZE,
};

Addr(const Addr& other, const char *title = NULL, Version required_version = UNSPEC)
Addr(const Addr& other, const char *title = nullptr, Version required_version = UNSPEC)
: ver(other.ver)
{
if (required_version != UNSPEC && required_version != ver)
Expand All @@ -74,12 +74,12 @@ namespace openvpn {
}
}

Addr(const std::string& ipstr, const char *title = NULL, Version required_version = UNSPEC)
Addr(const std::string& ipstr, const char *title = nullptr, Version required_version = UNSPEC)
: Addr(from_string(ipstr, title, required_version))
{
}

static std::string validate(const std::string& ipstr, const char *title = NULL, Version required_version = UNSPEC)
static std::string validate(const std::string& ipstr, const char *title = nullptr, Version required_version = UNSPEC)
{
Addr a = from_string(ipstr, title, required_version);
return a.to_string();
Expand All @@ -106,7 +106,7 @@ namespace openvpn {
}
}

static Addr from_string(const std::string& ipstr, const char *title = NULL, Version required_version = UNSPEC)
static Addr from_string(const std::string& ipstr, const char *title = nullptr, Version required_version = UNSPEC)
{
boost::system::error_code ec;
boost::asio::ip::address a = boost::asio::ip::address::from_string(ipstr, ec);
Expand Down
2 changes: 1 addition & 1 deletion openvpn/addr/ipv4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace openvpn {
return netmask_from_prefix_len(SIZE - lb);
}

static Addr from_string(const std::string& ipstr, const char *title = NULL)
static Addr from_string(const std::string& ipstr, const char *title = nullptr)
{
boost::system::error_code ec;
boost::asio::ip::address_v4 a = boost::asio::ip::address_v4::from_string(ipstr, ec);
Expand Down
2 changes: 1 addition & 1 deletion openvpn/addr/ipv6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace openvpn {
return ret;
}

static Addr from_string(const std::string& ipstr, const char *title = NULL)
static Addr from_string(const std::string& ipstr, const char *title = nullptr)
{
boost::system::error_code ec;
boost::asio::ip::address_v6 a = boost::asio::ip::address_v6::from_string(ipstr, ec);
Expand Down
6 changes: 3 additions & 3 deletions openvpn/addr/route.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace openvpn {
{
}

RouteType(const std::string& rtstr, const char *title = NULL)
RouteType(const std::string& rtstr, const char *title = nullptr)
: RouteType(RouteType::from_string(rtstr, title))
{
}
Expand All @@ -62,7 +62,7 @@ namespace openvpn {
{
}

static RouteType from_string(const std::string& rtstr, const char *title = NULL)
static RouteType from_string(const std::string& rtstr, const char *title = nullptr)
{
RouteType r;
std::vector<std::string> pair;
Expand All @@ -82,7 +82,7 @@ namespace openvpn {

static RouteType from_string_prefix(const std::string& addrstr,
unsigned int prefix_len,
const char *title = NULL)
const char *title = nullptr)
{
RouteType r;
r.addr = ADDR::from_string(addrstr, title);
Expand Down
20 changes: 10 additions & 10 deletions openvpn/apple/maclife.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace openvpn {
OPENVPN_EXCEPTION(mac_lifecycle_error);

MacLifeCycle()
: nc(NULL),
thread(NULL),
: nc(nullptr),
thread(nullptr),
paused(false)
{
}
Expand Down Expand Up @@ -119,7 +119,7 @@ namespace openvpn {
CFRunLoopStop(runloop());
thread->join();
delete thread;
thread = NULL;
thread = nullptr;
}
}

Expand All @@ -131,8 +131,8 @@ namespace openvpn {
// set up dynamic store query object
dstore.reset(SCDynamicStoreCreate(kCFAllocatorDefault,
CFSTR("OpenVPN_MacLifeCycle"),
NULL,
NULL));
nullptr,
nullptr));

// init state
state = State(net_up(), primary_interface(), false);
Expand Down Expand Up @@ -177,7 +177,7 @@ namespace openvpn {

void iface_watch()
{
SCDynamicStoreContext context = {0, this, NULL, NULL, NULL};
SCDynamicStoreContext context = {0, this, nullptr, nullptr, nullptr};
CF::DynamicStore ds(SCDynamicStoreCreate(kCFAllocatorDefault,
CFSTR("OpenVPN_MacLifeCycle_iface_watch"),
iface_watch_callback_static,
Expand All @@ -191,7 +191,7 @@ namespace openvpn {
throw mac_lifecycle_error("watched_keys is undefined");
if (!SCDynamicStoreSetNotificationKeys(ds(),
watched_keys(),
NULL))
nullptr))
throw mac_lifecycle_error("SCDynamicStoreSetNotificationKeys failed");
CF::RunLoopSource rls(SCDynamicStoreCreateRunLoopSource(kCFAllocatorDefault, ds(), 0));
if (!rls.defined())
Expand Down Expand Up @@ -241,23 +241,23 @@ namespace openvpn {
cancel_action_timer();
if (seconds)
{
CFRunLoopTimerContext context = { 0, this, NULL, NULL, NULL };
CFRunLoopTimerContext context = { 0, this, nullptr, nullptr, nullptr };
action_timer.reset(CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + seconds, 0, 0, 0, action_timer_callback_static, &context));
if (action_timer.defined())
CFRunLoopAddTimer(CFRunLoopGetCurrent(), action_timer(), kCFRunLoopCommonModes);
else
OPENVPN_LOG("MacLifeCycle::schedule_action_timer: failed to create timer");
}
else
action_timer_callback(NULL);
action_timer_callback(nullptr);
}

void cancel_action_timer()
{
if (action_timer.defined())
{
CFRunLoopTimerInvalidate(action_timer());
action_timer.reset(NULL);
action_timer.reset(nullptr);
}
}

Expand Down
4 changes: 2 additions & 2 deletions openvpn/apple/macsleep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace openvpn {
public:
MacSleep()
: root_port(0),
notifyPortRef(NULL),
notifyPortRef(nullptr),
notifierObject(0)
{
}
Expand Down Expand Up @@ -83,7 +83,7 @@ namespace openvpn {

// reset object members
root_port = 0;
notifyPortRef = NULL;
notifyPortRef = nullptr;
notifierObject = 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion openvpn/apple/macver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace openvpn {
{
char str[256];
size_t size = sizeof(str);
int ret = sysctlbyname("kern.osrelease", str, &size, NULL, 0);
int ret = sysctlbyname("kern.osrelease", str, &size, nullptr, 0);
if (!ret)
init(std::string(str, size));
}
Expand Down
Loading

0 comments on commit fe6fcef

Please sign in to comment.