mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Convert to C++ nullptr from NULL.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Jonathan Naylor, G4KLX
|
||||
* Copyright (C) 2020,2025 Jonathan Naylor, G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -32,7 +32,7 @@ CAX25Control::CAX25Control(CAX25Network* network, bool trace) :
|
||||
m_network(network),
|
||||
m_trace(trace),
|
||||
m_enabled(true),
|
||||
m_fp(NULL)
|
||||
m_fp(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ CAX25Control::~CAX25Control()
|
||||
|
||||
bool CAX25Control::writeModem(unsigned char *data, unsigned int len)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (!m_enabled)
|
||||
return false;
|
||||
@@ -52,7 +52,7 @@ bool CAX25Control::writeModem(unsigned char *data, unsigned int len)
|
||||
|
||||
CUtils::dump(1U, "AX.25 received packet", data, len);
|
||||
|
||||
if (m_network == NULL)
|
||||
if (m_network == nullptr)
|
||||
return true;
|
||||
|
||||
return m_network->write(data, len);
|
||||
@@ -60,9 +60,9 @@ bool CAX25Control::writeModem(unsigned char *data, unsigned int len)
|
||||
|
||||
unsigned int CAX25Control::readModem(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (m_network == NULL)
|
||||
if (m_network == nullptr)
|
||||
return 0U;
|
||||
|
||||
if (!m_enabled)
|
||||
@@ -78,7 +78,7 @@ unsigned int CAX25Control::readModem(unsigned char* data)
|
||||
|
||||
bool CAX25Control::openFile()
|
||||
{
|
||||
if (m_fp != NULL)
|
||||
if (m_fp != nullptr)
|
||||
return true;
|
||||
|
||||
time_t t;
|
||||
@@ -90,7 +90,7 @@ bool CAX25Control::openFile()
|
||||
::sprintf(name, "AX25_%04d%02d%02d_%02d%02d%02d.ambe", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
|
||||
m_fp = ::fopen(name, "wb");
|
||||
if (m_fp == NULL)
|
||||
if (m_fp == nullptr)
|
||||
return false;
|
||||
|
||||
::fwrite("AX25", 1U, 4U, m_fp);
|
||||
@@ -100,7 +100,7 @@ bool CAX25Control::openFile()
|
||||
|
||||
bool CAX25Control::writeFile(const unsigned char* data, unsigned int length)
|
||||
{
|
||||
if (m_fp == NULL)
|
||||
if (m_fp == nullptr)
|
||||
return false;
|
||||
|
||||
::fwrite(&length, 1U, sizeof(unsigned int), m_fp);
|
||||
@@ -111,9 +111,9 @@ bool CAX25Control::writeFile(const unsigned char* data, unsigned int length)
|
||||
|
||||
void CAX25Control::closeFile()
|
||||
{
|
||||
if (m_fp != NULL) {
|
||||
if (m_fp != nullptr) {
|
||||
::fclose(m_fp);
|
||||
m_fp = NULL;
|
||||
m_fp = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void CAX25Control::enable(bool enabled)
|
||||
|
||||
void CAX25Control::decode(const unsigned char* data, unsigned int length)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
assert(length >= 15U);
|
||||
|
||||
std::string text;
|
||||
@@ -223,7 +223,7 @@ void CAX25Control::decode(const unsigned char* data, unsigned int length)
|
||||
|
||||
bool CAX25Control::decodeAddress(const unsigned char* data, std::string& text, bool isDigi) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
for (unsigned int i = 0U; i < 6U; i++) {
|
||||
char c = data[i] >> 1;
|
||||
|
||||
Reference in New Issue
Block a user