diff options
author | progandy <code@progandy> | 2015-12-24 01:21:29 +0100 |
---|---|---|
committer | progandy <code@progandy> | 2015-12-24 01:21:29 +0100 |
commit | b66c51ea2cf67989f77d8094821c0f66b64571a0 (patch) | |
tree | 372c0ffc472f246abc320590aaf9475bdc56ddfc /swaybar | |
parent | Merge pull request #400 from gpyh/forgot_include (diff) | |
download | sway-b66c51ea2cf67989f77d8094821c0f66b64571a0.tar.gz sway-b66c51ea2cf67989f77d8094821c0f66b64571a0.tar.zst sway-b66c51ea2cf67989f77d8094821c0f66b64571a0.zip |
swaybar: fix array indices in i3json_handle
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/swaybar/main.c b/swaybar/main.c index 74930075..110904ba 100644 --- a/swaybar/main.c +++ b/swaybar/main.c | |||
@@ -425,9 +425,9 @@ void render() { | |||
425 | cairo_set_source_u32(window->cairo, colors.separator); | 425 | cairo_set_source_u32(window->cairo, colors.separator); |
426 | cairo_set_line_width(window->cairo, 1); | 426 | cairo_set_line_width(window->cairo, 1); |
427 | cairo_move_to(window->cairo, blockpos + width | 427 | cairo_move_to(window->cairo, blockpos + width |
428 | + block->separator_block_width/2, margin); | 428 | + block->separator_block_width/2, margin); |
429 | cairo_line_to(window->cairo, blockpos + width | 429 | cairo_line_to(window->cairo, blockpos + width |
430 | + block->separator_block_width/2, window->height - margin); | 430 | + block->separator_block_width/2, window->height - margin); |
431 | cairo_stroke(window->cairo); | 431 | cairo_stroke(window->cairo); |
432 | } | 432 | } |
433 | } | 433 | } |
@@ -659,11 +659,11 @@ int i3json_handle(FILE *file) { | |||
659 | } | 659 | } |
660 | --i3json_state.depth; | 660 | --i3json_state.depth; |
661 | if (i3json_state.depth == 1) { | 661 | if (i3json_state.depth == 1) { |
662 | ssize_t len = c-i3json_state.line_start+1; | 662 | // c[1] is valid since c[0] != '\0' |
663 | char p = c[len]; | 663 | char p = c[1]; |
664 | c[len] = '\0'; | 664 | c[1] = '\0'; |
665 | parse_json(i3json_state.line_start); | 665 | parse_json(i3json_state.line_start); |
666 | c[len] = p; | 666 | c[1] = p; |
667 | ++handled; | 667 | ++handled; |
668 | i3json_state.line_start = c+1; | 668 | i3json_state.line_start = c+1; |
669 | } | 669 | } |