summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2014-07-16 14:44:05 +0900
committerDaiki Ueno <ueno@gnu.org>2014-07-16 14:44:05 +0900
commit74660d84d923fd8252b166770ca2403f6025a7ac (patch)
treed137a32d62ad19c33bf4750ee6db32f4c3508a7f
parent037a830b500e5640335b2a45ccd52510fc5dc88b (diff)
Revert 2014-07-16T04:11:08Z!ueno@gnu.org and fix XCHAR2B_BYTE[12] in nsgui.h only
* nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around pointer argument, before dereferencing. (XCHAR2B_BYTE2): Likewise.
-rw-r--r--src/ChangeLog17
-rw-r--r--src/dispextern.h18
-rw-r--r--src/nsgui.h9
-rw-r--r--src/w32gui.h10
-rw-r--r--src/xterm.h9
5 files changed, 33 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2d81cf2f46..4fb688aed1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,15 +1,8 @@
-2014-07-16 Daiki Ueno <ueno@gnu.org>
-
- Consolidate XChar2b macros for the X, W32, and NS
- Suggested by Jan Djärv in:
- https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html
- * w32gui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move the
- fallback definitions to dispextern.h.
- * nsgui.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Likewise.
- Share the same definition with W32.
- * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ...
- * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
- ... here for the consistency with W32 and NS.
+2014-07-15 Daiki Ueno <ueno@gnu.org>
+
+ * nsgui.h (XCHAR2B_BYTE1): Add missing parentheses around
+ pointer argument, before dereferencing.
+ (XCHAR2B_BYTE2): Likewise.
2014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
diff --git a/src/dispextern.h b/src/dispextern.h
index 6e8758218b..0e04cc466d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <X11/Intrinsic.h>
#endif /* USE_X_TOOLKIT */
-#define STORE_XCHAR2B(chp, b1, b2) \
- ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
-
-#define XCHAR2B_BYTE1(chp) \
- ((chp)->byte1)
-
-#define XCHAR2B_BYTE2(chp) \
- ((chp)->byte2)
-
#else /* !HAVE_X_WINDOWS */
/* X-related stuff used by non-X gui code. */
@@ -51,15 +42,6 @@ typedef struct {
char pad;
} XColor;
-#define STORE_XCHAR2B(chp, b1, b2) \
- (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
-
-#define XCHAR2B_BYTE1(chp) \
- ((*(chp) & 0xff00) >> 8)
-
-#define XCHAR2B_BYTE2(chp) \
- (*(chp) & 0x00ff)
-
#endif /* HAVE_X_WINDOWS */
#ifdef MSDOS
diff --git a/src/nsgui.h b/src/nsgui.h
index 055b7aeb70..0f963f69e2 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -64,6 +64,15 @@ typedef unsigned short unichar;
#endif
typedef unichar XChar2b;
+#define STORE_XCHAR2B(chp, b1, b2) \
+ (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
+
+#define XCHAR2B_BYTE1(chp) \
+ ((*(chp) & 0xff00) >> 8)
+
+#define XCHAR2B_BYTE2(chp) \
+ (*(chp) & 0x00ff)
+
/* XXX: xfaces requires these structures, but the question is are we
forced to use them? */
diff --git a/src/w32gui.h b/src/w32gui.h
index 40a8a00346..d04ce625d1 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -54,6 +54,16 @@ typedef HCURSOR Cursor;
#define XChar2b wchar_t
+/* Dealing with bits of wchar_t as if they were an XChar2b. */
+#define STORE_XCHAR2B(chp, byte1, byte2) \
+ ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
+
+#define XCHAR2B_BYTE1(chp) \
+ (((*(chp)) & 0xff00) >> 8)
+
+#define XCHAR2B_BYTE2(chp) \
+ ((*(chp)) & 0x00ff)
+
/* Windows equivalent of XImage. */
typedef struct _XImage
diff --git a/src/xterm.h b/src/xterm.h
index 370006366e..6d80d1253a 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1047,6 +1047,15 @@ extern void x_clear_under_internal_border (struct frame *f);
#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
+#define STORE_XCHAR2B(chp, b1, b2) \
+ ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
+
+#define XCHAR2B_BYTE1(chp) \
+ ((chp)->byte1)
+
+#define XCHAR2B_BYTE2(chp) \
+ ((chp)->byte2)
+
#define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
((nr).x = (rx), \
(nr).y = (ry), \