mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
tests: Fix a compiler warning about string+int arithmetic
Clang warns about string+int not appending to the string (to try and catch newbie mistakes). While this test didn’t expect that to happen, it was substituting the same constant string in multiple places for no good reason. Switch to a single static const string, which should also fix the compiler warning. We have to define the string length since it’s used in various stack-allocated array lengths. This is the easiest fix without more major refactoring of the test to be less 90s. Also make things a bit more static. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
b90eb15f3e
commit
99a325356d
@ -22,6 +22,7 @@
|
||||
#include <gio/gio.h>
|
||||
#include <gio/gunixinputstream.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#include <glib.h>
|
||||
#include <glib/glib-unix.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
@ -29,7 +30,8 @@
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define DATA "abcdefghijklmnopqrstuvwxyz"
|
||||
/* sizeof(DATA) will give the number of bytes in the array, plus the terminating nul */
|
||||
static const gchar DATA[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
int writer_pipe[2], reader_pipe[2];
|
||||
GCancellable *writer_cancel, *reader_cancel, *main_cancel;
|
||||
@ -118,8 +120,8 @@ reader_thread (gpointer user_data)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
char main_buf[sizeof (DATA)];
|
||||
gssize main_len, main_offset;
|
||||
static char main_buf[sizeof (DATA)];
|
||||
static gssize main_len, main_offset;
|
||||
|
||||
static void main_thread_read (GObject *source, GAsyncResult *res, gpointer user_data);
|
||||
static void main_thread_skipped (GObject *source, GAsyncResult *res, gpointer user_data);
|
||||
|
Loading…
Reference in New Issue
Block a user