summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-28 23:44:15 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-10-28 23:44:15 +0200
commit32bdfb274ec20318dd7d45fb62cd6e51323453f7 (patch)
tree1142386bf9fb2f90738876cc3e572c0be353c868
parentf0b272d734469552b9747ec3e00a5a3a22811749 (diff)
downloaddabmux-32bdfb274ec20318dd7d45fb62cd6e51323453f7.tar.gz
dabmux-32bdfb274ec20318dd7d45fb62cd6e51323453f7.tar.bz2
dabmux-32bdfb274ec20318dd7d45fb62cd6e51323453f7.zip
Replace NULL by nullptr
-rw-r--r--src/ConfigParser.cpp4
-rw-r--r--src/DabMultiplexer.cpp6
-rw-r--r--src/DabMux.cpp4
-rw-r--r--src/Dmb.cpp10
-rw-r--r--src/InetAddress.cpp4
-rw-r--r--src/ManagementServer.cpp2
-rw-r--r--src/ReedSolomon.cpp6
-rw-r--r--src/dabInputDabplusFifo.cpp4
-rw-r--r--src/dabInputDabplusFile.cpp10
-rw-r--r--src/dabInputDmbFile.cpp14
-rw-r--r--src/dabInputEnhancedPacketFile.cpp4
-rw-r--r--src/dabInputFifo.cpp20
-rw-r--r--src/dabInputFile.cpp8
-rw-r--r--src/dabInputMpegFile.cpp4
-rw-r--r--src/dabInputPacketFile.cpp12
-rw-r--r--src/dabInputRawFifo.cpp10
-rw-r--r--src/dabInputRawFile.cpp4
-rw-r--r--src/dabInputZmq.cpp2
-rw-r--r--src/utils.cpp4
19 files changed, 66 insertions, 66 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 747fa39..93e6068 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -117,10 +117,10 @@ static int hexparse(std::string input)
{
int value;
if (input.find("0x") == 0) {
- value = strtoll(input.c_str() + 2, NULL, 16);
+ value = strtoll(input.c_str() + 2, nullptr, 16);
}
else {
- value = strtoll(input.c_str(), NULL, 10);
+ value = strtoll(input.c_str(), nullptr, 10);
}
if (errno == ERANGE) {
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index 90d3d02..c789763 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -162,7 +162,7 @@ void DabMultiplexer::prepare()
* Ideally, we must be able to restart transmission s.t. the receiver
* synchronisation is preserved.
*/
- gettimeofday(&mnsc_time, NULL);
+ gettimeofday(&mnsc_time, nullptr);
#if HAVE_OUTPUT_EDI
edi_time = chrono::system_clock::now();
@@ -212,7 +212,7 @@ void DabMultiplexer::prepare_subchannels()
void DabMultiplexer::prepare_services_components()
{
set<uint32_t> ids;
- dabProtection* protection = NULL;
+ dabProtection* protection = nullptr;
vector<DabComponent*>::iterator component;
vector<DabSubchannel*>::iterator subchannel;
@@ -301,7 +301,7 @@ void DabMultiplexer::prepare_services_components()
void DabMultiplexer::prepare_data_inputs()
{
- dabProtection* protection = NULL;
+ dabProtection* protection = nullptr;
vector<DabSubchannel*>::iterator subchannel;
// Prepare and check the data inputs
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index aefa701..c962818 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
const int sigs[] = {SIGHUP, SIGQUIT, SIGINT, SIGTERM};
for (int i = 0; i < 4; i++) {
- if (sigaction(sigs[i], &sa, NULL) == -1) {
+ if (sigaction(sigs[i], &sa, nullptr) == -1) {
perror("sigaction");
return EXIT_FAILURE;
}
@@ -399,7 +399,7 @@ int main(int argc, char *argv[])
throw MuxInitException();
}
- if (output == NULL) {
+ if (output == nullptr) {
etiLog.level(error) <<
"Unable to init output " <<
uri;
diff --git a/src/Dmb.cpp b/src/Dmb.cpp
index e168b63..92688ea 100644
--- a/src/Dmb.cpp
+++ b/src/Dmb.cpp
@@ -45,7 +45,7 @@ Dmb::Dmb(bool reverse) :
interleaver(12, 17),
encoder(204, 188)
{
- buffer = NULL;
+ buffer = nullptr;
bufferSize = 0;
setReverse(reverse);
}
@@ -53,7 +53,7 @@ encoder(204, 188)
Dmb::~Dmb()
{
- if (buffer != NULL) {
+ if (buffer != nullptr) {
delete[] buffer;
}
}
@@ -93,7 +93,7 @@ int Dmb::encode(
char* output = reinterpret_cast<char*>(dataOut);
if (bufferSize < sizeIn + 204) {
- if (buffer != NULL) {
+ if (buffer != nullptr) {
delete[] buffer;
}
unsigned char* oldBuffer = buffer;
@@ -263,9 +263,9 @@ int Dmb::sync(void* dataIn, unsigned long sizeIn)
char* sync = input;
unsigned long size = sizeIn;
- while (sync != NULL) {
+ while (sync != nullptr) {
sync = (char*)memchr(sync, 0x47, size);
- if (sync != NULL) {
+ if (sync != nullptr) {
int offset = sync - input;
if (offset % 12 != 0) {
offset = ((offset / 12) * 12) + 12;
diff --git a/src/InetAddress.cpp b/src/InetAddress.cpp
index 90cdd06..d92e1b9 100644
--- a/src/InetAddress.cpp
+++ b/src/InetAddress.cpp
@@ -44,8 +44,8 @@
int inetErrNo = 0;
-const char *inetErrMsg = NULL;
-const char *inetErrDesc = NULL;
+const char *inetErrMsg = nullptr;
+const char *inetErrDesc = nullptr;
/**
diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp
index dd4da89..f946fd0 100644
--- a/src/ManagementServer.cpp
+++ b/src/ManagementServer.cpp
@@ -343,7 +343,7 @@ input_state_t InputStat::determineState(void)
{
boost::mutex::scoped_lock lock(m_mutex);
- time_t now = time(NULL);
+ time_t now = time(nullptr);
input_state_t state;
/* if the last event was more that INPUT_COUNTER_RESET_TIME
diff --git a/src/ReedSolomon.cpp b/src/ReedSolomon.cpp
index 69e1191..7508747 100644
--- a/src/ReedSolomon.cpp
+++ b/src/ReedSolomon.cpp
@@ -47,7 +47,7 @@ ReedSolomon::ReedSolomon(int N, int K, bool reverse, int gfpoly, int firstRoot,
rsData = init_rs_char(symsize, gfpoly, firstRoot, primElem, nroots, pad);
- if (rsData == NULL) {
+ if (rsData == nullptr) {
std::stringstream ss;
ss << "Invalid Reed-Solomon parameters! " <<
"N=" << N << " ; K=" << K << " ; pad=" << pad;
@@ -79,7 +79,7 @@ int ReedSolomon::encode(void* data, void* fec, unsigned long size)
memcpy(buffer, input, myK);
memcpy(&buffer[myK], output, myN - myK);
- ret = decode_rs_char(rsData, buffer, NULL, 0);
+ ret = decode_rs_char(rsData, buffer, nullptr, 0);
if ((ret != 0) && (ret != -1)) {
memcpy(input, buffer, myK);
memcpy(output, &buffer[myK], myN - myK);
@@ -100,7 +100,7 @@ int ReedSolomon::encode(void* data, unsigned long size)
int ret = 0;
if (reverse) {
- ret = decode_rs_char(rsData, input, NULL, 0);
+ ret = decode_rs_char(rsData, input, nullptr, 0);
} else {
encode_rs_char(rsData, input, &input[myK]);
}
diff --git a/src/dabInputDabplusFifo.cpp b/src/dabInputDabplusFifo.cpp
index 81f373b..94aec13 100644
--- a/src/dabInputDabplusFifo.cpp
+++ b/src/dabInputDabplusFifo.cpp
@@ -68,7 +68,7 @@ int dabInputDabplusFifoInit(void** args)
dabInputDabplusFifoData* data = new dabInputDabplusFifoData;
dabInputFifoInit(&data->fifoData);
- data->buffer = NULL;
+ data->buffer = nullptr;
data->bufferSize = 0;
data->bufferIndex = 0;
data->bufferOffset = 0;
@@ -100,7 +100,7 @@ int dabInputDabplusFifoRead(void* args, void* buffer, int size)
dabInputDabplusFifoData* data = (dabInputDabplusFifoData*)args;
if (data->bufferSize != (size_t)size * 5) {
- if (data->buffer != NULL) {
+ if (data->buffer != nullptr) {
delete[] data->buffer;
}
data->buffer = new uint8_t[size * 5];
diff --git a/src/dabInputDabplusFile.cpp b/src/dabInputDabplusFile.cpp
index 396a376..64b7f07 100644
--- a/src/dabInputDabplusFile.cpp
+++ b/src/dabInputDabplusFile.cpp
@@ -40,8 +40,8 @@ struct dabInputOperations dabInputDabplusFileOperations = {
dabInputDabplusFileOpen,
dabInputSetbuf,
dabInputDabplusFileRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputDabplusFileReadFrame,
dabInputSetbitrate,
dabInputDabplusFileClose,
@@ -54,7 +54,7 @@ int dabInputDabplusFileInit(void** args)
{
dabInputDabplusFileData* data = new dabInputDabplusFileData;
data->file = -1;
- data->buffer = NULL;
+ data->buffer = nullptr;
data->bufferSize = 0;
data->bufferIndex = 0;
@@ -80,7 +80,7 @@ int dabInputDabplusFileRead(void* args, void* buffer, int size)
{
dabInputDabplusFileData* data = (dabInputDabplusFileData*)args;
if (data->bufferSize != (size_t)size * 5) {
- if (data->buffer == NULL) {
+ if (data->buffer == nullptr) {
delete[] data->buffer;
}
data->buffer = new uint8_t[size * 5];
@@ -158,7 +158,7 @@ int dabInputDabplusFileClose(void* args)
int dabInputDabplusFileClean(void** args)
{
dabInputDabplusFileData* data = (dabInputDabplusFileData*)*args;
- if (data->buffer != NULL) {
+ if (data->buffer != nullptr) {
delete[] data->buffer;
}
delete data;
diff --git a/src/dabInputDmbFile.cpp b/src/dabInputDmbFile.cpp
index 423d644..17bd72d 100644
--- a/src/dabInputDmbFile.cpp
+++ b/src/dabInputDmbFile.cpp
@@ -42,14 +42,14 @@ struct dabInputOperations dabInputDmbFileOperations = {
dabInputDmbFileInit,
dabInputDmbFileOpen,
dabInputSetbuf,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
dabInputDmbFileRead,
dabInputSetbitrate,
dabInputDmbFileClose,
dabInputDmbFileClean,
- NULL
+ nullptr
};
@@ -58,7 +58,7 @@ int dabInputDmbFileInit(void** args)
dabInputDmbFileData* input = new dabInputDmbFileData;
memset(&input->stats, 0, sizeof(input->stats));
input->stats.id = dabInputFifoData::nb++;
- input->file = NULL;
+ input->file = nullptr;
input->bufferLength = 0;
input->dmb = new Dmb();
*args = input;
@@ -73,7 +73,7 @@ int dabInputDmbFileOpen(void* args, const char* inputName)
dabInputDmbFileData* input = (dabInputDmbFileData*)args;
input->file = fopen(inputName, "r");
- if (input->file == NULL) {
+ if (input->file == nullptr) {
perror(inputName);
returnCode = -1;
}
@@ -138,7 +138,7 @@ int dabInputDmbFileClose(void* args)
{
dabInputDmbFileData* input = (dabInputDmbFileData*)args;
- if (input->file != NULL) {
+ if (input->file != nullptr) {
if (fclose(input->file)) {
perror("");
return -1;
diff --git a/src/dabInputEnhancedPacketFile.cpp b/src/dabInputEnhancedPacketFile.cpp
index 1b5c8bc..3b12e0b 100644
--- a/src/dabInputEnhancedPacketFile.cpp
+++ b/src/dabInputEnhancedPacketFile.cpp
@@ -29,8 +29,8 @@ struct dabInputOperations dabInputEnhancedPacketFileOperations = {
dabInputFileOpen,
dabInputSetbuf,
dabInputFileRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputPacketFileRead,
dabInputSetbitrate,
dabInputFileClose,
diff --git a/src/dabInputFifo.cpp b/src/dabInputFifo.cpp
index 3e35c20..7e07731 100644
--- a/src/dabInputFifo.cpp
+++ b/src/dabInputFifo.cpp
@@ -61,9 +61,9 @@ int dabInputFifoInit(void** args)
data->curSize = 0;
data->head = 0;
data->tail = 0;
- data->buffer = NULL;
- data->packetData = NULL;
- data->enhancedPacketData = NULL;
+ data->buffer = nullptr;
+ data->packetData = nullptr;
+ data->enhancedPacketData = nullptr;
data->packetLength = 0;
data->enhancedPacketLength = 0;
data->enhancedPacketWaiting = 0;
@@ -145,7 +145,7 @@ int dabInputFifoOpen(void* args, const char* filename)
return -1;
}
#else
- if (pthread_create(&data->thread, NULL, dabInputFifoThread, data)) {
+ if (pthread_create(&data->thread, nullptr, dabInputFifoThread, data)) {
perror("Can't create FIFO child");
return -1;
}
@@ -166,7 +166,7 @@ int dabInputFifoSetbuf(void* args, int size)
sem_wait(&data->semBuffer);
#endif
}
- if (data->buffer != NULL) {
+ if (data->buffer != nullptr) {
delete data->buffer;
}
if (size == 0) {
@@ -367,7 +367,7 @@ int dabInputFifoClean(void** args)
}
#else
if (data->thread != (pthread_t)NULL) {
- if (pthread_join(data->thread, NULL)) {
+ if (pthread_join(data->thread, nullptr)) {
etiLog.log(debug, "ERROR: FIFO child thread had not exit normally\n");
}
}
@@ -382,12 +382,12 @@ int dabInputFifoClean(void** args)
sem_destroy(&data->semFull);
sem_destroy(&data->semBuffer);
#endif
- if (data->packetData != NULL) {
+ if (data->packetData != nullptr) {
delete[] data->packetData;
}
- if (data->enhancedPacketData != NULL) {
+ if (data->enhancedPacketData != nullptr) {
for (int i = 0; i < 12; ++i) {
- if (data->enhancedPacketData[i] != NULL) {
+ if (data->enhancedPacketData[i] != nullptr) {
delete[] data->enhancedPacketData[i];
}
}
@@ -505,7 +505,7 @@ void* dabInputFifoThread(void* args)
sem_post(&data->semBuffer);
#endif
}
- return NULL;
+ return nullptr;
}
diff --git a/src/dabInputFile.cpp b/src/dabInputFile.cpp
index 30ab37d..2847caa 100644
--- a/src/dabInputFile.cpp
+++ b/src/dabInputFile.cpp
@@ -38,7 +38,7 @@ int dabInputFileInit(void** args)
data->parity = false;
data->packetLength = 0;
data->packetData = new unsigned char[96];
- data->enhancedPacketData = NULL;
+ data->enhancedPacketData = nullptr;
data->enhancedPacketLength = 0;
data->enhancedPacketWaiting = 0;
@@ -79,12 +79,12 @@ int dabInputFileClose(void* args)
int dabInputFileClean(void** args)
{
dabInputFileData* data = (dabInputFileData*)*args;
- if (data->packetData != NULL) {
+ if (data->packetData != nullptr) {
delete[] data->packetData;
}
- if (data->enhancedPacketData != NULL) {
+ if (data->enhancedPacketData != nullptr) {
for (int i = 0; i < 12; ++i) {
- if (data->enhancedPacketData[i] != NULL) {
+ if (data->enhancedPacketData[i] != nullptr) {
delete[] data->enhancedPacketData[i];
}
}
diff --git a/src/dabInputMpegFile.cpp b/src/dabInputMpegFile.cpp
index 724ad54..804ea29 100644
--- a/src/dabInputMpegFile.cpp
+++ b/src/dabInputMpegFile.cpp
@@ -37,8 +37,8 @@ struct dabInputOperations dabInputMpegFileOperations = {
dabInputFileOpen,
dabInputSetbuf,
dabInputFileRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputMpegFileRead,
dabInputMpegSetbitrate,
dabInputFileClose,
diff --git a/src/dabInputPacketFile.cpp b/src/dabInputPacketFile.cpp
index 3ff4e56..867d9fc 100644
--- a/src/dabInputPacketFile.cpp
+++ b/src/dabInputPacketFile.cpp
@@ -59,8 +59,8 @@ struct dabInputOperations dabInputPacketFileOperations = {
dabInputFileOpen,
dabInputSetbuf,
dabInputFileRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputPacketFileRead,
dabInputSetbitrate,
dabInputFileClose,
@@ -114,7 +114,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
dataBuffer[22] = 0x60;
dataBuffer[23] = 0x4b;
length = 24;
- } else if (data->enhancedPacketData != NULL) {
+ } else if (data->enhancedPacketData != nullptr) {
if (data->enhancedPacketLength + data->packetLength
> (12 * 188)) {
memset(dataBuffer, 0, 22);
@@ -131,7 +131,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
length = data->packetLength;
data->packetLength = 0;
}
- if (data->enhancedPacketData != NULL) {
+ if (data->enhancedPacketData != nullptr) {
indexCol = data->enhancedPacketLength / 12;
indexRow = data->enhancedPacketLength % 12; // TODO Check if always 0
for (int j = 0; j < length; ++j) {
@@ -179,7 +179,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
data->packetLength = length;
continue;
}
- if (data->enhancedPacketData != NULL) {
+ if (data->enhancedPacketData != nullptr) {
if (data->enhancedPacketLength + length > (12 * 188)) {
memcpy(data->packetData, header, 3);
ops->read(args, &data->packetData[3], length - 3);
@@ -203,7 +203,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
"read %i out of %i bytes\n", nbBytes, length - 3);
break;
}
- if (data->enhancedPacketData != NULL) {
+ if (data->enhancedPacketData != nullptr) {
indexCol = data->enhancedPacketLength / 12;
indexRow = data->enhancedPacketLength % 12; // TODO Check if always 0
for (int j = 0; j < length; ++j) {
diff --git a/src/dabInputRawFifo.cpp b/src/dabInputRawFifo.cpp
index 0da9727..cc6268b 100644
--- a/src/dabInputRawFifo.cpp
+++ b/src/dabInputRawFifo.cpp
@@ -40,8 +40,8 @@ struct dabInputOperations dabInputRawFifoOperations = {
dabInputRawFifoOpen,
dabInputRawFifoSetbuf,
dabInputRawFifoRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputRawFifoReadFrame,
dabInputSetbitrate,
dabInputRawFifoClose,
@@ -54,7 +54,7 @@ int dabInputRawFifoInit(void** args)
{
dabInputRawFifoData* data = new dabInputRawFifoData;
data->file = -1;
- data->buffer = NULL;
+ data->buffer = nullptr;
data->bufferSize = 0;
data->bufferOffset = 0;
@@ -97,7 +97,7 @@ int dabInputRawFifoSetbuf(void* args, int size)
}
if (data->bufferSize != (size_t)size) {
- if (data->buffer != NULL) {
+ if (data->buffer != nullptr) {
delete[] data->buffer;
}
data->buffer = new uint8_t[size];
@@ -174,7 +174,7 @@ int dabInputRawFifoClose(void* args)
int dabInputRawFifoClean(void** args)
{
dabInputRawFifoData* data = (dabInputRawFifoData*)*args;
- if (data->buffer != NULL) {
+ if (data->buffer != nullptr) {
delete[] data->buffer;
}
delete data;
diff --git a/src/dabInputRawFile.cpp b/src/dabInputRawFile.cpp
index 88ffa2a..be33a45 100644
--- a/src/dabInputRawFile.cpp
+++ b/src/dabInputRawFile.cpp
@@ -32,8 +32,8 @@ struct dabInputOperations dabInputRawFileOperations = {
dabInputFileOpen,
dabInputSetbuf,
dabInputFileRead,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
dabInputRawFileRead,
dabInputSetbitrate,
dabInputFileClose,
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp
index 70fd0c8..1591939 100644
--- a/src/dabInputZmq.cpp
+++ b/src/dabInputZmq.cpp
@@ -213,7 +213,7 @@ void DabInputZmqBase::rebind()
m_zmq_sock_bound_to = m_inputUri;
try {
- m_zmq_sock.setsockopt(ZMQ_SUBSCRIBE, NULL, 0);
+ m_zmq_sock.setsockopt(ZMQ_SUBSCRIBE, nullptr, 0);
}
catch (zmq::error_t& err) {
std::ostringstream os;
diff --git a/src/utils.cpp b/src/utils.cpp
index 02fbc3f..c776b0b 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -38,7 +38,7 @@ static int dab_time_millis = 0;
void update_dab_time()
{
if (dab_time_seconds == 0) {
- dab_time_seconds = time(NULL);
+ dab_time_seconds = time(nullptr);
} else {
dab_time_millis+= 24;
if (dab_time_millis >= 1000) {
@@ -566,7 +566,7 @@ void printEnsemble(const shared_ptr<dabEnsemble> ensemble)
etiLog.log(info, " mode: %u", ensemble->mode);
if (ensemble->lto_auto) {
- time_t now = time(NULL);
+ time_t now = time(nullptr);
struct tm* ltime = localtime(&now);
time_t now2 = timegm(ltime);
etiLog.log(info, " lto: %2.1f hours", 0.5 * (now2 - now) / 1800);