[LyX/master] Fix warnings in support/.
Richard Kimberly Heck
rikiheck at lyx.org
Sat Feb 29 04:45:29 UTC 2020
commit 99bf96c56b27f2efc368cf61000b34f21adfc9e4
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date: Sat Feb 29 00:00:47 2020 -0500
Fix warnings in support/.
---
src/support/ForkedCalls.cpp | 2 +-
src/support/convert.cpp | 14 +++++++-------
src/support/docstream.cpp | 2 +-
src/support/filetools.cpp | 2 +-
src/support/gzstream.cpp | 10 +++++-----
src/support/lassert.cpp | 5 +++--
src/support/lyxtime.cpp | 2 +-
7 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/support/ForkedCalls.cpp b/src/support/ForkedCalls.cpp
index f81c1d2..1318bd3 100644
--- a/src/support/ForkedCalls.cpp
+++ b/src/support/ForkedCalls.cpp
@@ -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)) {
diff --git a/src/support/convert.cpp b/src/support/convert.cpp
index 9455643..74b1282 100644
--- a/src/support/convert.cpp
+++ b/src/support/convert.cpp
@@ -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);
}
diff --git a/src/support/docstream.cpp b/src/support/docstream.cpp
index f8964ca..eef5b03 100644
--- a/src/support/docstream.cpp
+++ b/src/support/docstream.cpp
@@ -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") {
diff --git a/src/support/filetools.cpp b/src/support/filetools.cpp
index a34ee22..d17d04c 100644
--- a/src/support/filetools.cpp
+++ b/src/support/filetools.cpp
@@ -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));
diff --git a/src/support/gzstream.cpp b/src/support/gzstream.cpp
index dfad995..232e86b 100644
--- a/src/support/gzstream.cpp
+++ b/src/support/gzstream.cpp
@@ -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
diff --git a/src/support/lassert.cpp b/src/support/lassert.cpp
index c690dbc..2634749 100644
--- a/src/support/lassert.cpp
+++ b/src/support/lassert.cpp
@@ -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);
diff --git a/src/support/lyxtime.cpp b/src/support/lyxtime.cpp
index f3318eb..c155ed4 100644
--- a/src/support/lyxtime.cpp
+++ b/src/support/lyxtime.cpp
@@ -27,7 +27,7 @@ namespace support {
time_t current_time()
{
- return time(0);
+ return time(nullptr);
}
More information about the lyx-cvs
mailing list