Skip to content

Commit 1763c1b

Browse files
examples: fix type mismatch in x11 server example
1 parent 1776764 commit 1763c1b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

examples/server/x11.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <xcb/xcb_keysyms.h>
1111

1212
void dirty_copy(rfbScreenInfoPtr rfbScreen, const uint8_t* data, int width, int height, int nbytes);
13-
void convert_bgrx_to_rgb(const uint8_t* in, int16_t width, int32_t height, uint8_t* buff);
14-
void get_window_size(xcb_connection_t* conn, xcb_window_t window, int16_t* width, int16_t* height);
13+
void convert_bgrx_to_rgb(const uint8_t* in, uint16_t width, uint16_t height, uint8_t* buff);
14+
void get_window_size(xcb_connection_t* conn, xcb_window_t window, uint16_t* width, uint16_t* height);
1515
void get_window_image(xcb_connection_t* conn, xcb_window_t window, uint8_t* buff);
1616
void send_keycode(xcb_connection_t *conn, xcb_keycode_t keycode, int press);
1717
void send_keysym(xcb_connection_t *conn, xcb_keysym_t keysym, int press);
@@ -111,11 +111,11 @@ void dirty_copy(rfbScreenInfoPtr rfbScreen, const uint8_t* data, int width, int
111111
}
112112
}
113113

114-
void convert_bgrx_to_rgb(const uint8_t* in, int16_t width, int32_t height, uint8_t* buff)
114+
void convert_bgrx_to_rgb(const uint8_t* in, uint16_t width, uint16_t height, uint8_t* buff)
115115
{
116-
for (int16_t y = 0; y < height; y++)
116+
for (uint16_t y = 0; y < height; y++)
117117
{
118-
for(int16_t x = 0; x < width; x++)
118+
for(uint16_t x = 0; x < width; x++)
119119
{
120120
buff[(y*width+x)*3] = in[(y*width+x)*4 + 2];
121121
buff[(y*width+x)*3 + 1] = in[(y*width+x)*4 + 1];
@@ -124,7 +124,7 @@ void convert_bgrx_to_rgb(const uint8_t* in, int16_t width, int32_t height, uint8
124124
}
125125
}
126126

127-
void get_window_size(xcb_connection_t* conn, xcb_window_t window, int16_t* width, int16_t* height)
127+
void get_window_size(xcb_connection_t* conn, xcb_window_t window, uint16_t* width, uint16_t* height)
128128
{
129129
xcb_get_geometry_cookie_t cookie = xcb_get_geometry(conn, window);
130130
xcb_get_geometry_reply_t* reply = xcb_get_geometry_reply(conn, cookie, NULL);
@@ -136,8 +136,8 @@ void get_window_size(xcb_connection_t* conn, xcb_window_t window, int16_t* width
136136

137137
void get_window_image(xcb_connection_t* conn, xcb_window_t window, uint8_t* buff)
138138
{
139-
int16_t width = 0;
140-
int16_t height = 0;
139+
uint16_t width = 0;
140+
uint16_t height = 0;
141141
get_window_size(conn, window, &width, &height);
142142

143143
// will failed in wayland, xcb_get_image_data will return NULL, convert_bgrx_to_rgb will abort

0 commit comments

Comments
 (0)