diff options
author | Neil <nyamatongwe@gmail.com> | 2014-01-21 15:52:16 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2014-01-21 15:52:16 +1100 |
commit | 3f3622f7a40498a65f6473534d1bdf16fe39f591 (patch) | |
tree | 6b20565fc6a0a3c9028eefce6a7737462eb5451a | |
parent | 7b410c1479d5add4f266ee9325bc2d831a202945 (diff) | |
download | scintilla-mirror-3f3622f7a40498a65f6473534d1bdf16fe39f591.tar.gz |
Using ELEMENTS for clarity and safety. Avoid memset for safety.
-rw-r--r-- | gtk/PlatGTK.cxx | 4 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 9a5e0e2d2..c1e5566e5 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -227,7 +227,7 @@ Point Point::FromLong(long lpoint) { } static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, float size, int weight, bool italic) { - memset(&lf, 0, sizeof(lf)); + lf = LOGFONT(); lf.size = size; lf.weight = weight; lf.italic = italic; @@ -735,7 +735,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi Point(rc.left, rc.bottom - 2), Point(rc.left, rc.top + 2), }; - Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore, back); + Polygon(pts, ELEMENTS(pts), fore, back); } else { RectangleDraw(rc, fore, back); } diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index f2efd84fc..ee0758bcd 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -31,6 +31,7 @@ #ifdef SCI_LEXER #include "SciLexer.h" #endif +#include "StringCopy.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" @@ -338,14 +339,14 @@ static const GtkTargetEntry clipboardCopyTargets[] = { { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, { (gchar *) "STRING", 0, TARGET_STRING }, }; -static const gint nClipboardCopyTargets = sizeof(clipboardCopyTargets) / sizeof(clipboardCopyTargets[0]); +static const gint nClipboardCopyTargets = ELEMENTS(clipboardCopyTargets); static const GtkTargetEntry clipboardPasteTargets[] = { { (gchar *) "text/uri-list", 0, TARGET_URI }, { (gchar *) "UTF8_STRING", 0, TARGET_UTF8_STRING }, { (gchar *) "STRING", 0, TARGET_STRING }, }; -static const gint nClipboardPasteTargets = sizeof(clipboardPasteTargets) / sizeof(clipboardPasteTargets[0]); +static const gint nClipboardPasteTargets = ELEMENTS(clipboardPasteTargets); static GtkWidget *PWidget(Window &w) { return reinterpret_cast<GtkWidget *>(w.GetID()); |