[Xcb-commit] xcb/util-cursor: 8 commits - README configure.ac cursor
Michael Stapelberg
stapelberg at kemper.freedesktop.org
Tue Jul 9 13:51:40 PDT 2013
README | 15 +++++++--------
configure.ac | 2 +-
cursor/Makefile.am | 2 +-
cursor/cursor.c | 9 ++++++---
cursor/cursor.h | 1 +
cursor/load_cursor.c | 2 ++
cursor/parse_cursor_file.c | 9 ++++++++-
7 files changed, 26 insertions(+), 14 deletions(-)
New commits:
commit dd1a1841991dcec716ef4b03e5b6d0fae324a80f
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:50:55 2013 +0200
fix package name
diff --git a/configure.ac b/configure.ac
index 8d30070..92b20d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl XCB_UTIL_M4_WITH_INCLUDE_PATH requires Autoconf >= 2.62
AC_PREREQ(2.62)
-AC_INIT([xcb-cursor],0.3.9,[xcb at lists.freedesktop.org])
+AC_INIT([xcb-util-cursor],0.3.9,[xcb at lists.freedesktop.org])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
commit c5991d41793e68b5f4fe7bf781f72cfc7920432c
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:49:18 2013 +0200
fix README
diff --git a/README b/README
index 618d591..edacff3 100644
--- a/README
+++ b/README
@@ -20,19 +20,18 @@ Discussion about XCB occurs on the XCB mailing list:
<mailto:xcb at lists.freedesktop.org>
<http://lists.freedesktop.org/mailman/listinfo/xcb>
-About XCB util-wm module
-========================
+About XCB util-cursor module
+============================
-XCB util-wm module provides the following libraries:
+XCB util-cursor module provides the following libraries:
- - ewmh: Both client and window-manager helpers for EWMH.
- - icccm: Both client and window-manager helpers for ICCCM.
+ - cursor: port of libxcursor
-You can obtain the latest development versions of XCB util-wm using
+You can obtain the latest development versions of XCB util-cursor using
GIT. For anonymous checkouts, use:
- git clone --recursive git://anongit.freedesktop.org/git/xcb/util-wm
+ git clone --recursive git://anongit.freedesktop.org/git/xcb/util-cursor
For developers, use:
- git clone --recursive git+ssh://git.freedesktop.org/git/xcb/util-wm
+ git clone --recursive git+ssh://git.freedesktop.org/git/xcb/util-cursor
commit e0166e72fa2672dd31d1e4a142e069487d1891b0
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:45:48 2013 +0200
catch integer overflows (Thanks psychon)
diff --git a/cursor/parse_cursor_file.c b/cursor/parse_cursor_file.c
index 2a5713d..e8a47bc 100644
--- a/cursor/parse_cursor_file.c
+++ b/cursor/parse_cursor_file.c
@@ -146,6 +146,11 @@ int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **ima
i->delay = le32toh(i->delay);
/* Read the actual image data and convert it to host byte order */
+ if (((uint64_t)i->width) * i->height > UINT32_MAX) {
+ /* Catch integer overflows */
+ free(cf.tocs);
+ return -EINVAL;
+ }
numpixels = i->width * i->height;
i->pixels = malloc(numpixels * sizeof(uint32_t));
read(fd, i->pixels, numpixels * sizeof(uint32_t));
commit e3887bd2d89876fcbd31edc75ea0848245ce2eed
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:31:32 2013 +0200
Fix memory leak (Thanks psychon)
diff --git a/cursor/parse_cursor_file.c b/cursor/parse_cursor_file.c
index 4e22451..2a5713d 100644
--- a/cursor/parse_cursor_file.c
+++ b/cursor/parse_cursor_file.c
@@ -134,8 +134,10 @@ int parse_cursor_file(xcb_cursor_context_t *c, const int fd, xcint_image_t **ima
chunk.version = le32toh(chunk.version);
/* Sanity check, as libxcursor does it. */
if (chunk.type != cf.tocs[n].type ||
- chunk.subtype != cf.tocs[n].subtype)
+ chunk.subtype != cf.tocs[n].subtype) {
+ free(cf.tocs);
return -EINVAL;
+ }
read(fd, i, sizeof(xcint_image_t) - sizeof(uint32_t*)); // TODO: better type
i->width = le32toh(i->width);
i->height = le32toh(i->height);
commit 4f3d815089e9587bb5adcdb1c40fe3683113ea3d
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:30:17 2013 +0200
Clarify that pict_format is a pointer into pf_reply
â¦and therefore does not need to be freed in xcb_cursor_context_free()
diff --git a/cursor/cursor.h b/cursor/cursor.h
index b7a3946..a69f025 100644
--- a/cursor/cursor.h
+++ b/cursor/cursor.h
@@ -47,6 +47,7 @@ typedef struct xcb_cursor_context_t {
xcb_render_query_pict_formats_reply_t *pf_reply;
+ /* This is a pointer into pf_reply. */
xcb_render_pictforminfo_t *pict_format;
/* Specific values of the root windowâs RESOURCE_MANAGER atom contents. */
commit 33e35665b182cc8b92375f5b712f79c2a6390532
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:26:32 2013 +0200
donât call xcb_render_ when !render_present (Thanks psychon)
diff --git a/cursor/cursor.c b/cursor/cursor.c
index 78fe733..24999e0 100644
--- a/cursor/cursor.c
+++ b/cursor/cursor.c
@@ -136,7 +136,8 @@ int xcb_cursor_context_new(xcb_connection_t *conn, xcb_screen_t *screen, xcb_cur
// XXX: Is it maybe necessary to ever use long_offset != 0?
// XXX: proper length? xlib seems to use 100 MB o_O
rm_cookie = xcb_get_property(conn, 0, c->root, XCB_ATOM_RESOURCE_MANAGER, XCB_ATOM_STRING, 0, 16 * 1024);
- pf_cookie = xcb_render_query_pict_formats(conn);
+ if (c->render_present)
+ pf_cookie = xcb_render_query_pict_formats(conn);
c->cursor_font = xcb_generate_id(conn);
xcb_open_font(conn, c->cursor_font, strlen("cursor"), "cursor");
@@ -144,8 +145,10 @@ int xcb_cursor_context_new(xcb_connection_t *conn, xcb_screen_t *screen, xcb_cur
parse_resource_manager(c, rm_reply);
free(rm_reply);
- c->pf_reply = xcb_render_query_pict_formats_reply(conn, pf_cookie, NULL);
- c->pict_format = xcb_render_util_find_standard_format(c->pf_reply, XCB_PICT_STANDARD_ARGB_32);
+ if (c->render_present) {
+ c->pf_reply = xcb_render_query_pict_formats_reply(conn, pf_cookie, NULL);
+ c->pict_format = xcb_render_util_find_standard_format(c->pf_reply, XCB_PICT_STANDARD_ARGB_32);
+ }
c->size = get_default_size(c, screen);
commit 807bef904f2b5b04aa80fb730753c604a07b29ee
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:25:45 2013 +0200
add comment to clarify how the fallback works
diff --git a/cursor/load_cursor.c b/cursor/load_cursor.c
index e35311c..50d1e0f 100644
--- a/cursor/load_cursor.c
+++ b/cursor/load_cursor.c
@@ -194,6 +194,8 @@ xcb_cursor_t xcb_cursor_load_cursor(xcb_cursor_context_t *c, const char *name) {
uint32_t last_height = 0;
xcb_cursor_t cid = XCB_NONE;
+ // NB: if !render_present, fd will be -1 and thus the next if statement
+ // will trigger the fallback.
if (c->render_present) {
if (c->rm[RM_XCURSOR_THEME])
fd = open_cursor_file(c, c->rm[RM_XCURSOR_THEME], name, &core_char);
commit 867986d6239dabec63dc8290ebdb241142ef6567
Author: Michael Stapelberg <michael at stapelberg.de>
Date: Tue Jul 9 22:19:56 2013 +0200
add cursor.h and shape_to_id.gperf to EXTRA_DIST (Thanks psychon)
This makes âmake distcheckâ work
diff --git a/cursor/Makefile.am b/cursor/Makefile.am
index ffc6510..186a39e 100644
--- a/cursor/Makefile.am
+++ b/cursor/Makefile.am
@@ -14,7 +14,7 @@ libxcb_cursor_la_LDFLAGS = -version-info 0:0:0 -no-undefined -export-symbols-reg
pkgconfig_DATA = xcb-cursor.pc
-EXTRA_DIST = xcb-cursor.pc.in
+EXTRA_DIST = xcb-cursor.pc.in cursor.h shape_to_id.gperf
# TODO: We cannot use --pic because then the gperf-generated code does not compile :-/
GPERFFLAGS = --includes --struct-type --language=ANSI-C --switch=1
More information about the xcb-commit
mailing list