qmake: Apply modernize-use-nullptr

Use nullptr instead of 0.

Change-Id: Ib3120b9c424a274a2d4dd4c42ec5d7cd5bdead65
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Alessandro Portale 2018-08-03 00:22:24 +02:00
parent 182aca8487
commit a959a0e206
25 changed files with 75 additions and 75 deletions

View File

@ -829,7 +829,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"), ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"),
&frameworkdirs = project->values("QMAKE_FRAMEWORKPATH"); &frameworkdirs = project->values("QMAKE_FRAMEWORKPATH");
static const char * const libs[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 }; static const char * const libs[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; libs[i]; i++) { for (int i = 0; libs[i]; i++) {
tmp = project->values(libs[i]); tmp = project->values(libs[i]);
for(int x = 0; x < tmp.count();) { for(int x = 0; x < tmp.count();) {
@ -1422,7 +1422,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
testHost.append("Contents/MacOS/"); testHost.append("Contents/MacOS/");
testHost.append(targetName); testHost.append(targetName);
static const char * const configs[] = { "Debug", "Release", 0 }; static const char * const configs[] = { "Debug", "Release", nullptr };
for (int i = 0; configs[i]; i++) { for (int i = 0; configs[i]; i++) {
QString testBundleBuildConfig = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_" + configs[i]); QString testBundleBuildConfig = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_" + configs[i]);
t << "\t\t" << testBundleBuildConfig << " = {\n" t << "\t\t" << testBundleBuildConfig << " = {\n"

View File

@ -96,7 +96,7 @@ bool MakefileGenerator::mkdir(const QString &in_path) const
// ** base makefile generator // ** base makefile generator
MakefileGenerator::MakefileGenerator() : MakefileGenerator::MakefileGenerator() :
no_io(false), project(0) no_io(false), project(nullptr)
{ {
} }
@ -164,7 +164,7 @@ MakefileGenerator::initOutPaths()
v["PRECOMPILED_DIR"] = v["OBJECTS_DIR"]; v["PRECOMPILED_DIR"] = v["OBJECTS_DIR"];
static const char * const dirs[] = { "OBJECTS_DIR", "DESTDIR", static const char * const dirs[] = { "OBJECTS_DIR", "DESTDIR",
"SUBLIBS_DIR", "DLLDESTDIR", "SUBLIBS_DIR", "DLLDESTDIR",
"PRECOMPILED_DIR", 0 }; "PRECOMPILED_DIR", nullptr };
for (int x = 0; dirs[x]; x++) { for (int x = 0; dirs[x]; x++) {
const ProKey dkey(dirs[x]); const ProKey dkey(dirs[x]);
if (v[dkey].isEmpty()) if (v[dkey].isEmpty())
@ -424,7 +424,7 @@ MakefileGenerator::init()
} }
incs.append(project->specDir()); incs.append(project->specDir());
const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", 0 }; const char * const cacheKeys[] = { "_QMAKE_STASH_", "_QMAKE_SUPER_CACHE_", nullptr };
for (int i = 0; cacheKeys[i]; ++i) { for (int i = 0; cacheKeys[i]; ++i) {
if (v[cacheKeys[i]].isEmpty()) if (v[cacheKeys[i]].isEmpty())
continue; continue;
@ -614,7 +614,7 @@ MakefileGenerator::init()
//build up a list of compilers //build up a list of compilers
QVector<Compiler> compilers; QVector<Compiler> compilers;
{ {
const char *builtins[] = { "OBJECTS", "SOURCES", "PRECOMPILED_HEADER", 0 }; const char *builtins[] = { "OBJECTS", "SOURCES", "PRECOMPILED_HEADER", nullptr };
for(x = 0; builtins[x]; ++x) { for(x = 0; builtins[x]; ++x) {
Compiler compiler; Compiler compiler;
compiler.variable_in = builtins[x]; compiler.variable_in = builtins[x];
@ -829,7 +829,7 @@ MakefileGenerator::init()
} }
//fix up the target deps //fix up the target deps
static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", 0 }; static const char * const fixpaths[] = { "PRE_TARGETDEPS", "POST_TARGETDEPS", nullptr };
for (int path = 0; fixpaths[path]; path++) { for (int path = 0; fixpaths[path]; path++) {
ProStringList &l = v[fixpaths[path]]; ProStringList &l = v[fixpaths[path]];
for (ProStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { for (ProStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) {
@ -2790,7 +2790,7 @@ MakefileGenerator::writeMakeQmake(QTextStream &t, bool noDummyQmakeAll)
QFileInfo QFileInfo
MakefileGenerator::fileInfo(QString file) const MakefileGenerator::fileInfo(QString file) const
{ {
static QHash<FileInfoCacheKey, QFileInfo> *cache = 0; static QHash<FileInfoCacheKey, QFileInfo> *cache = nullptr;
static QFileInfo noInfo = QFileInfo(); static QFileInfo noInfo = QFileInfo();
if(!cache) { if(!cache) {
cache = new QHash<FileInfoCacheKey, QFileInfo>; cache = new QHash<FileInfoCacheKey, QFileInfo>;

View File

@ -172,7 +172,7 @@ protected:
{ int ret; canExecute(cmdline, &ret); return ret; } { int ret; canExecute(cmdline, &ret); return ret; }
bool canExecute(const QStringList &cmdline, int *argv0) const; bool canExecute(const QStringList &cmdline, int *argv0) const;
inline bool canExecute(const QString &cmdline) const inline bool canExecute(const QString &cmdline) const
{ return canExecute(cmdline.split(' '), 0); } { return canExecute(cmdline.split(' '), nullptr); }
bool mkdir(const QString &dir) const; bool mkdir(const QString &dir) const;
QString mkdir_p_asstring(const QString &dir, bool escape=true) const; QString mkdir_p_asstring(const QString &dir, bool escape=true) const;

View File

@ -81,7 +81,7 @@ const QString
struct SourceDependChildren; struct SourceDependChildren;
struct SourceFile { struct SourceFile {
SourceFile() : deps(0), type(QMakeSourceFileInfo::TYPE_UNKNOWN), SourceFile() : deps(nullptr), type(QMakeSourceFileInfo::TYPE_UNKNOWN),
mocable(0), traversed(0), exists(1), mocable(0), traversed(0), exists(1),
moc_checked(0), dep_checked(0), included_count(0) { } moc_checked(0), dep_checked(0), included_count(0) { }
~SourceFile(); ~SourceFile();
@ -95,8 +95,8 @@ struct SourceFile {
struct SourceDependChildren { struct SourceDependChildren {
SourceFile **children; SourceFile **children;
int num_nodes, used_nodes; int num_nodes, used_nodes;
SourceDependChildren() : children(0), num_nodes(0), used_nodes(0) { } SourceDependChildren() : children(nullptr), num_nodes(0), used_nodes(0) { }
~SourceDependChildren() { if(children) free(children); children = 0; } ~SourceDependChildren() { if (children) free(children); children = nullptr; }
void addChild(SourceFile *s) { void addChild(SourceFile *s) {
if(num_nodes <= used_nodes) { if(num_nodes <= used_nodes) {
num_nodes += 200; num_nodes += 200;
@ -115,10 +115,10 @@ public:
SourceFile *lookupFile(const char *); SourceFile *lookupFile(const char *);
inline SourceFile *lookupFile(const QString &f) { return lookupFile(f.toLatin1().constData()); } inline SourceFile *lookupFile(const QString &f) { return lookupFile(f.toLatin1().constData()); }
inline SourceFile *lookupFile(const QMakeLocalFileName &f) { return lookupFile(f.local().toLatin1().constData()); } inline SourceFile *lookupFile(const QMakeLocalFileName &f) { return lookupFile(f.local().toLatin1().constData()); }
void addFile(SourceFile *, const char *k=0, bool own=true); void addFile(SourceFile *, const char *k = nullptr, bool own = true);
struct SourceFileNode { struct SourceFileNode {
SourceFileNode() : key(0), next(0), file(0), own_file(1) { } SourceFileNode() : key(nullptr), next(nullptr), file(nullptr), own_file(1) { }
~SourceFileNode() { ~SourceFileNode() {
delete [] key; delete [] key;
if(own_file) if(own_file)
@ -135,7 +135,7 @@ SourceFiles::SourceFiles()
{ {
nodes = (SourceFileNode**)malloc(sizeof(SourceFileNode*)*(num_nodes=3037)); nodes = (SourceFileNode**)malloc(sizeof(SourceFileNode*)*(num_nodes=3037));
for(int n = 0; n < num_nodes; n++) for(int n = 0; n < num_nodes; n++)
nodes[n] = 0; nodes[n] = nullptr;
} }
SourceFiles::~SourceFiles() SourceFiles::~SourceFiles()
@ -170,7 +170,7 @@ SourceFile *SourceFiles::lookupFile(const char *file)
if(!strcmp(p->key, file)) if(!strcmp(p->key, file))
return p->file; return p->file;
} }
return 0; return nullptr;
} }
void SourceFiles::addFile(SourceFile *p, const char *k, bool own_file) void SourceFiles::addFile(SourceFile *p, const char *k, bool own_file)
@ -259,11 +259,11 @@ QMakeSourceFileInfo::QMakeSourceFileInfo(const QString &cf)
dep_mode = Recursive; dep_mode = Recursive;
//quick project lookups //quick project lookups
includes = files = 0; includes = files = nullptr;
files_changed = false; files_changed = false;
//buffer //buffer
spare_buffer = 0; spare_buffer = nullptr;
spare_buffer_size = 0; spare_buffer_size = 0;
//cache //cache
@ -281,7 +281,7 @@ QMakeSourceFileInfo::~QMakeSourceFileInfo()
//buffer //buffer
if(spare_buffer) { if(spare_buffer) {
free(spare_buffer); free(spare_buffer);
spare_buffer = 0; spare_buffer = nullptr;
spare_buffer_size = 0; spare_buffer_size = 0;
} }
@ -538,7 +538,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true); const QMakeLocalFileName sourceFile = fixPathForFile(file->file, true);
struct stat fst; struct stat fst;
char *buffer = 0; char *buffer = nullptr;
int buffer_len = 0; int buffer_len = 0;
{ {
int fd; int fd;
@ -588,7 +588,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
} }
for (; x < buffer_len; ++x) { for (; x < buffer_len; ++x) {
bool try_local = true; bool try_local = true;
char *inc = 0; char *inc = nullptr;
if(file->type == QMakeSourceFileInfo::TYPE_UI) { if(file->type == QMakeSourceFileInfo::TYPE_UI) {
// skip whitespaces // skip whitespaces
while (x < buffer_len && (buffer[x] == ' ' || buffer[x] == '\t')) while (x < buffer_len && (buffer[x] == ' ' || buffer[x] == '\t'))
@ -802,7 +802,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file)
if (cpp_state == WantName) if (cpp_state == WantName)
buffer[clean] = '\0'; buffer[clean] = '\0';
else // i.e. malformed else // i.e. malformed
inc = 0; inc = nullptr;
cpp_state = InCode; // hereafter cpp_state = InCode; // hereafter
break; break;
@ -915,7 +915,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file)
file->moc_checked = true; file->moc_checked = true;
int buffer_len = 0; int buffer_len = 0;
char *buffer = 0; char *buffer = nullptr;
{ {
struct stat fst; struct stat fst;
int fd; int fd;

View File

@ -138,7 +138,7 @@ BuildsMetaMakefileGenerator::init()
bool bool
BuildsMetaMakefileGenerator::write() BuildsMetaMakefileGenerator::write()
{ {
Build *glue = 0; Build *glue = nullptr;
if(!makefiles.isEmpty() && !makefiles.first()->build.isNull()) { if(!makefiles.isEmpty() && !makefiles.first()->build.isNull()) {
glue = new Build; glue = new Build;
glue->name = name; glue->name = name;
@ -228,7 +228,7 @@ MakefileGenerator
if (build_proj->read(project->projectFile())) if (build_proj->read(project->projectFile()))
return createMakefileGenerator(build_proj); return createMakefileGenerator(build_proj);
} }
return 0; return nullptr;
} }
class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator
@ -236,7 +236,7 @@ class SubdirsMetaMakefileGenerator : public MetaMakefileGenerator
protected: protected:
bool init_flag; bool init_flag;
struct Subdir { struct Subdir {
Subdir() : makefile(0), indent(0) { } Subdir() : makefile(nullptr), indent(0) { }
~Subdir() { delete makefile; } ~Subdir() { delete makefile; }
QString input_dir; QString input_dir;
QString output_dir, output_file; QString output_dir, output_file;
@ -336,7 +336,7 @@ SubdirsMetaMakefileGenerator::init()
hasError |= !sub->makefile->write(); hasError |= !sub->makefile->write();
delete sub; delete sub;
qmakeClearCaches(); qmakeClearCaches();
sub = 0; sub = nullptr;
Option::output.setFileName(output_name); Option::output.setFileName(output_name);
} }
Option::output_dir = old_output_dir; Option::output_dir = old_output_dir;
@ -412,7 +412,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO)
{ {
Option::postProcessProject(proj); Option::postProcessProject(proj);
MakefileGenerator *mkfile = NULL; MakefileGenerator *mkfile = nullptr;
if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) { if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
mkfile = new ProjectGenerator; mkfile = new ProjectGenerator;
mkfile->setProjectFile(proj); mkfile->setProjectFile(proj);
@ -459,7 +459,7 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na
{ {
Option::postProcessProject(proj); Option::postProcessProject(proj);
MetaMakefileGenerator *ret = 0; MetaMakefileGenerator *ret = nullptr;
if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) {
if (proj->first("TEMPLATE").endsWith("subdirs")) if (proj->first("TEMPLATE").endsWith("subdirs"))

View File

@ -49,7 +49,7 @@ public:
virtual ~MetaMakefileGenerator(); virtual ~MetaMakefileGenerator();
static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = nullptr);
static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false);
inline QMakeProject *projectFile() const { return project; } inline QMakeProject *projectFile() const { return project; }

View File

@ -229,7 +229,7 @@ ProjectGenerator::init()
ProStringList &h = v["HEADERS"]; ProStringList &h = v["HEADERS"];
bool no_qt_files = true; bool no_qt_files = true;
static const char *srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "FORMS", 0 }; static const char *srcs[] = { "SOURCES", "YACCSOURCES", "LEXSOURCES", "FORMS", nullptr };
for (int i = 0; srcs[i]; i++) { for (int i = 0; srcs[i]; i++) {
const ProStringList &l = v[srcs[i]]; const ProStringList &l = v[srcs[i]];
QMakeSourceFileInfo::SourceFileType type = QMakeSourceFileInfo::TYPE_C; QMakeSourceFileInfo::SourceFileType type = QMakeSourceFileInfo::TYPE_C;

View File

@ -420,7 +420,7 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
libdirs.append(QMakeLocalFileName(dlib.toQString())); libdirs.append(QMakeLocalFileName(dlib.toQString()));
frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks")); frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks")); frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 }; static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; lflags[i]; i++) { for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]); ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end(); ) { for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {

View File

@ -346,7 +346,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << mkdir_p_asstring("$(@D)", false) << "\n\t" t << mkdir_p_asstring("$(@D)", false) << "\n\t"
<< "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n"; << "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n";
static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 }; static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", nullptr };
for (int x = 0; src[x]; x++) { for (int x = 0; src[x]; x++) {
const ProStringList &l = project->values(src[x]); const ProStringList &l = project->values(src[x]);
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {

View File

@ -499,7 +499,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
QSet<QString> source_directories; QSet<QString> source_directories;
if (useInferenceRules) { if (useInferenceRules) {
source_directories.insert("."); source_directories.insert(".");
static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", 0 }; static const char * const directories[] = { "UI_SOURCES_DIR", "UI_DIR", nullptr };
for (int y = 0; directories[y]; y++) { for (int y = 0; directories[y]; y++) {
QString dirTemp = project->first(directories[y]).toQString(); QString dirTemp = project->first(directories[y]).toQString();
if (dirTemp.endsWith("\\")) if (dirTemp.endsWith("\\"))
@ -507,7 +507,7 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
if(!dirTemp.isEmpty()) if(!dirTemp.isEmpty())
source_directories.insert(dirTemp); source_directories.insert(dirTemp);
} }
static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", 0 }; static const char * const srcs[] = { "SOURCES", "GENERATED_SOURCES", nullptr };
for (int x = 0; srcs[x]; x++) { for (int x = 0; srcs[x]; x++) {
const ProStringList &l = project->values(srcs[x]); const ProStringList &l = project->values(srcs[x]);
for (ProStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) { for (ProStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) {

View File

@ -2185,7 +2185,7 @@ VCConfiguration::VCConfiguration()
// VCFilter --------------------------------------------------------- // VCFilter ---------------------------------------------------------
VCFilter::VCFilter() VCFilter::VCFilter()
: ParseFiles(unset), : ParseFiles(unset),
Config(0) Config(nullptr)
{ {
useCustomBuildTool = false; useCustomBuildTool = false;
useCompilerTool = false; useCompilerTool = false;

View File

@ -112,7 +112,7 @@ VcprojGenerator::VcprojGenerator()
: Win32MakefileGenerator(), : Win32MakefileGenerator(),
is64Bit(false), is64Bit(false),
customBuildToolFilterFileSuffix(QStringLiteral(".cbt")), customBuildToolFilterFileSuffix(QStringLiteral(".cbt")),
projectWriter(0) projectWriter(nullptr)
{ {
} }
@ -1100,7 +1100,7 @@ void VcprojGenerator::initLinkerTool()
if (!project->values("DEF_FILE").isEmpty()) if (!project->values("DEF_FILE").isEmpty())
conf.linker.ModuleDefinitionFile = project->first("DEF_FILE").toQString(); conf.linker.ModuleDefinitionFile = project->first("DEF_FILE").toQString();
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 }; static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; lflags[i]; i++) { for (int i = 0; lflags[i]; i++) {
const auto libs = fixLibFlags(lflags[i]); const auto libs = fixLibFlags(lflags[i]);
for (const ProString &lib : libs) { for (const ProString &lib : libs) {

View File

@ -77,7 +77,7 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned l
QString rSubkeyName = keyName(rSubkey); QString rSubkeyName = keyName(rSubkey);
QString rSubkeyPath = keyPath(rSubkey); QString rSubkeyPath = keyPath(rSubkey);
HKEY handle = 0; HKEY handle = nullptr;
LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0, LONG res = RegOpenKeyEx(parentHandle, (wchar_t*)rSubkeyPath.utf16(), 0,
KEY_READ | options, &handle); KEY_READ | options, &handle);
@ -87,7 +87,7 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned l
// get the size and type of the value // get the size and type of the value
DWORD dataType; DWORD dataType;
DWORD dataSize; DWORD dataSize;
res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, &dataType, 0, &dataSize); res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), nullptr, &dataType, nullptr, &dataSize);
if (res != ERROR_SUCCESS) { if (res != ERROR_SUCCESS) {
RegCloseKey(handle); RegCloseKey(handle);
return QString(); return QString();
@ -95,7 +95,7 @@ QString qt_readRegistryKey(HKEY parentHandle, const QString &rSubkey, unsigned l
// get the value // get the value
QByteArray data(dataSize, 0); QByteArray data(dataSize, 0);
res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), 0, 0, res = RegQueryValueEx(handle, (wchar_t*)rSubkeyName.utf16(), nullptr, nullptr,
reinterpret_cast<unsigned char*>(data.data()), &dataSize); reinterpret_cast<unsigned char*>(data.data()), &dataSize);
if (res != ERROR_SUCCESS) { if (res != ERROR_SUCCESS) {
RegCloseKey(handle); RegCloseKey(handle);

View File

@ -84,7 +84,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
if (impexts.isEmpty()) if (impexts.isEmpty())
impexts = project->values("QMAKE_EXTENSION_STATICLIB"); impexts = project->values("QMAKE_EXTENSION_STATICLIB");
QList<QMakeLocalFileName> dirs; QList<QMakeLocalFileName> dirs;
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 }; static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
for (int i = 0; lflags[i]; i++) { for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]); ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end();) { for (ProStringList::Iterator it = l.begin(); it != l.end();) {
@ -439,7 +439,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
{ {
t << "clean: compiler_clean " << depVar("CLEAN_DEPS"); t << "clean: compiler_clean " << depVar("CLEAN_DEPS");
{ {
const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", 0 }; const char *clean_targets[] = { "OBJECTS", "QMAKE_CLEAN", "CLEAN_FILES", nullptr };
for(int i = 0; clean_targets[i]; ++i) { for(int i = 0; clean_targets[i]; ++i) {
const ProStringList &list = project->values(clean_targets[i]); const ProStringList &list = project->values(clean_targets[i]);
const QString del_statement("-$(DEL_FILE)"); const QString del_statement("-$(DEL_FILE)");
@ -468,7 +468,7 @@ void Win32MakefileGenerator::writeCleanParts(QTextStream &t)
t << "distclean: clean " << depVar("DISTCLEAN_DEPS"); t << "distclean: clean " << depVar("DISTCLEAN_DEPS");
{ {
const char *clean_targets[] = { "QMAKE_DISTCLEAN", 0 }; const char *clean_targets[] = { "QMAKE_DISTCLEAN", nullptr };
for(int i = 0; clean_targets[i]; ++i) { for(int i = 0; clean_targets[i]; ++i) {
const ProStringList &list = project->values(clean_targets[i]); const ProStringList &list = project->values(clean_targets[i]);
const QString del_statement("-$(DEL_FILE)"); const QString del_statement("-$(DEL_FILE)");

View File

@ -200,7 +200,7 @@ QString IoUtils::shellQuoteWin(const QString &arg)
# if defined(Q_OS_WIN) # if defined(Q_OS_WIN)
static QString windowsErrorCode() static QString windowsErrorCode()
{ {
wchar_t *string = 0; wchar_t *string = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, NULL,
GetLastError(), GetLastError(),
@ -244,7 +244,7 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF
return false; return false;
} }
FILETIME ft; FILETIME ft;
GetFileTime(rHand, 0, 0, &ft); GetFileTime(rHand, NULL, NULL, &ft);
CloseHandle(rHand); CloseHandle(rHand);
HANDLE wHand = CreateFile((wchar_t*)targetFileName.utf16(), HANDLE wHand = CreateFile((wchar_t*)targetFileName.utf16(),
GENERIC_WRITE, FILE_SHARE_READ, GENERIC_WRITE, FILE_SHARE_READ,
@ -253,7 +253,7 @@ bool IoUtils::touchFile(const QString &targetFileName, const QString &referenceF
*errorString = fL1S("Cannot open %1: %2").arg(targetFileName, windowsErrorCode()); *errorString = fL1S("Cannot open %1: %2").arg(targetFileName, windowsErrorCode());
return false; return false;
} }
SetFileTime(wHand, 0, 0, &ft); SetFileTime(wHand, NULL, NULL, &ft);
CloseHandle(wHand); CloseHandle(wHand);
# endif # endif
return true; return true;

View File

@ -78,12 +78,12 @@ public:
int sourceFile() const { return m_file; } int sourceFile() const { return m_file; }
ProString &prepend(const ProString &other); ProString &prepend(const ProString &other);
ProString &append(const ProString &other, bool *pending = 0); ProString &append(const ProString &other, bool *pending = nullptr);
ProString &append(const QString &other) { return append(ProString(other)); } ProString &append(const QString &other) { return append(ProString(other)); }
ProString &append(const QLatin1String other); ProString &append(const QLatin1String other);
ProString &append(const char *other) { return append(QLatin1String(other)); } ProString &append(const char *other) { return append(QLatin1String(other)); }
ProString &append(QChar other); ProString &append(QChar other);
ProString &append(const ProStringList &other, bool *pending = 0, bool skipEmpty1st = false); ProString &append(const ProStringList &other, bool *pending = nullptr, bool skipEmpty1st = false);
ProString &operator+=(const ProString &other) { return append(other); } ProString &operator+=(const ProString &other) { return append(other); }
ProString &operator+=(const QString &other) { return append(other); } ProString &operator+=(const QString &other) { return append(other); }
ProString &operator+=(const QLatin1String other) { return append(other); } ProString &operator+=(const QLatin1String other) { return append(other); }
@ -133,9 +133,9 @@ public:
bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; } bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(s, 0, cs) >= 0; }
bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; } bool contains(const char *s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(QLatin1String(s), 0, cs) >= 0; }
bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; } bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return indexOf(c, 0, cs) >= 0; }
int toLongLong(bool *ok = 0, int base = 10) const { return toQStringRef().toLongLong(ok, base); } int toLongLong(bool *ok = nullptr, int base = 10) const { return toQStringRef().toLongLong(ok, base); }
int toInt(bool *ok = 0, int base = 10) const { return toQStringRef().toInt(ok, base); } int toInt(bool *ok = nullptr, int base = 10) const { return toQStringRef().toInt(ok, base); }
short toShort(bool *ok = 0, int base = 10) const { return toQStringRef().toShort(ok, base); } short toShort(bool *ok = nullptr, int base = 10) const { return toQStringRef().toShort(ok, base); }
uint hash() const { return m_hash; } uint hash() const { return m_hash; }
static uint hash(const QChar *p, int n); static uint hash(const QChar *p, int n);
@ -261,7 +261,7 @@ class ProStringRwUser : public ProStringRoUser
{ {
public: public:
ProStringRwUser(QString &rs) ProStringRwUser(QString &rs)
: ProStringRoUser(rs), m_ps(0) {} : ProStringRoUser(rs), m_ps(nullptr) {}
ProStringRwUser(const ProString &ps, QString &rs) ProStringRwUser(const ProString &ps, QString &rs)
: ProStringRoUser(ps, rs), m_ps(&ps) {} : ProStringRoUser(ps, rs), m_ps(&ps) {}
QString &set(const ProString &ps) { m_ps = &ps; return ProStringRoUser::set(ps); } QString &set(const ProString &ps) { m_ps = &ps; return ProStringRoUser::set(ps); }

View File

@ -1680,7 +1680,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
#endif #endif
case T_INCLUDE: { case T_INCLUDE: {
QString parseInto; QString parseInto;
LoadFlags flags = 0; LoadFlags flags;
if (m_cumulative) if (m_cumulative)
flags = LoadSilent; flags = LoadSilent;
if (args.count() >= 2) { if (args.count() >= 2) {

View File

@ -118,7 +118,7 @@ bool operator==(const QMakeBaseKey &one, const QMakeBaseKey &two)
} }
QMakeBaseEnv::QMakeBaseEnv() QMakeBaseEnv::QMakeBaseEnv()
: evaluator(0) : evaluator(nullptr)
{ {
#ifdef PROEVALUATOR_THREAD_SAFE #ifdef PROEVALUATOR_THREAD_SAFE
inProgress = false; inProgress = false;
@ -215,7 +215,7 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeV
initStatics(); initStatics();
// Configuration, more or less // Configuration, more or less
m_caller = 0; m_caller = nullptr;
#ifdef PROEVALUATOR_CUMULATIVE #ifdef PROEVALUATOR_CUMULATIVE
m_cumulative = false; m_cumulative = false;
#endif #endif
@ -941,7 +941,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
if (varName == statics.strTEMPLATE) if (varName == statics.strTEMPLATE)
setTemplate(); setTemplate();
else if (varName == statics.strQMAKE_PLATFORM) else if (varName == statics.strQMAKE_PLATFORM)
m_featureRoots = 0; m_featureRoots = nullptr;
else if (varName == statics.strQMAKE_DIR_SEP) else if (varName == statics.strQMAKE_DIR_SEP)
m_dirSep = first(varName); m_dirSep = first(varName);
else if (varName == statics.strQMAKESPEC) { else if (varName == statics.strQMAKESPEC) {
@ -950,7 +950,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
if (IoUtils::isAbsolutePath(spec)) { if (IoUtils::isAbsolutePath(spec)) {
m_qmakespec = spec; m_qmakespec = spec;
m_qmakespecName = IoUtils::fileName(m_qmakespec).toString(); m_qmakespecName = IoUtils::fileName(m_qmakespec).toString();
m_featureRoots = 0; m_featureRoots = nullptr;
} }
} }
} }
@ -1594,7 +1594,7 @@ ProFile *QMakeEvaluator::currentProFile() const
{ {
if (m_profileStack.count() > 0) if (m_profileStack.count() > 0)
return m_profileStack.top(); return m_profileStack.top();
return 0; return nullptr;
} }
int QMakeEvaluator::currentFileId() const int QMakeEvaluator::currentFileId() const
@ -1874,7 +1874,7 @@ ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap:
if (first && isFunctParam(variableName)) if (first && isFunctParam(variableName))
break; break;
} }
return 0; return nullptr;
} }
ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName) ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)

View File

@ -282,9 +282,9 @@ public:
#endif #endif
struct Location { struct Location {
Location() : pro(0), line(0) {} Location() : pro(nullptr), line(0) {}
Location(ProFile *_pro, ushort _line) : pro(_pro), line(_line) {} Location(ProFile *_pro, ushort _line) : pro(_pro), line(_line) {}
void clear() { pro = 0; line = 0; } void clear() { pro = nullptr; line = 0; }
ProFile *pro; ProFile *pro;
ushort line; ushort line;
}; };

View File

@ -215,7 +215,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
pro->itemsRef()->squeeze(); pro->itemsRef()->squeeze();
pro->ref(); pro->ref();
} else { } else {
pro = 0; pro = nullptr;
} }
ent->pro = pro; ent->pro = pro;
#ifdef PROPARSER_THREAD_SAFE #ifdef PROPARSER_THREAD_SAFE
@ -234,7 +234,7 @@ ProFile *QMakeParser::parsedProFile(const QString &fileName, ParseFlags flags)
if (readFile(id, flags, &contents)) if (readFile(id, flags, &contents))
pro = parsedProBlock(QStringRef(&contents), id, fileName, 1, FullGrammar); pro = parsedProBlock(QStringRef(&contents), id, fileName, 1, FullGrammar);
else else
pro = 0; pro = nullptr;
} }
return pro; return pro;
} }
@ -437,7 +437,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
if (context == CtxPureValue) { if (context == CtxPureValue) {
end = inend; end = inend;
cptr = 0; cptr = nullptr;
lineCont = false; lineCont = false;
indent = 0; // just gcc being stupid indent = 0; // just gcc being stupid
goto nextChr; goto nextChr;
@ -449,7 +449,7 @@ void QMakeParser::read(ProFile *pro, const QStringRef &in, int line, SubGrammar
// First, skip leading whitespace // First, skip leading whitespace
for (indent = 0; ; ++cur, ++indent) { for (indent = 0; ; ++cur, ++indent) {
if (cur == inend) { if (cur == inend) {
cur = 0; cur = nullptr;
goto flushLine; goto flushLine;
} }
c = *cur; c = *cur;
@ -1112,7 +1112,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
if (uc == ptr) { if (uc == ptr) {
// for(literal) (only "ever" would be legal if qmake was sane) // for(literal) (only "ever" would be legal if qmake was sane)
putTok(tokPtr, TokForLoop); putTok(tokPtr, TokForLoop);
putHashStr(tokPtr, (ushort *)0, (uint)0); putHashStr(tokPtr, nullptr, (uint)0);
putBlockLen(tokPtr, 1 + 3 + nlen + 1); putBlockLen(tokPtr, 1 + 3 + nlen + 1);
putTok(tokPtr, TokHashLiteral); putTok(tokPtr, TokHashLiteral);
putHashStr(tokPtr, uce + 2, nlen); putHashStr(tokPtr, uce + 2, nlen);
@ -1135,7 +1135,7 @@ void QMakeParser::finalizeCall(ushort *&tokPtr, ushort *uc, ushort *ptr, int arg
} else if (argc == 1) { } else if (argc == 1) {
// for(non-literal) (this wouldn't be here if qmake was sane) // for(non-literal) (this wouldn't be here if qmake was sane)
putTok(tokPtr, TokForLoop); putTok(tokPtr, TokForLoop);
putHashStr(tokPtr, (ushort *)0, (uint)0); putHashStr(tokPtr, nullptr, (uint)0);
uc = uce; uc = uce;
goto doFor; goto doFor;
} }

View File

@ -110,7 +110,7 @@ private:
}; };
struct BlockScope { struct BlockScope {
BlockScope() : start(0), braceLevel(0), special(false), inBranch(false), nest(NestNone) {} BlockScope() : start(nullptr), braceLevel(0), special(false), inBranch(false), nest(NestNone) {}
BlockScope(const BlockScope &other) { *this = other; } BlockScope(const BlockScope &other) { *this = other; }
ushort *start; // Where this block started; store length here ushort *start; // Where this block started; store length here
int braceLevel; // Nesting of braces in scope int braceLevel; // Nesting of braces in scope

View File

@ -546,7 +546,7 @@ int runQMake(int argc, char **argv)
exit_val = 5; exit_val = 5;
} }
delete mkfile; delete mkfile;
mkfile = NULL; mkfile = nullptr;
} }
qmakeClearCaches(); qmakeClearCaches();
return exit_val; return exit_val;

View File

@ -507,7 +507,7 @@ QString
Option::fixString(QString string, uchar flags) Option::fixString(QString string, uchar flags)
{ {
//const QString orig_string = string; //const QString orig_string = string;
static QHash<FixStringCacheKey, QString> *cache = 0; static QHash<FixStringCacheKey, QString> *cache = nullptr;
if(!cache) { if(!cache) {
cache = new QHash<FixStringCacheKey, QString>; cache = new QHash<FixStringCacheKey, QString>;
qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FixStringCacheKey, QString> >, (void**)&cache); qmakeAddCacheClear(qmakeDeleteCacheClear<QHash<FixStringCacheKey, QString> >, (void**)&cache);
@ -635,7 +635,7 @@ public:
QMakeCacheClearItem(qmakeCacheClearFunc f, void **d) : func(f), data(d) { } QMakeCacheClearItem(qmakeCacheClearFunc f, void **d) : func(f), data(d) { }
~QMakeCacheClearItem() { ~QMakeCacheClearItem() {
(*func)(*data); (*func)(*data);
*data = 0; *data = nullptr;
} }
}; };
static QList<QMakeCacheClearItem*> cache_items; static QList<QMakeCacheClearItem*> cache_items;

View File

@ -108,7 +108,7 @@ struct Option
}; };
//both of these must be called.. //both of these must be called..
static int init(int argc=0, char **argv=0); //parse cmdline static int init(int argc = 0, char **argv = nullptr); //parse cmdline
static void prepareProject(const QString &pfile); static void prepareProject(const QString &pfile);
static bool postProcessProject(QMakeProject *); static bool postProcessProject(QMakeProject *);

View File

@ -68,7 +68,7 @@ static const struct {
{ "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true, true }, { "QMAKE_XSPEC", QLibraryInfo::TargetSpecPath, true, true },
}; };
QMakeProperty::QMakeProperty() : settings(0) QMakeProperty::QMakeProperty() : settings(nullptr)
{ {
reload(); reload();
} }
@ -99,7 +99,7 @@ void QMakeProperty::reload()
QMakeProperty::~QMakeProperty() QMakeProperty::~QMakeProperty()
{ {
delete settings; delete settings;
settings = 0; settings = nullptr;
} }
void QMakeProperty::initSettings() void QMakeProperty::initSettings()