use nullptr instead of NULL
This commit is contained in:
@@ -66,7 +66,7 @@ result_t TemParamDataType::readSymbols(size_t offset, size_t length, const Symbo
|
||||
if (outputFormat & OF_JSON) {
|
||||
*output << "null";
|
||||
} else {
|
||||
*output << NULL_VALUE;
|
||||
*output << nullptr_VALUE;
|
||||
}
|
||||
return RESULT_OK;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ result_t TemParamDataType::writeSymbols(const size_t offset, const size_t length
|
||||
unsigned int value;
|
||||
unsigned int grp, num;
|
||||
|
||||
if (input->str() == NULL_VALUE) {
|
||||
if (input->str() == nullptr_VALUE) {
|
||||
value = m_replacement; // replacement value
|
||||
} else {
|
||||
string token;
|
||||
@@ -102,24 +102,24 @@ result_t TemParamDataType::writeSymbols(const size_t offset, const size_t length
|
||||
return RESULT_ERR_EOF; // incomplete
|
||||
}
|
||||
const char* str = token.c_str();
|
||||
if (str == NULL || *str == 0) {
|
||||
if (str == nullptr || *str == 0) {
|
||||
return RESULT_ERR_EOF; // input too short
|
||||
}
|
||||
char* strEnd = NULL;
|
||||
char* strEnd = nullptr;
|
||||
grp = (unsigned int)strtoul(str, &strEnd, 10);
|
||||
if (strEnd == NULL || strEnd == str || *strEnd != 0) {
|
||||
if (strEnd == nullptr || strEnd == str || *strEnd != 0) {
|
||||
return RESULT_ERR_INVALID_NUM; // invalid value
|
||||
}
|
||||
if (input->eof() || !getline(*input, token, '-')) {
|
||||
return RESULT_ERR_EOF; // incomplete
|
||||
}
|
||||
str = token.c_str();
|
||||
if (str == NULL || *str == 0) {
|
||||
if (str == nullptr || *str == 0) {
|
||||
return RESULT_ERR_EOF; // input too short
|
||||
}
|
||||
strEnd = NULL;
|
||||
strEnd = nullptr;
|
||||
num = (unsigned int)strtoul(str, &strEnd, 10);
|
||||
if (strEnd == NULL || strEnd == str || *strEnd != 0) {
|
||||
if (strEnd == nullptr || strEnd == str || *strEnd != 0) {
|
||||
return RESULT_ERR_INVALID_NUM; // invalid value
|
||||
}
|
||||
if (grp > 0x1f || num > 0x7f) {
|
||||
|
||||
@@ -47,7 +47,7 @@ class TemParamDataType : public NumberDataType {
|
||||
* @param id the type identifier.
|
||||
*/
|
||||
explicit TemParamDataType(const string& id)
|
||||
: NumberDataType(id, 16, 0, 0xffff, 0, 0xffff, 0, NULL) {}
|
||||
: NumberDataType(id, 16, 0, 0xffff, 0, 0xffff, 0, nullptr) {}
|
||||
|
||||
// @copydoc
|
||||
result_t derive(int divisor, size_t bitCount, const NumberDataType** derived) const override;
|
||||
|
||||
@@ -53,7 +53,7 @@ class TestReader : public MappedFileReader {
|
||||
public:
|
||||
TestReader(DataFieldTemplates* templates, bool isSet, bool isMasterDest)
|
||||
: MappedFileReader::MappedFileReader(true), m_templates(templates), m_isSet(isSet), m_isMasterDest(isMasterDest),
|
||||
m_fields(NULL) {}
|
||||
m_fields(nullptr) {}
|
||||
result_t getFieldMap(const string& preferLanguage, vector<string>* row, string* errorDescription) const override {
|
||||
if (row->empty()) {
|
||||
row->push_back("*name");
|
||||
@@ -90,7 +90,7 @@ class TestReader : public MappedFileReader {
|
||||
|
||||
int main() {
|
||||
const DataType* type = DataTypeList::getInstance()->get("TEM_P");
|
||||
if (type == NULL) {
|
||||
if (type == nullptr) {
|
||||
cout << "datatype not registered" << endl;
|
||||
return 1;
|
||||
}
|
||||
@@ -118,8 +118,8 @@ int main() {
|
||||
istringstream dummystr("#");
|
||||
string errorDescription;
|
||||
vector<string> row;
|
||||
templates->readLineFromStream(&dummystr, "inline", false, &lineNo, &row, &errorDescription, false, NULL, NULL);
|
||||
const DataField* fields = NULL;
|
||||
templates->readLineFromStream(&dummystr, "inline", false, &lineNo, &row, &errorDescription, false, nullptr, nullptr);
|
||||
const DataField* fields = nullptr;
|
||||
for (unsigned int i = 0; i < sizeof(checks) / sizeof(checks[0]); i++) {
|
||||
string check[5] = checks[i];
|
||||
istringstream isstr(check[0]);
|
||||
@@ -146,9 +146,9 @@ int main() {
|
||||
bool failedWriteMatch = flags.find('W') != string::npos;
|
||||
string item;
|
||||
|
||||
if (fields != NULL) {
|
||||
if (fields != nullptr) {
|
||||
delete fields;
|
||||
fields = NULL;
|
||||
fields = nullptr;
|
||||
}
|
||||
|
||||
string errorDescription;
|
||||
@@ -156,7 +156,7 @@ int main() {
|
||||
lineNo = 0;
|
||||
dummystr.clear();
|
||||
dummystr.str("#");
|
||||
result = reader.readLineFromStream(&dummystr, "inline", false, &lineNo, &row, &errorDescription, false, NULL, NULL);
|
||||
result = reader.readLineFromStream(&dummystr, "inline", false, &lineNo, &row, &errorDescription, false, nullptr, nullptr);
|
||||
if (result != RESULT_OK) {
|
||||
cout << "\"" << check[0] << "\": reader header error: " << getResultCode(result) << ", " << errorDescription
|
||||
<< endl;
|
||||
@@ -164,7 +164,7 @@ int main() {
|
||||
continue;
|
||||
}
|
||||
lineNo = baseLine + i;
|
||||
result = reader.readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, false, NULL, NULL);
|
||||
result = reader.readLineFromStream(&isstr, __FILE__, false, &lineNo, &row, &errorDescription, false, nullptr, nullptr);
|
||||
fields = reader.m_fields;
|
||||
|
||||
if (result != RESULT_OK) {
|
||||
@@ -172,8 +172,8 @@ int main() {
|
||||
error = true;
|
||||
continue;
|
||||
}
|
||||
if (fields == NULL) {
|
||||
cout << "\"" << check[0] << "\": create error: NULL" << endl;
|
||||
if (fields == nullptr) {
|
||||
cout << "\"" << check[0] << "\": create error: nullptr" << endl;
|
||||
error = true;
|
||||
continue;
|
||||
}
|
||||
@@ -194,9 +194,9 @@ int main() {
|
||||
cout << " parse \"" << sstr.getStr().substr(0, 2) << "\" error: " << getResultCode(result) << endl;
|
||||
error = true;
|
||||
}
|
||||
result = fields->read(mstr, 0, false, NULL, -1, 0, -1, &output);
|
||||
result = fields->read(mstr, 0, false, nullptr, -1, 0, -1, &output);
|
||||
if (result >= RESULT_OK) {
|
||||
result = fields->read(sstr, 0, !output.str().empty(), NULL, -1, 0, -1, &output);
|
||||
result = fields->read(sstr, 0, !output.str().empty(), nullptr, -1, 0, -1, &output);
|
||||
}
|
||||
if (failedRead) {
|
||||
if (result >= RESULT_OK) {
|
||||
@@ -217,9 +217,9 @@ int main() {
|
||||
}
|
||||
|
||||
istringstream input(expectStr);
|
||||
result = fields->write(UI_FIELD_SEPARATOR, 0, &input, &writeMstr, NULL);
|
||||
result = fields->write(UI_FIELD_SEPARATOR, 0, &input, &writeMstr, nullptr);
|
||||
if (result >= RESULT_OK) {
|
||||
result = fields->write(UI_FIELD_SEPARATOR, 0, &input, &writeSstr, NULL);
|
||||
result = fields->write(UI_FIELD_SEPARATOR, 0, &input, &writeSstr, nullptr);
|
||||
}
|
||||
if (failedWrite) {
|
||||
if (result >= RESULT_OK) {
|
||||
@@ -240,7 +240,7 @@ int main() {
|
||||
writeMstr.getStr() + " " + writeSstr.getStr());
|
||||
}
|
||||
delete fields;
|
||||
fields = NULL;
|
||||
fields = nullptr;
|
||||
}
|
||||
|
||||
delete templates;
|
||||
|
||||
Reference in New Issue
Block a user