1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-16 04:42:53 +08:00

Fix warnings: zero as null pointer constant

Fix more warnings: zero as null pointer constant
This commit is contained in:
Stefan Gerlach 2023-07-26 10:05:36 +02:00 committed by Daniel Nicoletti
parent 8c9e89d3f1
commit fbf2c37e64
22 changed files with 103 additions and 47 deletions

View File

@ -56,7 +56,7 @@ public:
public: public:
void addSeries(const CellRange &range, void addSeries(const CellRange &range,
AbstractSheet *sheet = NULL, AbstractSheet *sheet = nullptr,
bool headerH = false, bool headerH = false,
bool headerV = false, bool headerV = false,
bool swapHeaders = false); bool swapHeaders = false);

View File

@ -121,7 +121,7 @@ private:
private: private:
bool saveToXml(QXmlStreamWriter &writer) const; bool saveToXml(QXmlStreamWriter &writer) const;
bool loadFromXml(QXmlStreamReader &reader, Styles *styles = NULL); bool loadFromXml(QXmlStreamReader &reader, Styles *styles = nullptr);
QSharedDataPointer<ConditionalFormattingPrivate> d; QSharedDataPointer<ConditionalFormattingPrivate> d;
}; };

View File

@ -16,7 +16,9 @@ AbstractSheetPrivate::AbstractSheetPrivate(AbstractSheet *p, AbstractSheet::Crea
sheetState = AbstractSheet::SS_Visible; sheetState = AbstractSheet::SS_Visible;
} }
AbstractSheetPrivate::~AbstractSheetPrivate() {} AbstractSheetPrivate::~AbstractSheetPrivate()
{
}
/*! /*!
\class AbstractSheet \class AbstractSheet

View File

@ -85,7 +85,7 @@ Cell::Cell(const Cell *const cell)
*/ */
Cell::~Cell() Cell::~Cell()
{ {
if (NULL != d_ptr) if (nullptr != d_ptr)
delete d_ptr; delete d_ptr;
} }

View File

