summaryrefslogtreecommitdiff
path: root/src/strgen
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-04-10 22:07:06 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-10 23:22:20 +0200
commit7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch)
tree99f134b7e66367cf11e10bc5061896eab4a3264f /src/strgen
parent3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff)
downloadopenttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/strgen')
-rw-r--r--src/strgen/strgen.cpp34
-rw-r--r--src/strgen/strgen.h2
-rw-r--r--src/strgen/strgen_base.cpp110
3 files changed, 73 insertions, 73 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 5b361430f..a4c9da08e 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -106,7 +106,7 @@ struct FileStringReader : StringReader {
StringReader(data, file, master, translation)
{
this->fh = fopen(file, "rb");
- if (this->fh == NULL) error("Could not open %s", file);
+ if (this->fh == nullptr) error("Could not open %s", file);
}
/** Free/close the file. */
@@ -135,7 +135,7 @@ struct FileStringReader : StringReader {
void FileStringReader::HandlePragma(char *str)
{
if (!memcmp(str, "id ", 3)) {
- this->data.next_string_id = strtoul(str + 3, NULL, 0);
+ this->data.next_string_id = strtoul(str + 3, nullptr, 0);
} else if (!memcmp(str, "name ", 5)) {
strecpy(_lang.name, str + 5, lastof(_lang.name));
} else if (!memcmp(str, "ownname ", 8)) {
@@ -161,14 +161,14 @@ void FileStringReader::HandlePragma(char *str)
strecpy(_lang.digit_decimal_separator, strcmp(str, "{NBSP}") == 0 ? NBSP : str, lastof(_lang.digit_decimal_separator));
} else if (!memcmp(str, "winlangid ", 10)) {
const char *buf = str + 10;
- long langid = strtol(buf, NULL, 16);
+ long langid = strtol(buf, nullptr, 16);
if (langid > (long)UINT16_MAX || langid < 0) {
error("Invalid winlangid %s", buf);
}
_lang.winlangid = (uint16)langid;
} else if (!memcmp(str, "grflangid ", 10)) {
const char *buf = str + 10;
- long langid = strtol(buf, NULL, 16);
+ long langid = strtol(buf, nullptr, 16);
if (langid >= 0x7F || langid < 0) {
error("Invalid grflangid %s", buf);
}
@@ -180,7 +180,7 @@ void FileStringReader::HandlePragma(char *str)
for (;;) {
const char *s = ParseWord(&buf);
- if (s == NULL) break;
+ if (s == nullptr) break;
if (_lang.num_genders >= MAX_NUM_GENDERS) error("Too many genders, max %d", MAX_NUM_GENDERS);
strecpy(_lang.genders[_lang.num_genders], s, lastof(_lang.genders[_lang.num_genders]));
_lang.num_genders++;
@@ -192,7 +192,7 @@ void FileStringReader::HandlePragma(char *str)
for (;;) {
const char *s = ParseWord(&buf);
- if (s == NULL) break;
+ if (s == nullptr) break;
if (_lang.num_cases >= MAX_NUM_CASES) error("Too many cases, max %d", MAX_NUM_CASES);
strecpy(_lang.cases[_lang.num_cases], s, lastof(_lang.cases[_lang.num_cases]));
_lang.num_cases++;
@@ -205,10 +205,10 @@ void FileStringReader::HandlePragma(char *str)
bool CompareFiles(const char *n1, const char *n2)
{
FILE *f2 = fopen(n2, "rb");
- if (f2 == NULL) return false;
+ if (f2 == nullptr) return false;
FILE *f1 = fopen(n1, "rb");
- if (f1 == NULL) {
+ if (f1 == nullptr) {
fclose(f2);
error("can't open %s", n1);
}
@@ -246,7 +246,7 @@ struct FileWriter {
this->filename = stredup(filename);
this->fh = fopen(this->filename, "wb");
- if (this->fh == NULL) {
+ if (this->fh == nullptr) {
error("Could not open %s", this->filename);
}
}
@@ -255,14 +255,14 @@ struct FileWriter {
void Finalise()
{
fclose(this->fh);
- this->fh = NULL;
+ this->fh = nullptr;
}
/** Make sure the file is closed. */
virtual ~FileWriter()
{
/* If we weren't closed an exception was thrown, so remove the temporary file. */
- if (fh != NULL) {
+ if (fh != nullptr) {
fclose(this->fh);
unlink(this->filename);
}
@@ -418,7 +418,7 @@ static const OptionData _opts[] = {
GETOPT_NOVAL( 't', "--todo"),
GETOPT_NOVAL( 'w', "--warning"),
GETOPT_NOVAL( 'h', "--help"),
- GETOPT_GENERAL('h', '?', NULL, ODF_NO_VALUE),
+ GETOPT_GENERAL('h', '?', nullptr, ODF_NO_VALUE),
GETOPT_VALUE( 's', "--source_dir"),
GETOPT_VALUE( 'd', "--dest_dir"),
GETOPT_END(),
@@ -428,7 +428,7 @@ int CDECL main(int argc, char *argv[])
{
char pathbuf[MAX_PATH];
const char *src_dir = ".";
- const char *dest_dir = NULL;
+ const char *dest_dir = nullptr;
GetOptData mgo(argc - 1, argv + 1, _opts);
for (;;) {
@@ -512,7 +512,7 @@ int CDECL main(int argc, char *argv[])
}
}
- if (dest_dir == NULL) dest_dir = src_dir; // if dest_dir is not specified, it equals src_dir
+ if (dest_dir == nullptr) dest_dir = src_dir; // if dest_dir is not specified, it equals src_dir
try {
/* strgen has two modes of operation. If no (free) arguments are passed
@@ -551,17 +551,17 @@ int CDECL main(int argc, char *argv[])
const char *translation = replace_pathsep(mgo.argv[i]);
const char *file = strrchr(translation, PATHSEPCHAR);
- FileStringReader translation_reader(data, translation, false, file == NULL || strcmp(file + 1, "english.txt") != 0);
+ FileStringReader translation_reader(data, translation, false, file == nullptr || strcmp(file + 1, "english.txt") != 0);
translation_reader.ParseFile(); // target file
if (_errors != 0) return 1;
/* get the targetfile, strip any directories and append to destination path */
r = strrchr(mgo.argv[i], PATHSEPCHAR);
- mkpath(pathbuf, lastof(pathbuf), dest_dir, (r != NULL) ? &r[1] : mgo.argv[i]);
+ mkpath(pathbuf, lastof(pathbuf), dest_dir, (r != nullptr) ? &r[1] : mgo.argv[i]);
/* rename the .txt (input-extension) to .lng */
r = strrchr(pathbuf, '.');
- if (r == NULL || strcmp(r, ".txt") != 0) r = strchr(pathbuf, '\0');
+ if (r == nullptr || strcmp(r, ".txt") != 0) r = strchr(pathbuf, '\0');
strecpy(r, ".lng", lastof(pathbuf));
LanguageFileWriter writer(pathbuf);
diff --git a/src/strgen/strgen.h b/src/strgen/strgen.h
index ecae71a72..fd527203b 100644
--- a/src/strgen/strgen.h
+++ b/src/strgen/strgen.h
@@ -73,7 +73,7 @@ struct StringReader {
* Read a single line from the source of strings.
* @param buffer The buffer to read the data in to.
* @param last The last element in the buffer.
- * @return The buffer, or NULL if at the end of the file.
+ * @return The buffer, or nullptr if at the end of the file.
*/
virtual char *ReadLine(char *buffer, const char *last) = 0;
diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp
index 00c3fb9f6..804ce6498 100644
--- a/src/strgen/strgen_base.cpp
+++ b/src/strgen/strgen_base.cpp
@@ -59,8 +59,8 @@ Case::~Case()
* @param line The line this string was found on.
*/
LangString::LangString(const char *name, const char *english, int index, int line) :
- name(stredup(name)), english(stredup(english)), translated(NULL),
- hash_next(0), index(index), line(line), translated_case(NULL)
+ name(stredup(name)), english(stredup(english)), translated(nullptr),
+ hash_next(0), index(index), line(line), translated_case(nullptr)
{
}
@@ -77,10 +77,10 @@ LangString::~LangString()
void LangString::FreeTranslation()
{
free(this->translated);
- this->translated = NULL;
+ this->translated = nullptr;
delete this->translated_case;
- this->translated_case = NULL;
+ this->translated_case = nullptr;
}
/**
@@ -107,7 +107,7 @@ void StringData::FreeTranslation()
{
for (size_t i = 0; i < this->max_strings; i++) {
LangString *ls = this->strings[i];
- if (ls != NULL) ls->FreeTranslation();
+ if (ls != nullptr) ls->FreeTranslation();
}
}
@@ -140,7 +140,7 @@ void StringData::Add(const char *s, LangString *ls)
/**
* Find a LangString based on the string name.
* @param s The string name to search on.
- * @return The LangString or NULL if it is not known.
+ * @return The LangString or nullptr if it is not known.
*/
LangString *StringData::Find(const char *s)
{
@@ -152,7 +152,7 @@ LangString *StringData::Find(const char *s)
if (strcmp(ls->name, s) == 0) return ls;
idx = ls->hash_next;
}
- return NULL;
+ return nullptr;
}
/**
@@ -181,7 +181,7 @@ uint StringData::Version() const
for (size_t i = 0; i < this->max_strings; i++) {
const LangString *ls = this->strings[i];
- if (ls != NULL) {
+ if (ls != nullptr) {
const CmdStruct *cs;
const char *s;
char buf[MAX_COMMAND_PARAM_SIZE];
@@ -194,7 +194,7 @@ uint StringData::Version() const
hash = this->VersionHashStr(hash, s + 1);
s = ls->english;
- while ((cs = ParseCommandString(&s, buf, &argno, &casei)) != NULL) {
+ while ((cs = ParseCommandString(&s, buf, &argno, &casei)) != nullptr) {
if (cs->flags & C_DONTCOUNT) continue;
hash ^= (cs - _cmd_structs) * 0x1234567;
@@ -213,7 +213,7 @@ uint StringData::Version() const
uint StringData::CountInUse(uint tab) const
{
int i;
- for (i = TAB_SIZE; --i >= 0;) if (this->strings[(tab * TAB_SIZE) + i] != NULL) break;
+ for (i = TAB_SIZE; --i >= 0;) if (this->strings[(tab * TAB_SIZE) + i] != nullptr) break;
return i + 1;
}
@@ -327,7 +327,7 @@ bool ParseRelNum(char **buf, int *value, int *offset)
} else {
*value = v;
}
- if (offset != NULL && *end == ':') {
+ if (offset != nullptr && *end == ':') {
/* Take the Nth within */
s = end + 1;
*offset = strtol(s, &end, 0);
@@ -337,13 +337,13 @@ bool ParseRelNum(char **buf, int *value, int *offset)
return true;
}
-/* Parse out the next word, or NULL */
+/* Parse out the next word, or nullptr */
char *ParseWord(char **buf)
{
char *s = *buf, *r;
while (*s == ' ' || *s == '\t') s++;
- if (*s == '\0') return NULL;
+ if (*s == '\0') return nullptr;
if (*s == '"') {
r = ++s;
@@ -399,8 +399,8 @@ void EmitPlural(Buffer *buffer, char *buf, int value)
const CmdStruct *cmd = _cur_pcs.cmd[argidx];
if (offset == -1) {
/* Use default offset */
- if (cmd == NULL || cmd->default_plural_offset < 0) {
- strgen_fatal("Command '%s' has no (default) plural position", cmd == NULL ? "<empty>" : cmd->cmd);
+ if (cmd == nullptr || cmd->default_plural_offset < 0) {
+ strgen_fatal("Command '%s' has no (default) plural position", cmd == nullptr ? "<empty>" : cmd->cmd);
}
offset = cmd->default_plural_offset;
}
@@ -408,7 +408,7 @@ void EmitPlural(Buffer *buffer, char *buf, int value)
/* Parse each string */
for (nw = 0; nw < MAX_PLURALS; nw++) {
words[nw] = ParseWord(&buf);
- if (words[nw] == NULL) break;
+ if (words[nw] == nullptr) break;
}
if (nw == 0) {
@@ -462,13 +462,13 @@ void EmitGender(Buffer *buffer, char *buf, int value)
if (!ParseRelNum(&buf, &argidx, &offset)) {}
const CmdStruct *cmd = _cur_pcs.cmd[argidx];
- if (cmd == NULL || (cmd->flags & C_GENDER) == 0) {
- strgen_fatal("Command '%s' can't have a gender", cmd == NULL ? "<empty>" : cmd->cmd);
+ if (cmd == nullptr || (cmd->flags & C_GENDER) == 0) {
+ strgen_fatal("Command '%s' can't have a gender", cmd == nullptr ? "<empty>" : cmd->cmd);
}
for (nw = 0; nw < MAX_NUM_GENDERS; nw++) {
words[nw] = ParseWord(&buf);
- if (words[nw] == NULL) break;
+ if (words[nw] == nullptr) break;
}
if (nw != _lang.num_genders) strgen_fatal("Bad # of arguments for gender command");
@@ -484,7 +484,7 @@ static const CmdStruct *FindCmd(const char *s, int len)
for (const CmdStruct *cs = _cmd_structs; cs != endof(_cmd_structs); cs++) {
if (strncmp(cs->cmd, s, len) == 0 && cs->cmd[len] == '\0') return cs;
}
- return NULL;
+ return nullptr;
}
static uint ResolveCaseName(const char *str, size_t len)
@@ -501,7 +501,7 @@ static uint ResolveCaseName(const char *str, size_t len)
}
-/* returns NULL on eof
+/* returns nullptr on eof
* else returns command struct */
static const CmdStruct *ParseCommandString(const char **str, char *param, int *argno, int *casei)
{
@@ -513,7 +513,7 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
/* Scan to the next command, exit if there's no next command. */
for (; *s != '{'; s++) {
- if (*s == '\0') return NULL;
+ if (*s == '\0') return nullptr;
}
s++; // Skip past the {
@@ -532,9 +532,9 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
} while (c != '}' && c != ' ' && c != '=' && c != '.' && c != 0);
const CmdStruct *cmd = FindCmd(start, s - start - 1);
- if (cmd == NULL) {
+ if (cmd == nullptr) {
strgen_error("Undefined command '%.*s'", (int)(s - start - 1), start);
- return NULL;
+ return nullptr;
}
if (c == '.') {
@@ -552,7 +552,7 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
if (c == '\0') {
strgen_error("Missing } from command '%s'", start);
- return NULL;
+ return nullptr;
}
@@ -565,7 +565,7 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
if (c == '}') break;
if (c == '\0') {
strgen_error("Missing } from command '%s'", start);
- return NULL;
+ return nullptr;
}
if (s - start == MAX_COMMAND_PARAM_SIZE) error("param command too long");
*param++ = c;
@@ -609,7 +609,7 @@ static void ExtractCommandString(ParsedCommandStruct *p, const char *s, bool war
/* read until next command from a. */
const CmdStruct *ar = ParseCommandString(&s, param, &argno, &casei);
- if (ar == NULL) break;
+ if (ar == nullptr) break;
/* Sanity checking */
if (argno != -1 && ar->consumes == 0) strgen_fatal("Non consumer param can't have a paramindex");
@@ -617,7 +617,7 @@ static void ExtractCommandString(ParsedCommandStruct *p, const char *s, bool war
if (ar->consumes) {
if (argno != -1) argidx = argno;
if (argidx < 0 || (uint)argidx >= lengthof(p->cmd)) strgen_fatal("invalid param idx %d", argidx);
- if (p->cmd[argidx] != NULL && p->cmd[argidx] != ar) strgen_fatal("duplicate param idx %d", argidx);
+ if (p->cmd[argidx] != nullptr && p->cmd[argidx] != ar) strgen_fatal("duplicate param idx %d", argidx);
p->cmd[argidx++] = ar;
} else if (!(ar->flags & C_DONTCOUNT)) { // Ignore some of them
@@ -632,7 +632,7 @@ static void ExtractCommandString(ParsedCommandStruct *p, const char *s, bool war
static const CmdStruct *TranslateCmdForCompare(const CmdStruct *a)
{
- if (a == NULL) return NULL;
+ if (a == nullptr) return nullptr;
if (strcmp(a->cmd, "STRING1") == 0 ||
strcmp(a->cmd, "STRING2") == 0 ||
@@ -677,7 +677,7 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name)
if (templ.pairs[i].a == lang.pairs[j].a &&
strcmp(templ.pairs[i].v, lang.pairs[j].v) == 0) {
/* it was found in both. zero it out from lang so we don't find it again */
- lang.pairs[j].a = NULL;
+ lang.pairs[j].a = nullptr;
found = true;
break;
}
@@ -694,8 +694,8 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name)
for (uint i = 0; i < lengthof(templ.cmd); i++) {
if (TranslateCmdForCompare(templ.cmd[i]) != lang.cmd[i]) {
strgen_warning("%s: Param idx #%d '%s' doesn't match with template command '%s'", name, i,
- lang.cmd[i] == NULL ? "<empty>" : TranslateCmdForCompare(lang.cmd[i])->cmd,
- templ.cmd[i] == NULL ? "<empty>" : templ.cmd[i]->cmd);
+ lang.cmd[i] == nullptr ? "<empty>" : TranslateCmdForCompare(lang.cmd[i])->cmd,
+ templ.cmd[i] == nullptr ? "<empty>" : templ.cmd[i]->cmd);
result = false;
}
}
@@ -714,7 +714,7 @@ void StringReader::HandleString(char *str)
if (*str == ';' || *str == ' ' || *str == '\0') return;
char *s = strchr(str, ':');
- if (s == NULL) {
+ if (s == nullptr) {
strgen_error("Line has no ':' delimiter");
return;
}
@@ -747,23 +747,23 @@ void StringReader::HandleString(char *str)
/* Check if the string has a case..
* The syntax for cases is IDENTNAME.case */
char *casep = strchr(str, '.');
- if (casep != NULL) *casep++ = '\0';
+ if (casep != nullptr) *casep++ = '\0';
/* Check if this string already exists.. */
LangString *ent = this->data.Find(str);
if (this->master) {
- if (casep != NULL) {
+ if (casep != nullptr) {
strgen_error("Cases in the base translation are not supported.");
return;
}
- if (ent != NULL) {
+ if (ent != nullptr) {
strgen_error("String name '%s' is used multiple times", str);
return;
}
- if (this->data.strings[this->data.next_string_id] != NULL) {
+ if (this->data.strings[this->data.next_string_id] != nullptr) {
strgen_error("String ID 0x%X for '%s' already in use by '%s'", this->data.next_string_id, str, this->data.strings[this->data.next_string_id]->name);
return;
}
@@ -771,12 +771,12 @@ void StringReader::HandleString(char *str)
/* Allocate a new LangString */
this->data.Add(str, new LangString(str, s, this->data.next_string_id++, _cur_line));
} else {
- if (ent == NULL) {
+ if (ent == nullptr) {
strgen_warning("String name '%s' does not exist in master file", str);
return;
}
- if (ent->translated && casep == NULL) {
+ if (ent->translated && casep == nullptr) {
strgen_error("String name '%s' is used multiple times", str);
return;
}
@@ -784,7 +784,7 @@ void StringReader::HandleString(char *str)
/* make sure that the commands match */
if (!CheckCommandsMatch(s, ent->english, str)) return;
- if (casep != NULL) {
+ if (casep != nullptr) {
ent->translated_case = new Case(ResolveCaseName(casep, strlen(casep)), s, ent->translated_case);
} else {
ent->translated = stredup(s);
@@ -830,7 +830,7 @@ void StringReader::ParseFile()
strecpy(_lang.digit_decimal_separator, ".", lastof(_lang.digit_decimal_separator));
_cur_line = 1;
- while (this->ReadLine(buf, lastof(buf)) != NULL) {
+ while (this->ReadLine(buf, lastof(buf)) != nullptr) {
rstrip(buf);
this->HandleString(buf);
_cur_line++;
@@ -845,7 +845,7 @@ void HeaderWriter::WriteHeader(const StringData &data)
{
int last = 0;
for (size_t i = 0; i < data.max_strings; i++) {
- if (data.strings[i] != NULL) {
+ if (data.strings[i] != nullptr) {
this->WriteStringID(data.strings[i]->name, (int)i);
last = (int)i;
}
@@ -862,18 +862,18 @@ static int TranslateArgumentIdx(int argidx, int offset)
strgen_fatal("invalid argidx %d", argidx);
}
const CmdStruct *cs = _cur_pcs.cmd[argidx];
- if (cs != NULL && cs->consumes <= offset) {
+ if (cs != nullptr && cs->consumes <= offset) {
strgen_fatal("invalid argidx offset %d:%d", argidx, offset);
}
- if (_cur_pcs.cmd[argidx] == NULL) {
+ if (_cur_pcs.cmd[argidx] == nullptr) {
strgen_fatal("no command for this argidx %d", argidx);
}
for (int i = sum = 0; i < argidx; i++) {
const CmdStruct *cs = _cur_pcs.cmd[i];
- sum += (cs != NULL) ? cs->consumes : 1;
+ sum += (cs != nullptr) ? cs->consumes : 1;
}
return sum + offset;
@@ -901,7 +901,7 @@ static void PutCommandString(Buffer *buffer, const char *str)
int argno;
int casei;
const CmdStruct *cs = ParseCommandString(&str, param, &argno, &casei);
- if (cs == NULL) break;
+ if (cs == nullptr) break;
if (casei != -1) {
buffer->AppendUtf8(SCC_SET_CASE); // {SET_CASE}
@@ -918,7 +918,7 @@ static void PutCommandString(Buffer *buffer, const char *str)
/* Output the one from the master string... it's always accurate. */
cs = _cur_pcs.cmd[_cur_argidx++];
- if (cs == NULL) {
+ if (cs == nullptr) {
strgen_fatal("%s: No argument exists at position %d", _cur_ident, _cur_argidx - 1);
}
}
@@ -961,7 +961,7 @@ void LanguageWriter::WriteLang(const StringData &data)
for (uint j = 0; j != in_use[tab]; j++) {
const LangString *ls = data.strings[(tab * TAB_SIZE) + j];
- if (ls != NULL && ls->translated == NULL) _lang.missing++;
+ if (ls != nullptr && ls->translated == nullptr) _lang.missing++;
}
}
@@ -980,7 +980,7 @@ void LanguageWriter::WriteLang(const StringData &data)
const char *cmdp;
/* For undefined strings, just set that it's an empty string */
- if (ls == NULL) {
+ if (ls == nullptr) {
this->WriteLength(0);
continue;
}
@@ -989,7 +989,7 @@ void LanguageWriter::WriteLang(const StringData &data)
_cur_line = ls->line;
/* Produce a message if a string doesn't have a translation. */
- if (_show_todo > 0 && ls->translated == NULL) {
+ if (_show_todo > 0 && ls->translated == nullptr) {
if ((_show_todo & 2) != 0) {
strgen_warning("'%s' is untranslated", ls->name);
}
@@ -1002,17 +1002,17 @@ void LanguageWriter::WriteLang(const StringData &data)
/* Extract the strings and stuff from the english command string */
ExtractCommandString(&_cur_pcs, ls->english, false);
- if (ls->translated_case != NULL || ls->translated != NULL) {
+ if (ls->translated_case != nullptr || ls->translated != nullptr) {
casep = ls->translated_case;
cmdp = ls->translated;
} else {
- casep = NULL;
+ casep = nullptr;
cmdp = ls->english;
}
_translated = cmdp != ls->english;
- if (casep != NULL) {
+ if (casep != nullptr) {
const Case *c;
uint num;
@@ -1026,7 +1026,7 @@ void LanguageWriter::WriteLang(const StringData &data)
buffer.AppendByte(num);
/* Write each case */
- for (c = casep; c != NULL; c = c->next) {
+ for (c = casep; c != nullptr; c = c->next) {
buffer.AppendByte(c->caseidx);
/* Make some space for the 16-bit length */
uint pos = (uint)buffer.size();
@@ -1042,7 +1042,7 @@ void LanguageWriter::WriteLang(const StringData &data)
}
}
- if (cmdp != NULL) PutCommandString(&buffer, cmdp);
+ if (cmdp != nullptr) PutCommandString(&buffer, cmdp);
this->WriteLength((uint)buffer.size());
this->Write(buffer.data(), buffer.size());