aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-01-15 11:01:52 +1100
committerNeil <nyamatongwe@gmail.com>2019-01-15 11:01:52 +1100
commite7243a4c941f75c9aebe9b035ef90e5af0ecd7f8 (patch)
treeebcc357ce38b622748b88c2ce6510f5fc65028c3
parent8a5808c87b93c49e1fca9b730b5e8558d4a55228 (diff)
downloadscintilla-mirror-e7243a4c941f75c9aebe9b035ef90e5af0ecd7f8.tar.gz
Backport: Fix use of "0" for nulls and mark methods "noexcept" where simple.
Backport of changeset 7234:f4ff793e7ddd.
-rw-r--r--src/Style.cxx20
-rw-r--r--src/Style.h20
2 files changed, 20 insertions, 20 deletions
diff --git a/src/Style.cxx b/src/Style.cxx
index 2cb82616b..b5f8ca091 100644
--- a/src/Style.cxx
+++ b/src/Style.cxx
@@ -16,27 +16,27 @@
using namespace Scintilla;
-FontAlias::FontAlias() {
+FontAlias::FontAlias() noexcept {
}
-FontAlias::FontAlias(const FontAlias &other) : Font() {
+FontAlias::FontAlias(const FontAlias &other) noexcept : Font() {
SetID(other.fid);
}
FontAlias::~FontAlias() {
- SetID(0);
+ SetID(FontID{});
// ~Font will not release the actual font resource since it is now 0
}
-void FontAlias::MakeAlias(const Font &fontOrigin) {
+void FontAlias::MakeAlias(const Font &fontOrigin) noexcept {
SetID(fontOrigin.GetID());
}
-void FontAlias::ClearFont() {
- SetID(0);
+void FontAlias::ClearFont() noexcept {
+ SetID(FontID{});
}
-bool FontSpecification::operator==(const FontSpecification &other) const {
+bool FontSpecification::operator==(const FontSpecification &other) const noexcept {
return fontName == other.fontName &&
weight == other.weight &&
italic == other.italic &&
@@ -45,7 +45,7 @@ bool FontSpecification::operator==(const FontSpecification &other) const {
extraFontFlag == other.extraFontFlag;
}
-bool FontSpecification::operator<(const FontSpecification &other) const {
+bool FontSpecification::operator<(const FontSpecification &other) const noexcept {
if (fontName != other.fontName)
return fontName < other.fontName;
if (weight != other.weight)
@@ -61,11 +61,11 @@ bool FontSpecification::operator<(const FontSpecification &other) const {
return false;
}
-FontMeasurements::FontMeasurements() {
+FontMeasurements::FontMeasurements() noexcept {
ClearMeasurements();
}
-void FontMeasurements::ClearMeasurements() {
+void FontMeasurements::ClearMeasurements() noexcept {
ascent = 1;
descent = 1;
capitalHeight = 1;
diff --git a/src/Style.h b/src/Style.h
index 7a497b36b..1f7f02fe6 100644
--- a/src/Style.h
+++ b/src/Style.h
@@ -17,7 +17,7 @@ struct FontSpecification {
int size;
int characterSet;
int extraFontFlag;
- FontSpecification() :
+ FontSpecification() noexcept :
fontName(nullptr),
weight(SC_WEIGHT_NORMAL),
italic(false),
@@ -25,22 +25,22 @@ struct FontSpecification {
characterSet(0),
extraFontFlag(0) {
}
- bool operator==(const FontSpecification &other) const;
- bool operator<(const FontSpecification &other) const;
+ bool operator==(const FontSpecification &other) const noexcept;
+ bool operator<(const FontSpecification &other) const noexcept;
};
// Just like Font but only has a copy of the FontID so should not delete it
class FontAlias : public Font {
public:
- FontAlias();
+ FontAlias() noexcept;
// FontAlias objects can not be assigned except for initialization
- FontAlias(const FontAlias &);
+ FontAlias(const FontAlias &) noexcept;
FontAlias(FontAlias &&) = delete;
FontAlias &operator=(const FontAlias &) = delete;
FontAlias &operator=(FontAlias &&) = delete;
~FontAlias() override;
- void MakeAlias(const Font &fontOrigin);
- void ClearFont();
+ void MakeAlias(const Font &fontOrigin) noexcept;
+ void ClearFont() noexcept;
};
struct FontMeasurements {
@@ -50,8 +50,8 @@ struct FontMeasurements {
XYPOSITION aveCharWidth;
XYPOSITION spaceWidth;
int sizeZoomed;
- FontMeasurements();
- void ClearMeasurements();
+ FontMeasurements() noexcept;
+ void ClearMeasurements() noexcept;
};
/**
@@ -84,7 +84,7 @@ public:
bool visible_, bool changeable_, bool hotspot_);
void ClearTo(const Style &source);
void Copy(Font &font_, const FontMeasurements &fm_);
- bool IsProtected() const { return !(changeable && visible);}
+ bool IsProtected() const noexcept { return !(changeable && visible);}
};
}