@ -40,7 +40,9 @@ CellFormulaPrivate::CellFormulaPrivate(const CellFormulaPrivate &other)
{ {
} }
CellFormulaPrivate::~CellFormulaPrivate() {} CellFormulaPrivate::~CellFormulaPrivate()
{
}
/*! /*!
\class CellFormula \class CellFormula
@ -110,7 +112,9 @@ CellFormula &CellFormula::operator=(const CellFormula &other)
/*! /*!
* Destroys this formula. * Destroys this formula.
*/ */
CellFormula::~CellFormula() {} CellFormula::~CellFormula()
{
}
/*! /*!
* Returns the type of the formula. * Returns the type of the formula.

View File

@ -106,7 +106,9 @@ CellRange::CellRange(const CellRange &other)
/*! /*!
Destroys the range. Destroys the range.
*/ */
CellRange::~CellRange() {} CellRange::~CellRange()
{
}
/*! /*!
Convert the range to string notation, such as "A1:B5". Convert the range to string notation, such as "A1:B5".

View File

@ -127,7 +127,9 @@ CellReference::CellReference(const CellReference &other)
/*! /*!
Destroys the Reference. Destroys the Reference.
*/ */
CellReference::~CellReference() {} CellReference::~CellReference()
{
}
/*! /*!
Convert the Reference to string notation, such as "A1" or "$A$1". Convert the Reference to string notation, such as "A1" or "$A$1".

View File

@ -20,7 +20,9 @@ ChartPrivate::ChartPrivate(Chart *q, Chart::CreateFlag flag)
{ {
} }
ChartPrivate::~ChartPrivate() {} ChartPrivate::~ChartPrivate()
{
}
/*! /*!
* \internal * \internal
@ -42,7 +44,9 @@ Chart::Chart(AbstractSheet *parent, CreateFlag flag)
/*! /*!
* Destroys the chart. * Destroys the chart.
*/ */
Chart::~Chart() {} Chart::~Chart()
{
}
/*! /*!
* Add the data series which is in the range \a range of the \a sheet. * Add the data series which is in the range \a range of the \a sheet.
@ -1320,7 +1324,7 @@ bool ChartPrivate::loadXmlAxisValAx(QXmlStreamReader &reader)
*/ */
bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis *axis) bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis *axis)
{ {
Q_ASSERT(NULL != axis); Q_ASSERT(nullptr != axis);
Q_ASSERT(reader.name().endsWith(QLatin1String("Ax"))); Q_ASSERT(reader.name().endsWith(QLatin1String("Ax")));
QString name = reader.name().toString(); // QString name = reader.name().toString(); //
@ -1999,7 +2003,7 @@ QString ChartPrivate::GetAxisPosString(XlsxAxis::AxisPos axisPos) const
QString ChartPrivate::GetAxisName(XlsxAxis *axis) const QString ChartPrivate::GetAxisName(XlsxAxis *axis) const
{ {
QString strAxisName; QString strAxisName;
if (NULL == axis) if (nullptr == axis)
return strAxisName; return strAxisName;
QString pos = GetAxisPosString(axis->axisPos); // l, t, r, b QString pos = GetAxisPosString(axis->axisPos); // l, t, r, b

View File

@ -18,11 +18,13 @@ QT_BEGIN_NAMESPACE_XLSX
ChartsheetPrivate::ChartsheetPrivate(Chartsheet *p, Chartsheet::CreateFlag flag) ChartsheetPrivate::ChartsheetPrivate(Chartsheet *p, Chartsheet::CreateFlag flag)
: AbstractSheetPrivate(p, flag) : AbstractSheetPrivate(p, flag)
, chart(0) , chart(nullptr)
{ {
} }
ChartsheetPrivate::~ChartsheetPrivate() {} ChartsheetPrivate::~ChartsheetPrivate()
{
}
/*! /*!
\class Chartsheet \class Chartsheet
@ -66,13 +68,15 @@ Chartsheet *Chartsheet::copy(const QString &distName, int distId) const
//: Todo //: Todo
Q_UNUSED(distName) Q_UNUSED(distName)
Q_UNUSED(distId) Q_UNUSED(distId)
return 0; return nullptr;
} }
/*! /*!
* Destroys this workssheet. * Destroys this workssheet.
*/ */
Chartsheet::~Chartsheet() {} Chartsheet::~Chartsheet()
{
}
/*! /*!
* Returns the chart object of the sheet. * Returns the chart object of the sheet.

View File

@ -14,7 +14,9 @@
QT_BEGIN_NAMESPACE_XLSX QT_BEGIN_NAMESPACE_XLSX
ConditionalFormattingPrivate::ConditionalFormattingPrivate() {} ConditionalFormattingPrivate::ConditionalFormattingPrivate()
{
}
ConditionalFormattingPrivate::ConditionalFormattingPrivate( ConditionalFormattingPrivate::ConditionalFormattingPrivate(
const ConditionalFormattingPrivate &other) const ConditionalFormattingPrivate &other)
@ -22,7 +24,9 @@ ConditionalFormattingPrivate::ConditionalFormattingPrivate(
{ {
} }
ConditionalFormattingPrivate::~ConditionalFormattingPrivate() {} ConditionalFormattingPrivate::~ConditionalFormattingPrivate()
{
}
void ConditionalFormattingPrivate::writeCfVo(QXmlStreamWriter &writer, void ConditionalFormattingPrivate::writeCfVo(QXmlStreamWriter &writer,
const XlsxCfVoData &cfvo) const const XlsxCfVoData &cfvo) const
@ -151,7 +155,9 @@ ConditionalFormatting &ConditionalFormatting::operator=(const ConditionalFormatt
/*! /*!
* Destroy the object. * Destroy the object.
*/ */
ConditionalFormatting::~ConditionalFormatting() {} ConditionalFormatting::~ConditionalFormatting()
{
}
/*! /*!
* Add a hightlight rule with the given \a type, \a formula1, \a formula2, * Add a hightlight rule with the given \a type, \a formula1, \a formula2,

View File

@ -49,7 +49,9 @@ DataValidationPrivate::DataValidationPrivate(const DataValidationPrivate &other)
{ {
} }
DataValidationPrivate::~DataValidationPrivate() {} DataValidationPrivate::~DataValidationPrivate()
{
}
/*! /*!
* \class DataValidation * \class DataValidation
@ -143,7 +145,9 @@ DataValidation &DataValidation::operator=(const DataValidation &other)
/*! /*!
* Destroy the object. * Destroy the object.
*/ */
DataValidation::~DataValidation() {} DataValidation::~DataValidation()
{
}
/*! /*!
Returns the validation type. Returns the validation type.

View File

@ -9,7 +9,9 @@
QT_BEGIN_NAMESPACE_XLSX QT_BEGIN_NAMESPACE_XLSX
DateType::DateType() {} DateType::DateType()
{
}
/* /*
DateType::DateType(bool is1904) DateType::DateType(bool is1904)

View File

@ -699,7 +699,7 @@ Chart *Document::insertChart(int row, int col, const QSize &size)
{ {
if (Worksheet *sheet = currentWorksheet()) if (Worksheet *sheet = currentWorksheet())
return sheet->insertChart(row, col, size); return sheet->insertChart(row, col, size);
return 0; return nullptr;
} }
/*! /*!
@ -1012,7 +1012,7 @@ Cell *Document::cellAt(const CellReference &pos) const
{ {
if (Worksheet *sheet = currentWorksheet()) if (Worksheet *sheet = currentWorksheet())
return sheet->cellAt(pos); return sheet->cellAt(pos);
return 0; return nullptr;
} }
/*! /*!
@ -1025,7 +1025,7 @@ Cell *Document::cellAt(int row, int col) const
{ {
if (Worksheet *sheet = currentWorksheet()) if (Worksheet *sheet = currentWorksheet())
return sheet->cellAt(row, col); return sheet->cellAt(row, col);
return 0; return nullptr;
} }
/*! /*!
@ -1209,7 +1209,7 @@ Worksheet *Document::currentWorksheet() const
if (st && st->sheetType() == AbstractSheet::ST_WorkSheet) if (st && st->sheetType() == AbstractSheet::ST_WorkSheet)
return static_cast<Worksheet *>(st); return static_cast<Worksheet *>(st);
else else
return 0; return nullptr;
} }
/*! /*!

View File

@ -57,7 +57,9 @@ DrawingAnchor::DrawingAnchor(Drawing *drawing, ObjectType objectType)
m_id = m_drawing->anchors.size(); // must be unique in one drawing{x}.xml file. m_id = m_drawing->anchors.size(); // must be unique in one drawing{x}.xml file.
} }
DrawingAnchor::~DrawingAnchor() {} DrawingAnchor::~DrawingAnchor()
{
}
void DrawingAnchor::setObjectPicture(const QImage &img) void DrawingAnchor::setObjectPicture(const QImage &img)
{ {
@ -898,9 +900,11 @@ void DrawingAnchor::saveXmlObjectShape(QXmlStreamWriter &writer) const
writer.writeStartElement(QStringLiteral("a:blip")); writer.writeStartElement(QStringLiteral("a:blip"));
writer.writeAttribute( writer.writeAttribute(
QStringLiteral("r:embed"), QStringLiteral("r:embed"),
QStringLiteral("rId%1").arg(m_drawing->relationships()->count())); // sp_blip_rembed QStringLiteral("rId%1").arg(
// QStringLiteral("rId%1").arg(m_drawing->relationships()->count()) m_drawing->relationships()
// can't made new pic ->count())); // sp_blip_rembed
// QStringLiteral("rId%1").arg(m_drawing->relationships()->count())
// can't made new pic
writer.writeAttribute( writer.writeAttribute(
QStringLiteral("xmlns:r"), QStringLiteral("xmlns:r"),
QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships")); QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships"));

View File

@ -58,7 +58,9 @@ FormatPrivate::FormatPrivate(const FormatPrivate &other)
{ {
} }
FormatPrivate::~FormatPrivate() {} FormatPrivate::~FormatPrivate()
{
}
/*! /*!
* \class Format * \class Format
@ -202,7 +204,9 @@ Format &Format::operator=(const Format &other)
/*! /*!
* Destroys this format. * Destroys this format.
*/ */
Format::~Format() {} Format::~Format()
{
}
/*! /*!
* Returns the number format identifier. * Returns the number format identifier.

View File

@ -17,7 +17,9 @@ const QLatin1String schema_msPackage("http://schemas.microsoft.com/office/2006/r
const QLatin1String schema_package("http://schemas.openxmlformats.org/package/2006/relationships"); const QLatin1String schema_package("http://schemas.openxmlformats.org/package/2006/relationships");
// const QString schema_worksheet = // const QString schema_worksheet =
// QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships"); // QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
Relationships::Relationships() {} Relationships::Relationships()
{
}
QList<XlsxRelationship> Relationships::documentRelationships(const QString &relativeType) const QList<XlsxRelationship> Relationships::documentRelationships(const QString &relativeType) const
{ {

View File

@ -26,7 +26,9 @@ RichStringPrivate::RichStringPrivate(const RichStringPrivate &other)
{ {
} }
RichStringPrivate::~RichStringPrivate() {} RichStringPrivate::~RichStringPrivate()
{
}
/*! /*!
\class RichString \class RichString
@ -62,7 +64,9 @@ RichString::RichString(const RichString &other)
/*! /*!
Destructs the string. Destructs the string.
*/ */
RichString::~RichString() {} RichString::~RichString()
{
}
/*! /*!
Assigns \a other to this string and returns a reference to this string Assigns \a other to this string and returns a reference to this string

View File

@ -69,7 +69,9 @@ Styles::Styles(CreateFlag flag)
} }
} }
Styles::~Styles() {} Styles::~Styles()
{
}
Format Styles::xfFormat(int idx) const Format Styles::xfFormat(int idx) const
{ {

View File

@ -55,7 +55,9 @@ Workbook::Workbook(CreateFlag flag)
{ {
} }
Workbook::~Workbook() {} Workbook::~Workbook()
{
}
bool Workbook::isDate1904() const bool Workbook::isDate1904() const
{ {
@ -193,7 +195,7 @@ AbstractSheet *Workbook::addSheet(const QString &name, int sheetId, AbstractShee
if (sheetId > d->last_sheet_id) if (sheetId > d->last_sheet_id)
d->last_sheet_id = sheetId; d->last_sheet_id = sheetId;
AbstractSheet *sheet = NULL; AbstractSheet *sheet = nullptr;
if (type == AbstractSheet::ST_WorkSheet) { if (type == AbstractSheet::ST_WorkSheet) {
// create work sheet (value sheet) // create work sheet (value sheet)
sheet = new Worksheet(name, sheetId, this, F_LoadFromExists); sheet = new Worksheet(name, sheetId, this, F_LoadFromExists);
@ -217,12 +219,12 @@ AbstractSheet *Workbook::insertSheet(int index, const QString &name, AbstractShe
QString sheetName = createSafeSheetName(name); QString sheetName = createSafeSheetName(name);
if (index > d->last_sheet_id) { if (index > d->last_sheet_id) {
// User tries to insert, where no sheet has gone before. // User tries to insert, where no sheet has gone before.
return 0; return nullptr;
} }
if (!sheetName.isEmpty()) { if (!sheetName.isEmpty()) {
// If user given an already in-used name, we should not continue any more! // If user given an already in-used name, we should not continue any more!
if (d->sheetNames.contains(sheetName)) if (d->sheetNames.contains(sheetName))
return 0; return nullptr;
} else { } else {
if (type == AbstractSheet::ST_WorkSheet) { if (type == AbstractSheet::ST_WorkSheet) {
do { do {
@ -236,13 +238,13 @@ AbstractSheet *Workbook::insertSheet(int index, const QString &name, AbstractShe
} while (d->sheetNames.contains(sheetName)); } while (d->sheetNames.contains(sheetName));
} else { } else {
qWarning("unsupported sheet type."); qWarning("unsupported sheet type.");
return 0; return nullptr;
} }
} }
++d->last_sheet_id; ++d->last_sheet_id;
AbstractSheet *sheet = NULL; AbstractSheet *sheet = nullptr;
if (type == AbstractSheet::ST_WorkSheet) { if (type == AbstractSheet::ST_WorkSheet) {
sheet = new Worksheet(sheetName, d->last_sheet_id, this, F_NewFromScratch); sheet = new Worksheet(sheetName, d->last_sheet_id, this, F_NewFromScratch);
} else if (type == AbstractSheet::ST_ChartSheet) { } else if (type == AbstractSheet::ST_ChartSheet) {
@ -385,7 +387,7 @@ AbstractSheet *Workbook::sheet(int index) const
{ {
Q_D(const Workbook); Q_D(const Workbook);
if (index < 0 || index >= d->sheets.size()) if (index < 0 || index >= d->sheets.size())
return 0; return nullptr;
return d->sheets.at(index).data(); return d->sheets.at(index).data();
} }

View File

@ -59,7 +59,9 @@ WorksheetPrivate::WorksheetPrivate(Worksheet *p, Worksheet::CreateFlag flag)
{ {
} }
WorksheetPrivate::~WorksheetPrivate() {} WorksheetPrivate::~WorksheetPrivate()
{
}
/* /*
Calculate the "spans" attribute of the <row> tag. This is an Calculate the "spans" attribute of the <row> tag. This is an
@ -220,7 +222,9 @@ Worksheet *Worksheet::copy(const QString &distName, int distId) const
/*! /*!
* Destroys this workssheet. * Destroys this workssheet.
*/ */
Worksheet::~Worksheet() {} Worksheet::~Worksheet()
{
}
/*! /*!
* Returns whether sheet is protected. * Returns whether sheet is protected.

View File

@ -18,7 +18,9 @@ ZipReader::ZipReader(QIODevice *device)
init(); init();
} }
ZipReader::~ZipReader() {} ZipReader::~ZipReader()
{
}
void ZipReader::init() void ZipReader::init()
{ {

View File

@ -13,7 +13,9 @@ sat_calc::sat_calc()
: output_line_count(5) : output_line_count(5)
{ {
} }
sat_calc::~sat_calc() {} sat_calc::~sat_calc()
{
}
void sat_calc::get_chromatogram(const QString &chromatogram) void sat_calc::get_chromatogram(const QString &chromatogram)
{ {