Commit c6bc38c1 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'misc-warnings'

46c55893 Replaced several 0, NULL, and KWSYS_NULLPTR with nullptr
419aaa35 Fixed -Wunused-macros warnings
750da75a Fixed 64 to 32 bit truncation warning by casting
30de8e17 Fixed -Wsign-conversion warnings by adding casts
4de1241f

 Fixed -Wextra-semi-stmt warning
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !152
parents 08f14d96 46c55893
......@@ -67,8 +67,8 @@ class CommandLineArgumentsInternal
{
public:
CommandLineArgumentsInternal()
: UnknownArgumentCallback{ KWSYS_NULLPTR }
, ClientData{ KWSYS_NULLPTR }
: UnknownArgumentCallback{ nullptr }
, ClientData{ nullptr }
, LastArgument{ 0 }
{
}
......@@ -187,7 +187,7 @@ int CommandLineArguments::Parse()
switch (cs->ArgumentType) {
case NO_ARGUMENT:
// No value
if (!this->PopulateVariable(cs, KWSYS_NULLPTR)) {
if (!this->PopulateVariable(cs, nullptr)) {
return 0;
}
break;
......@@ -340,7 +340,7 @@ void CommandLineArguments::AddCallback(const char* argument,
s.Callback = callback;
s.CallData = call_data;
s.VariableType = CommandLineArguments::NO_VARIABLE_TYPE;
s.Variable = KWSYS_NULLPTR;
s.Variable = nullptr;
s.Help = help;
this->Internals->Callbacks[argument] = s;
......@@ -355,8 +355,8 @@ void CommandLineArguments::AddArgument(const char* argument,
CommandLineArgumentsCallbackStructure s;
s.Argument = argument;
s.ArgumentType = type;
s.Callback = KWSYS_NULLPTR;
s.CallData = KWSYS_NULLPTR;
s.Callback = nullptr;
s.CallData = nullptr;
s.VariableType = vtype;
s.Variable = variable;
s.Help = help;
......@@ -427,7 +427,7 @@ const char* CommandLineArguments::GetHelp(const char* arg)
CommandLineArguments::Internal::CallbacksMap::iterator it =
this->Internals->Callbacks.find(arg);
if (it == this->Internals->Callbacks.end()) {
return KWSYS_NULLPTR;
return nullptr;
}
// Since several arguments may point to the same argument, find the one this
......@@ -621,7 +621,7 @@ void CommandLineArguments::PopulateVariable(bool* variable,
void CommandLineArguments::PopulateVariable(int* variable,
const std::string& value)
{
char* res = KWSYS_NULLPTR;
char* res = nullptr;
*variable = static_cast<int>(strtol(value.c_str(), &res, 10));
// if ( res && *res )
// {
......@@ -632,7 +632,7 @@ void CommandLineArguments::PopulateVariable(int* variable,
void CommandLineArguments::PopulateVariable(double* variable,
const std::string& value)
{
char* res = KWSYS_NULLPTR;
char* res = nullptr;
*variable = strtod(value.c_str(), &res);
// if ( res && *res )
// {
......@@ -669,7 +669,7 @@ void CommandLineArguments::PopulateVariable(std::vector<bool>* variable,
void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
const std::string& value)
{
char* res = KWSYS_NULLPTR;
char* res = nullptr;
variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
// if ( res && *res )
// {
......@@ -680,7 +680,7 @@ void CommandLineArguments::PopulateVariable(std::vector<int>* variable,
void CommandLineArguments::PopulateVariable(std::vector<double>* variable,
const std::string& value)
{
char* res = KWSYS_NULLPTR;
char* res = nullptr;
variable->push_back(strtod(value.c_str(), &res));
// if ( res && *res )
// {
......
......@@ -58,7 +58,6 @@
# define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \
@KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H
# define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH
# define KWSYS_NULLPTR @KWSYS_NAMESPACE@_NULLPTR
# define KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP \
@KWSYS_NAMESPACE@_SYSTEMTOOLS_USE_TRANSLATION_MAP
#endif
......
......@@ -116,7 +116,7 @@ protected:
DWORD charsWritten;
success =
::WriteConsoleW(m_hOutput, wbuffer.c_str(), (DWORD)wbuffer.size(),
&charsWritten, NULL) == 0
&charsWritten, nullptr) == 0
? false
: true;
} else {
......@@ -124,8 +124,9 @@ protected:
std::string buffer;
success = encodeOutputBuffer(wbuffer, buffer);
if (success) {
success = ::WriteFile(m_hOutput, buffer.c_str(),
(DWORD)buffer.size(), &bytesWritten, NULL) == 0
success =
::WriteFile(m_hOutput, buffer.c_str(), (DWORD)buffer.size(),
&bytesWritten, nullptr) == 0
? false
: true;
}
......@@ -152,7 +153,7 @@ protected:
DWORD charsRead;
if (ReadConsoleW(m_hInput, wbuffer,
(sizeof(wbuffer) / sizeof(wbuffer[0])), &charsRead,
NULL) == 0 ||
nullptr) == 0 ||
charsRead == 0) {
_setg(true);
return Traits::eof();
......@@ -168,7 +169,7 @@ protected:
return Traits::eof();
}
char* buffer = new char[size.LowPart];
while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, NULL) ==
while (ReadFile(m_hInput, buffer, size.LowPart, &bytesRead, nullptr) ==
0) {
if (GetLastError() == ERROR_MORE_DATA) {
strbuffer += std::string(buffer, bytesRead);
......@@ -327,11 +328,12 @@ private:
}
const int length =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), NULL, 0, NULL, NULL);
(int)wbuffer.size(), nullptr, 0, nullptr, nullptr);
char* buf = new char[length];
const bool success =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), buf, length, NULL, NULL) > 0
(int)wbuffer.size(), buf, length, nullptr,
nullptr) > 0
? true
: false;
buffer = std::string(buf, length);
......@@ -356,7 +358,7 @@ private:
length -= BOMsize;
}
const size_t wlength = static_cast<size_t>(MultiByteToWideChar(
actualCodepage, 0, data, static_cast<int>(length), NULL, 0));
actualCodepage, 0, data, static_cast<int>(length), nullptr, 0));
wchar_t* wbuf = new wchar_t[wlength];
const bool success =
MultiByteToWideChar(actualCodepage, 0, data, static_cast<int>(length),
......
......@@ -48,7 +48,7 @@ unsigned long Directory::GetNumberOfFiles() const
const char* Directory::GetFile(unsigned long dindex) const
{
if (dindex >= this->Internal->Files.size()) {
return KWSYS_NULLPTR;
return nullptr;
}
return this->Internal->Files[dindex].c_str();
}
......
......@@ -223,15 +223,15 @@ namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, NULL);
CHECK_OPEN_FLAGS(flags, SearchBesideLibrary, nullptr);
DWORD llFlags = 0;
if (flags & SearchBesideLibrary) {
llFlags |= LOAD_WITH_ALTERED_SEARCH_PATH;
}
return LoadLibraryExW(Encoding::ToWindowsExtendedPath(libname).c_str(), NULL,
llFlags);
return LoadLibraryExW(Encoding::ToWindowsExtendedPath(libname).c_str(),
nullptr, llFlags);
}
int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
......@@ -289,9 +289,9 @@ const char* DynamicLoader::LastError()
DWORD error = GetLastError();
DWORD length = FormatMessageW(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error,
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
lpMsgBuf, DYNLOAD_ERROR_BUFFER_SIZE, NULL);
lpMsgBuf, DYNLOAD_ERROR_BUFFER_SIZE, nullptr);
static char str[DYNLOAD_ERROR_BUFFER_SIZE + 1];
......@@ -305,7 +305,7 @@ const char* DynamicLoader::LastError()
}
if (!WideCharToMultiByte(CP_UTF8, 0, lpMsgBuf, -1, str,
DYNLOAD_ERROR_BUFFER_SIZE, NULL, NULL)) {
DYNLOAD_ERROR_BUFFER_SIZE, nullptr, nullptr)) {
/* WideCharToMultiByte failed. Use a default message. */
_snprintf(str, DYNLOAD_ERROR_BUFFER_SIZE,
"DynamicLoader encountered error 0x%X. "
......@@ -372,7 +372,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::SymbolPointer psym;
} result;
result.psym = NULL;
result.psym = nullptr;
if (!lib) {
last_dynamic_err = B_BAD_VALUE;
......@@ -384,7 +384,7 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
get_image_symbol(lib - 1, sym.c_str(), B_SYMBOL_TYPE_ANY, &result.pvoid);
if (rc != B_OK) {
last_dynamic_err = rc;
result.psym = NULL;
result.psym = nullptr;
}
}
return result.psym;
......@@ -412,7 +412,7 @@ namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, NULL);
CHECK_OPEN_FLAGS(flags, 0, nullptr);
char* name = (char*)calloc(1, libname.size() + 1);
dld_init(program_invocation_name);
......@@ -458,7 +458,7 @@ namespace KWSYS_NAMESPACE {
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(
const std::string& libname, int flags)
{
CHECK_OPEN_FLAGS(flags, 0, NULL);
CHECK_OPEN_FLAGS(flags, 0, nullptr);
return dlopen(libname.c_str(), RTLD_LAZY);
}
......
......@@ -65,7 +65,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
for (int i = 0; i < ac; i++) {
this->argv_[i] = strdup(av[i]);
}
this->argv_[ac] = KWSYS_NULLPTR;
this->argv_[ac] = nullptr;
}
Encoding::CommandLineArguments::CommandLineArguments(int ac,
......@@ -75,7 +75,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac,
for (int i = 0; i < ac; i++) {
this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
}
this->argv_[ac] = KWSYS_NULLPTR;
this->argv_[ac] = nullptr;
}
Encoding::CommandLineArguments::~CommandLineArguments()
......@@ -90,7 +90,7 @@ Encoding::CommandLineArguments::CommandLineArguments(
{
this->argv_.resize(other.argv_.size());
for (size_t i = 0; i < this->argv_.size(); i++) {
this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
}
}
......@@ -105,7 +105,7 @@ Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=(
this->argv_.resize(other.argv_.size());
for (i = 0; i < this->argv_.size(); i++) {
this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR;
this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr;
}
}
......@@ -128,8 +128,9 @@ std::wstring Encoding::ToWide(const std::string& str)
{
std::wstring wstr;
# if defined(_WIN32)
const int wlength = MultiByteToWideChar(
KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), int(str.size()), NULL, 0);
const int wlength =
MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
int(str.size()), nullptr, 0);
if (wlength > 0) {
wchar_t* wdata = new wchar_t[wlength];
int r = MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(),
......@@ -162,12 +163,12 @@ std::string Encoding::ToNarrow(const std::wstring& str)
# if defined(_WIN32)
int length =
WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
int(str.size()), NULL, 0, NULL, NULL);
int(str.size()), nullptr, 0, nullptr, nullptr);
if (length > 0) {
char* data = new char[length];
int r =
WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(),
int(str.size()), data, length, NULL, NULL);
int(str.size()), data, length, nullptr, nullptr);
if (r > 0) {
nstr = std::string(data, length);
}
......@@ -193,7 +194,7 @@ std::string Encoding::ToNarrow(const std::wstring& str)
std::wstring Encoding::ToWide(const char* cstr)
{
std::wstring wstr;
size_t length = kwsysEncoding_mbstowcs(KWSYS_NULLPTR, cstr, 0) + 1;
size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1;
if (length > 0) {
std::vector<wchar_t> wchars(length);
if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) {
......@@ -206,7 +207,7 @@ std::wstring Encoding::ToWide(const char* cstr)
std::string Encoding::ToNarrow(const wchar_t* wcstr)
{
std::string str;
size_t length = kwsysEncoding_wcstombs(KWSYS_NULLPTR, wcstr, 0) + 1;
size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1;
if (length > 0) {
std::vector<char> chars(length);
if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) {
......@@ -227,9 +228,9 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source)
/* The +3 is a workaround for a bug in some versions of GetFullPathNameW that
* won't return a large enough buffer size if the input is too small */
wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3;
wfull_len = GetFullPathNameW(wsource.c_str(), 0, nullptr, nullptr) + 3;
std::vector<wchar_t> wfull(wfull_len);
GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL);
GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], nullptr);
/* This should get the correct size without any extra padding from the
* previous size workaround. */
......
......@@ -431,7 +431,7 @@ void Glob::SetRelative(const char* dir)
const char* Glob::GetRelative()
{
if (this->Relative.empty()) {
return KWSYS_NULLPTR;
return nullptr;
}
return this->Relative.c_str();
}
......
......@@ -54,7 +54,7 @@ public:
~Glob();
//! Find all files that match the pattern.
bool FindFiles(const std::string& inexpr, GlobMessages* messages = 0);
bool FindFiles(const std::string& inexpr, GlobMessages* messages = nullptr);
//! Return the list of files that matched.
std::vector<std::string>& GetFiles();
......
......@@ -37,7 +37,7 @@ namespace KWSYS_NAMESPACE {
RegularExpression::RegularExpression(const RegularExpression& rxp)
{
if (!rxp.program) {
this->program = KWSYS_NULLPTR;
this->program = nullptr;
return;
}
int ind;
......@@ -48,7 +48,7 @@ RegularExpression::RegularExpression(const RegularExpression& rxp)
// Copy pointers into last successful "find" operation
this->regmatch = rxp.regmatch;
this->regmust = rxp.regmust; // Copy field
if (rxp.regmust != KWSYS_NULLPTR) {
if (rxp.regmust != nullptr) {
char* dum = rxp.program;
ind = 0;
while (dum != rxp.regmust) {
......@@ -69,7 +69,7 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
return *this;
}
if (!rxp.program) {
this->program = KWSYS_NULLPTR;
this->program = nullptr;
return *this;
}
int ind;
......@@ -81,7 +81,7 @@ RegularExpression& RegularExpression::operator=(const RegularExpression& rxp)
// Copy pointers into last successful "find" operation
this->regmatch = rxp.regmatch;
this->regmust = rxp.regmust; // Copy field
if (rxp.regmust != KWSYS_NULLPTR) {
if (rxp.regmust != nullptr) {
char* dum = rxp.program;
ind = 0;
while (dum != rxp.regmust) {
......@@ -164,8 +164,8 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const
*
* regstart char that must begin a match; '\0' if none obvious
* reganch is the match anchored (at beginning-of-line only)?
* regmust string (pointer into program) that match must include, or NULL
* regmlen length of regmust string
* regmust string (pointer into program) that match must include, or
* nullptr regmlen length of regmust string
*
* Regstart and reganch permit very fast decisions on suitable starting points
* for a match, cutting down the work a lot. Regmust permits fast rejection
......@@ -339,7 +339,7 @@ bool RegularExpression::compile(const char* exp)
const char* longest;
int flags;
if (exp == KWSYS_NULLPTR) {
if (exp == nullptr) {
// RAISE Error, SYM(RegularExpression), SYM(No_Expr),
printf("RegularExpression::compile(): No expression supplied.\n");
return false;
......@@ -367,13 +367,13 @@ bool RegularExpression::compile(const char* exp)
// Allocate space.
//#ifndef _WIN32
if (this->program != KWSYS_NULLPTR)
if (this->program != nullptr)
delete[] this->program;
//#endif
this->program = new char[comp.regsize];
this->progsize = static_cast<int>(comp.regsize);
if (this->program == KWSYS_NULLPTR) {
if (this->program == nullptr) {
// RAISE Error, SYM(RegularExpression), SYM(Out_Of_Memory),
printf("RegularExpression::compile(): Out of memory.\n");
return false;
......@@ -389,7 +389,7 @@ bool RegularExpression::compile(const char* exp)
// Dig out information for optimizations.
this->regstart = '\0'; // Worst-case defaults.
this->reganch = 0;
this->regmust = KWSYS_NULLPTR;
this->regmust = nullptr;
this->regmlen = 0;
scan = this->program + 1; // First BRANCH.
if (OP(regnext(scan)) == END) { // Only one top-level choice.
......@@ -410,9 +410,9 @@ bool RegularExpression::compile(const char* exp)
// absence of others.
//
if (flags & SPSTART) {
longest = KWSYS_NULLPTR;
longest = nullptr;
size_t len = 0;
for (; scan != KWSYS_NULLPTR; scan = regnext(scan))
for (; scan != nullptr; scan = regnext(scan))
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
longest = OPERAND(scan);
len = strlen(OPERAND(scan));
......@@ -448,19 +448,19 @@ char* RegExpCompile::reg(int paren, int* flagp)
if (regnpar >= RegularExpressionMatch::NSUBEXP) {
// RAISE Error, SYM(RegularExpression), SYM(Too_Many_Parens),
printf("RegularExpression::compile(): Too many parentheses.\n");
return KWSYS_NULLPTR;
return nullptr;
}
parno = regnpar;
regnpar++;
ret = regnode(static_cast<char>(OPEN + parno));
} else
ret = KWSYS_NULLPTR;
ret = nullptr;
// Pick up the branches, linking them together.
br = regbranch(&flags);
if (br == KWSYS_NULLPTR)
return (KWSYS_NULLPTR);
if (ret != KWSYS_NULLPTR)
if (br == nullptr)
return (nullptr);
if (ret != nullptr)
regtail(ret, br); // OPEN -> first.
else
ret = br;
......@@ -470,8 +470,8 @@ char* RegExpCompile::reg(int paren, int* flagp)
while (*regparse == '|') {
regparse++;
br = regbranch(&flags);
if (br == KWSYS_NULLPTR)
return (KWSYS_NULLPTR);
if (br == nullptr)
return (nullptr);
regtail(ret, br); // BRANCH -> BRANCH.
if (!(flags & HASWIDTH))
*flagp &= ~HASWIDTH;
......@@ -483,23 +483,23 @@ char* RegExpCompile::reg(int paren, int* flagp)
regtail(ret, ender);
// Hook the tails of the branches to the closing node.
for (br = ret; br != KWSYS_NULLPTR; br = regnext(br))
for (br = ret; br != nullptr; br = regnext(br))
regoptail(br, ender);
// Check for proper termination.
if (paren && *regparse++ != ')') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
printf("RegularExpression::compile(): Unmatched parentheses.\n");
return KWSYS_NULLPTR;
return nullptr;
} else if (!paren && *regparse != '\0') {
if (*regparse == ')') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
printf("RegularExpression::compile(): Unmatched parentheses.\n");
return KWSYS_NULLPTR;
return nullptr;
} else {
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n");
return KWSYS_NULLPTR;
return nullptr;
}
// NOTREACHED
}
......@@ -521,19 +521,19 @@ char* RegExpCompile::regbranch(int* flagp)
*flagp = WORST; // Tentatively.
ret = regnode(BRANCH);
chain = KWSYS_NULLPTR;
chain = nullptr;
while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
latest = regpiece(&flags);
if (latest == KWSYS_NULLPTR)
return (KWSYS_NULLPTR);
if (latest == nullptr)
return (nullptr);
*flagp |= flags & HASWIDTH;
if (chain == KWSYS_NULLPTR) // First piece.
if (chain == nullptr) // First piece.
*flagp |= flags & SPSTART;
else
regtail(chain, latest);
chain = latest;
}
if (chain == KWSYS_NULLPTR) // Loop ran zero times.
if (chain == nullptr) // Loop ran zero times.
regnode(NOTHING);
return (ret);
......@@ -556,8 +556,8 @@ char* RegExpCompile::regpiece(int* flagp)
int flags;
ret = regatom(&flags);
if (ret == KWSYS_NULLPTR)
return (KWSYS_NULLPTR);
if (ret == nullptr)
return (nullptr);
op = *regparse;
if (!ISMULT(op)) {
......@@ -568,7 +568,7 @@ char* RegExpCompile::regpiece(int* flagp)
if (!(flags & HASWIDTH) && op != '?') {
// RAISE Error, SYM(RegularExpression), SYM(Empty_Operand),
printf("RegularExpression::compile() : *+ operand could be empty.\n");
return KWSYS_NULLPTR;
return nullptr;
}
*flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH);
......@@ -602,7 +602,7 @@ char* RegExpCompile::regpiece(int* flagp)
if (ISMULT(*regparse)) {
// RAISE Error, SYM(RegularExpression), SYM(Nested_Operand),
printf("RegularExpression::compile(): Nested *?+.\n");
return KWSYS_NULLPTR;
return nullptr;
}
return (ret);
}
......@@ -655,7 +655,7 @@ char* RegExpCompile::regatom(int* flagp)
if (rxpclass > rxpclassend + 1) {
// RAISE Error, SYM(RegularExpression), SYM(Invalid_Range),
printf("RegularExpression::compile(): Invalid range in [].\n");
return KWSYS_NULLPTR;
return nullptr;
}
for (; rxpclass <= rxpclassend; rxpclass++)
regc(static_cast<char>(rxpclass));
......@@ -668,15 +668,15 @@ char* RegExpCompile::regatom(int* flagp)
if (*regparse != ']') {
// RAISE Error, SYM(RegularExpression), SYM(Unmatched_Bracket),
printf("RegularExpression::compile(): Unmatched [].\n");
return KWSYS_NULLPTR;
return nullptr;
}
regparse++;
*flagp |= HASWIDTH | SIMPLE;
} break;
case '(':
ret = reg(1, &flags);
if (ret == KWSYS_NULLPTR)
return (KWSYS_NULLPTR);
if (ret == nullptr)
return (nullptr);
*flagp |= flags & (HASWIDTH | SPSTART);
break;
case '\0':
......@@ -684,18 +684,18 @@ char* RegExpCompile::regatom(int* flagp)
case ')':
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n"); // Never here
return KWSYS_NULLPTR;
return nullptr;
case '?':
case '+':
case '*':
// RAISE Error, SYM(RegularExpression), SYM(No_Operand),
printf("RegularExpression::compile(): ?+* follows nothing.\n");
return KWSYS_NULLPTR;
return nullptr;
case '\\':
if (*regparse == '\0') {
// RAISE Error, SYM(RegularExpression), SYM(Trailing_Backslash),
printf("RegularExpression::compile(): Trailing backslash.\n");
return KWSYS_NULLPTR;
return nullptr;
}
ret = regnode(EXACTLY);
regc(*regparse++);
......@@ -711,7 +711,7 @@ char* RegExpCompile::regatom(int* flagp)
if (len <= 0) {
// RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
printf("RegularExpression::compile(): Internal error.\n");
return KWSYS_NULLPTR;
return nullptr;
}
ender = *(regparse + len);
if (len > 1 && ISMULT(ender))
......@@ -809,7 +809,7 @@ void RegExpCompile::regtail(char* p, const char* val)
scan = p;
for (;;) {
temp = regnext(scan);
if (temp == KWSYS_NULLPTR)
if (temp == nullptr)
break;
scan = temp;
}
......@@ -828,7 +828,7 @@ void RegExpCompile::regtail(char* p, const char* val)
void RegExpCompile::regoptail(char* p, const char* val)
{
// "Operandless" and "op != BRANCH" are synonymous in practice.
if (p == KWSYS_NULLPTR || p == regdummyptr || OP(p) != BRANCH)
if (p == nullptr || p == regdummyptr || OP(p) != BRANCH)
return;
regtail(OPERAND(p), val);