aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-09-04 11:32:27 +1000
committerNeil <nyamatongwe@gmail.com>2013-09-04 11:32:27 +1000
commit86af455e71ba0cc42e48ca712c3617da3f11c69d (patch)
tree84779f720e905321d3d4c33c924e932fa7201d5b
parentab73f3d64f0c6caae8d7eeb35ae37aa23b5cf3c1 (diff)
downloadscintilla-mirror-86af455e71ba0cc42e48ca712c3617da3f11c69d.tar.gz
Fix namespace compilation errors when SCI_NAMESPACE defined.
-rw-r--r--gtk/PlatGTK.cxx14
-rw-r--r--gtk/ScintillaGTK.cxx18
-rw-r--r--win32/PlatWin.cxx28
3 files changed, 18 insertions, 42 deletions
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 00877f130..427f08ec3 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -890,18 +890,6 @@ static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t
return 1;
}
-static size_t UTF8CharLength(const char *s) {
- const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
- unsigned char ch = *us;
- if (ch < 0x80) {
- return 1;
- } else if (ch < 0x80 + 0x40 + 0x20) {
- return 2;
- } else {
- return 3;
- }
-}
-
void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,
ColourDesired fore) {
PenColour(fore);
@@ -1045,7 +1033,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
positions[i++] = iti.position - (places - place) * iti.distance / places;
positionsCalculated++;
}
- clusterStart += UTF8CharLength(utfForm.c_str()+clusterStart);
+ clusterStart += UTF8CharLength(static_cast<unsigned char>(utfForm.c_str()[clusterStart]));
place++;
}
}
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx
index 25d61d9f2..227a33b3f 100644
--- a/gtk/ScintillaGTK.cxx
+++ b/gtk/ScintillaGTK.cxx
@@ -89,15 +89,6 @@ static GdkWindow *WindowFromWidget(GtkWidget *w) {
#endif
}
-static GdkWindow *PWindow(const Window &w) {
- GtkWidget *widget = reinterpret_cast<GtkWidget *>(w.GetID());
-#if GTK_CHECK_VERSION(3,0,0)
- return gtk_widget_get_window(widget);
-#else
- return widget->window;
-#endif
-}
-
#ifdef _MSC_VER
// Constant conditional expressions are because of GTK+ headers
#pragma warning(disable: 4127)
@@ -111,6 +102,15 @@ static GdkWindow *PWindow(const Window &w) {
using namespace Scintilla;
#endif
+static GdkWindow *PWindow(const Window &w) {
+ GtkWidget *widget = reinterpret_cast<GtkWidget *>(w.GetID());
+#if GTK_CHECK_VERSION(3,0,0)
+ return gtk_widget_get_window(widget);
+#else
+ return widget->window;
+#endif
+}
+
extern std::string UTF8FromLatin1(const char *s, int len);
class ScintillaGTK : public ScintillaBase {
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 0b57037af..0c690fd7c 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -103,14 +103,14 @@ static BOOL (WINAPI *GetMonitorInfoFn)(HMONITOR, LPMONITORINFO) = 0;
static HCURSOR reverseArrowCursor = NULL;
+#ifdef SCI_NAMESPACE
+namespace Scintilla {
+#endif
+
bool IsNT() {
return onNT;
}
-#ifdef SCI_NAMESPACE
-using namespace Scintilla;
-#endif
-
Point Point::FromLong(long lpoint) {
return Point(static_cast<short>(LOWORD(lpoint)), static_cast<short>(HIWORD(lpoint)));
}
@@ -498,10 +498,6 @@ public:
};
typedef VarBuffer<XYPOSITION, stackBufferLength> TextPositions;
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
class SurfaceGDI : public Surface {
bool unicodeMode;
HDC hdc;
@@ -574,10 +570,6 @@ public:
void SetDBCSMode(int codePage_);
};
-#ifdef SCI_NAMESPACE
-} //namespace Scintilla
-#endif
-
SurfaceGDI::SurfaceGDI() :
unicodeMode(false),
hdc(0), hdcOwned(false),
@@ -1147,10 +1139,6 @@ void SurfaceGDI::SetDBCSMode(int codePage_) {
#if defined(USE_D2D)
-#ifdef SCI_NAMESPACE
-namespace Scintilla {
-#endif
-
class SurfaceD2D : public Surface {
bool unicodeMode;
int x, y;
@@ -1230,10 +1218,6 @@ public:
void SetDBCSMode(int codePage_);
};
-#ifdef SCI_NAMESPACE
-} //namespace Scintilla
-#endif
-
SurfaceD2D::SurfaceD2D() :
unicodeMode(false),
x(0), y(0) {
@@ -3262,3 +3246,7 @@ void Platform_Finalise() {
ListBoxX_Unregister();
::DeleteCriticalSection(&crPlatformLock);
}
+
+#ifdef SCI_NAMESPACE
+}
+#endif