Fix 'gcc -Wextra -Wno-unused-parameter'.
Patch status: merged
Patch by Peter Boström
To apply this patch, use:
curl http://cr.i3wm.org/patch/363/raw.patch | git am
b/i3-config-wizard/main.c
| 22 |
@@ -453,7 +453,7 @@ static char *resolve_tilde(const char *path) {
|
| 23 |
char *head, *tail, *result;
|
| 24 |
|
| 25 |
tail = strchr(path, '/');
|
| 26 |
- head = strndup(path, tail ? tail - path : strlen(path));
|
| 27 |
+ head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
|
| 28 |
|
| 29 |
int res = glob(head, GLOB_TILDE, NULL, &globbuf);
|
| 30 |
free(head);
|
b/i3-nagbar/main.c
| 35 |
@@ -467,7 +467,8 @@ int main(int argc, char *argv[]) {
|
| 36 |
uint32_t top_end_x;
|
| 37 |
uint32_t bottom_start_x;
|
| 38 |
uint32_t bottom_end_x;
|
| 39 |
- } __attribute__((__packed__)) strut_partial = {};
|
| 40 |
+ } __attribute__((__packed__)) strut_partial;
|
| 41 |
+ memset(&strut_partial, 0, sizeof(strut_partial));
|
| 42 |
|
| 43 |
strut_partial.top = font.height + 6;
|
| 44 |
strut_partial.top_start_x = 0;
|
b/i3bar/include/config.h
| 49 |
@@ -17,6 +17,9 @@ typedef enum {
|
| 50 |
POS_BOT
|
| 51 |
} position_t;
|
| 52 |
|
| 53 |
+/* Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
|
| 54 |
+typedef enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } bar_display_mode_t;
|
| 55 |
+
|
| 56 |
typedef struct config_t {
|
| 57 |
int modifier;
|
| 58 |
position_t position;
|
| 59 |
@@ -31,8 +34,7 @@ typedef struct config_t {
|
| 60 |
int num_outputs;
|
| 61 |
char **outputs;
|
| 62 |
|
| 63 |
- /* Bar display mode (hide unless modifier is pressed or show in dock mode or always hide in invisible mode) */
|
| 64 |
- enum { M_DOCK = 0, M_HIDE = 1, M_INVISIBLE = 2 } hide_on_modifier;
|
| 65 |
+ bar_display_mode_t hide_on_modifier;
|
| 66 |
|
| 67 |
/* The current hidden_state of the bar, which indicates whether it is hidden or shown */
|
| 68 |
enum { S_HIDE = 0, S_SHOW = 1 } hidden_state;
|
b/i3bar/src/child.c
| 73 |
@@ -28,7 +28,7 @@
|
| 74 |
#include "common.h"
|
| 75 |
|
| 76 |
/* Global variables for child_*() */
|
| 77 |
-i3bar_child child = {};
|
| 78 |
+i3bar_child child;
|
| 79 |
|
| 80 |
/* stdin- and sigchild-watchers */
|
| 81 |
ev_io *stdin_io;
|
b/i3bar/src/ipc.c
| 86 |
@@ -161,7 +161,7 @@ void got_bar_config_update(char *event) {
|
| 87 |
|
| 88 |
/* update the configuration with the received settings */
|
| 89 |
DLOG("Received bar config update \"%s\"\n", event);
|
| 90 |
- int old_mode = config.hide_on_modifier;
|
| 91 |
+ bar_display_mode_t old_mode = config.hide_on_modifier;
|
| 92 |
parse_config_json(event);
|
| 93 |
if (old_mode != config.hide_on_modifier) {
|
| 94 |
reconfig_windows(true);
|
b/i3bar/src/xcb.c
| 99 |
@@ -1524,7 +1524,9 @@ void reconfig_windows(bool redraw_bars) {
|
| 100 |
uint32_t top_end_x;
|
| 101 |
uint32_t bottom_start_x;
|
| 102 |
uint32_t bottom_end_x;
|
| 103 |
- } __attribute__((__packed__)) strut_partial = {};
|
| 104 |
+ } __attribute__((__packed__)) strut_partial;
|
| 105 |
+ memset(&strut_partial, 0, sizeof(strut_partial));
|
| 106 |
+
|
| 107 |
switch (config.position) {
|
| 108 |
case POS_NONE:
|
| 109 |
break;
|
b/include/con.h
| 114 |
@@ -80,7 +80,7 @@ Con *con_parent_with_orientation(Con *con, orientation_t orientation);
|
| 115 |
* Returns the first fullscreen node below this node.
|
| 116 |
*
|
| 117 |
*/
|
| 118 |
-Con *con_get_fullscreen_con(Con *con, int fullscreen_mode);
|
| 119 |
+Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode);
|
| 120 |
|
| 121 |
/**
|
| 122 |
* Returns true if the container is internal, such as __i3_scratch
|
| 123 |
@@ -192,7 +192,7 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
| 124 |
* container).
|
| 125 |
*
|
| 126 |
*/
|
| 127 |
-int con_orientation(Con *con);
|
| 128 |
+orientation_t con_orientation(Con *con);
|
| 129 |
|
| 130 |
/**
|
| 131 |
* Returns the container which will be focused next when the given container
|
b/include/data.h
| 136 |
@@ -449,6 +449,9 @@ struct Assignment {
|
| 137 |
TAILQ_ENTRY(Assignment) assignments;
|
| 138 |
};
|
| 139 |
|
| 140 |
+/** Fullscreen modes. Used by Con.fullscreen_mode. */
|
| 141 |
+typedef enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode_t;
|
| 142 |
+
|
| 143 |
/**
|
| 144 |
* A 'Con' represents everything from the X11 root window down to a single X11 window.
|
| 145 |
*
|
| 146 |
@@ -537,7 +540,7 @@ struct Con {
|
| 147 |
|
| 148 |
TAILQ_HEAD(swallow_head, Match) swallow_head;
|
| 149 |
|
| 150 |
- enum { CF_NONE = 0, CF_OUTPUT = 1, CF_GLOBAL = 2 } fullscreen_mode;
|
| 151 |
+ fullscreen_mode_t fullscreen_mode;
|
| 152 |
/* layout is the layout of this container: one of split[v|h], stacked or
|
| 153 |
* tabbed. Special containers in the tree (above workspaces) have special
|
| 154 |
* layouts like dockarea or output.
|
b/src/con.c
| 159 |
@@ -353,7 +353,7 @@ struct bfs_entry {
|
| 160 |
* Returns the first fullscreen node below this node.
|
| 161 |
*
|
| 162 |
*/
|
| 163 |
-Con *con_get_fullscreen_con(Con *con, int fullscreen_mode) {
|
| 164 |
+Con *con_get_fullscreen_con(Con *con, fullscreen_mode_t fullscreen_mode) {
|
| 165 |
Con *current, *child;
|
| 166 |
|
| 167 |
/* TODO: is breadth-first-search really appropriate? (check as soon as
|
| 168 |
@@ -826,7 +826,7 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
| 169 |
* container).
|
| 170 |
*
|
| 171 |
*/
|
| 172 |
-int con_orientation(Con *con) {
|
| 173 |
+orientation_t con_orientation(Con *con) {
|
| 174 |
switch (con->layout) {
|
| 175 |
case L_SPLITV:
|
| 176 |
/* stacking containers behave like they are in vertical orientation */
|
b/src/util.c
| 181 |
@@ -130,7 +130,7 @@ char *resolve_tilde(const char *path) {
|
| 182 |
char *head, *tail, *result;
|
| 183 |
|
| 184 |
tail = strchr(path, '/');
|
| 185 |
- head = strndup(path, tail ? tail - path : strlen(path));
|
| 186 |
+ head = strndup(path, tail ? (size_t)(tail - path) : strlen(path));
|
| 187 |
|
| 188 |
int res = glob(head, GLOB_TILDE, NULL, &globbuf);
|
| 189 |
free(head);
|