Fix warnings in support/.

This commit is contained in:
Richard Kimberly Heck 2020-02-29 00:00:47 -05:00
parent 4460df3292
commit 99bf96c56b
7 changed files with 19 additions and 18 deletions

View File

@ -374,7 +374,7 @@ int ForkedCall::generateChild()
argv.push_back(&*it);
prev = *it;
}
argv.push_back(0);
argv.push_back(nullptr);
// Debug output.
if (lyxerr.debugging(Debug::FILES)) {

View File

@ -179,49 +179,49 @@ docstring convert<docstring>(double d)
template<>
int convert<int>(string const s)
{
return strtol(s.c_str(), 0, 10);
return strtol(s.c_str(), nullptr, 10);
}
template<>
int convert<int>(docstring const s)
{
return strtol(to_ascii(s).c_str(), 0, 10);
return strtol(to_ascii(s).c_str(), nullptr, 10);
}
template<>
unsigned int convert<unsigned int>(string const s)
{
return strtoul(s.c_str(), 0, 10);
return strtoul(s.c_str(), nullptr, 10);
}
template<>
unsigned long convert<unsigned long>(string const s)
{
return strtoul(s.c_str(), 0, 10);
return strtoul(s.c_str(), nullptr, 10);
}
template<>
double convert<double>(string const s)
{
return strtod(s.c_str(), 0);
return strtod(s.c_str(), nullptr);
}
template<>
int convert<int>(char const * cptr)
{
return strtol(cptr, 0, 10);
return strtol(cptr, nullptr, 10);
}
template<>
double convert<double>(char const * cptr)
{
return strtod(cptr, 0);
return strtod(cptr, nullptr);
}

View File

@ -120,7 +120,7 @@ protected:
// As a workaround, we append a nul char in order to force
// a switch to ASCII, and then remove it from output after
// the conversion.
intern_type * from_new = 0;
intern_type * from_new = nullptr;
intern_type const * from_old = from;
size_t extra = 0;
if (*(from_end - 1) >= 0x80 && encoding_ == "ISO-2022-JP") {

View File

@ -110,7 +110,7 @@ bool isBinaryFile(FileName const & filename)
magic_t magic_cookie = magic_open(MAGIC_MIME_ENCODING);
if (magic_cookie) {
bool detected = true;
if (magic_load(magic_cookie, NULL) != 0) {
if (magic_load(magic_cookie, nullptr) != 0) {
LYXERR(Debug::FILES, "isBinaryFile: "
"Could not load magic database - "
<< magic_error(magic_cookie));

View File

@ -51,12 +51,12 @@ namespace GZSTREAM_NAMESPACE {
gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
if ( is_open())
return (gzstreambuf*)0;
return (gzstreambuf*)(nullptr);
mode = open_mode;
// no append nor read/write mode
if ((mode & ios::ate) || (mode & ios::app)
|| ((mode & ios::in) && (mode & ios::out)))
return (gzstreambuf*)0;
return (gzstreambuf*)(nullptr);
char fmode[10];
char* fmodeptr = fmode;
if ( mode & ios::in)
@ -66,8 +66,8 @@ gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
*fmodeptr++ = 'b';
*fmodeptr = '\0';
file = gzopen( name, fmode);
if (file == 0)
return (gzstreambuf*)0;
if (file == nullptr)
return (gzstreambuf*)(nullptr);
opened = 1;
return this;
}
@ -79,7 +79,7 @@ gzstreambuf * gzstreambuf::close() {
if ( gzclose( file) == Z_OK)
return this;
}
return (gzstreambuf*)0;
return (gzstreambuf*)(nullptr);
}
int gzstreambuf::underflow() { // used for input buffer only

View File

@ -111,7 +111,7 @@ docstring printCallStack()
docstring bt;
for (size_t i = 1; i < size && messages != NULL; i++) {
const std::string orig(messages[i]);
char* mangled = 0;
char* mangled = nullptr;
for (char *p = messages[i]; *p; ++p) {
if (*p == '(') {
*p = 0;
@ -122,7 +122,8 @@ docstring printCallStack()
}
}
int status = 0;
const char* demangled = abi::__cxa_demangle(mangled, 0, 0, &status);
const char* demangled =
abi::__cxa_demangle(mangled, nullptr, nullptr, &status);
const QByteArray line = QString("(%1) %2: %3\n").arg(i, 3).arg(messages[i])
.arg(demangled ? demangled : orig.c_str()).toLocal8Bit();
free((void*)demangled);

View File

@ -27,7 +27,7 @@ namespace support {
time_t current_time()
{
return time(0);
return time(nullptr);
}