Debian Codegraph @

vendored-meson/meson/test cases/frameworks/7 gnome/resources/generated-main.c

raw
1 #include<stdio.h>
2 #include<string.h>
3 #include<gio/gio.h>
4 #include"generated-resources.h"
5
6 #define EXPECTED "This is a generated resource.\n"
7
8 int main(int argc, char **argv) {
9 generated_resources_get_resource();
10 GError *err = NULL;
11 GBytes *data = g_resources_lookup_data("/com/example/myprog/res3.txt",
12 G_RESOURCE_LOOKUP_FLAGS_NONE, &err);
13
14 if(data == NULL) {
15 fprintf(stderr, "Data lookup failed: %s\n", err->message);
16 return 1;
17 }
18 if(strcmp(g_bytes_get_data(data, NULL), EXPECTED) != 0) {
19 fprintf(stderr, "Resource contents are wrong:\n %s\n",
20 (const char*)g_bytes_get_data(data, NULL));
21 return 1;
22 }
23 fprintf(stdout, "All ok.\n");
24 g_bytes_unref(data);
25 return 0;
26 }