]> git.sur5r.net Git - i3/i3/blobdiff - i3-config-wizard/main.c
Fix 'gcc -Wextra -Wno-unused-parameter'.
[i3/i3] / i3-config-wizard / main.c
index 54c8e0245478d11b97677d8d445e4518d7ee8510..bdd012fc114a7c3ae08067d22657f9251f146176 100644 (file)
@@ -13,7 +13,7 @@
 #endif
 
 /* For systems without getline, fall back to fgetln */
-#if defined(__APPLE__) || (defined(__FreeBSD__) && __FreeBSD_version < 800000)
+#if defined(__APPLE__)
 #define USE_FGETLN
 #elif defined(__FreeBSD__)
 /* Defining this macro before including stdio.h is necessary in order to have
@@ -299,7 +299,7 @@ static char *rewrite_binding(const char *input) {
 
     /* The "<=" operator is intentional: We also handle the terminating 0-byte
      * explicitly by looking for an 'end' token. */
-    while ((walk - input) <= len) {
+    while ((size_t)(walk - input) <= len) {
         /* Skip whitespace before every token, newlines are relevant since they
          * separate configuration directives. */
         while ((*walk == ' ' || *walk == '\t') && *walk != '\0')
@@ -420,7 +420,7 @@ static char *rewrite_binding(const char *input) {
 
 
 /*
- * Having verboselog() and errorlog() is necessary when using libi3.
+ * Having verboselog(), errorlog() and debuglog() is necessary when using libi3.
  *
  */
 void verboselog(char *fmt, ...) {
@@ -439,6 +439,9 @@ void errorlog(char *fmt, ...) {
     va_end(args);
 }
 
+void debuglog(char *fmt, ...) {
+}
+
 /*
  * This function resolves ~ in pathnames.
  * It may resolve wildcards in the first part of the path, but if no match
@@ -450,7 +453,7 @@ static char *resolve_tilde(const char *path) {
     char *head, *tail, *result;
 
     tail = strchr(path, '/');
-    head = strndup(path, tail ? tail - path : strlen(path));
+    head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
 
     int res = glob(head, GLOB_TILDE, NULL, &globbuf);
     free(head);
@@ -791,17 +794,17 @@ int main(int argc, char *argv[]) {
     close(fd);
     unlink(config_path);
 
+    int screen;
+    if ((conn = xcb_connect(NULL, &screen)) == NULL ||
+        xcb_connection_has_error(conn))
+        errx(1, "Cannot open display\n");
+
     if (socket_path == NULL)
-        socket_path = root_atom_contents("I3_SOCKET_PATH");
+        socket_path = root_atom_contents("I3_SOCKET_PATH", conn, screen);
 
     if (socket_path == NULL)
         socket_path = "/tmp/i3-ipc.sock";
 
-    int screens;
-    if ((conn = xcb_connect(NULL, &screens)) == NULL ||
-        xcb_connection_has_error(conn))
-        errx(1, "Cannot open display\n");
-
     keysyms = xcb_key_symbols_alloc(conn);
     xcb_get_modifier_mapping_cookie_t modmap_cookie;
     modmap_cookie = xcb_get_modifier_mapping(conn);
@@ -813,7 +816,7 @@ int main(int argc, char *argv[]) {
     #include "atoms.xmacro"
     #undef xmacro
 
-    root_screen = xcb_aux_get_screen(conn, screens);
+    root_screen = xcb_aux_get_screen(conn, screen);
     root = root_screen->root;
 
     if (!(modmap_reply = xcb_get_modifier_mapping_reply(conn, modmap_cookie, NULL)))