forked from enlightenment/efl
efl: remove some warnings.
Summary: Mainly from the examples but also from libunibreak and tests/eet. I'm not sure if it's really worth to remove warnings from the examples -- because it adds pedantic-ness to something supposed to be didatic, but I leave for you guys to judge. Reviewers: tasn, cedric CC: felipealmeida, raster, smohanty, cedric Differential Revision: https://phab.enlightenment.org/D896 Signed-off-by: Cedric Bail <cedric.bail@free.fr>
This commit is contained in:
parent
e68225ae69
commit
72ee78b929
|
@ -1,8 +1,12 @@
|
|||
//Compile with:
|
||||
// gcc -o ecore_idler_example ecore_idler_example.c `pkg-config --libs --cflags ecore eo`
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
//#include <Ecore_Eo.h>
|
||||
#include <Eo.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct context // helper struct to give some context to the callbacks
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
|
@ -16,17 +17,19 @@ main(void)
|
|||
const char *key = "This is a crypto key";
|
||||
const char *key_bad = "This is another crypto key";
|
||||
|
||||
char *file = strdup("/tmp/eet_cipher_example_XXXXX");
|
||||
char *file = strdup("/tmp/eet_cipher_example_XXXXXX");
|
||||
Eet_File *ef;
|
||||
char *test;
|
||||
int size;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
if (!(file = tmpnam(file)))
|
||||
if (-1 == (tmpfd = mkstemp(file)) || !!close(tmpfd))
|
||||
{
|
||||
fprintf(
|
||||
stderr, "ERROR: could not create temporary file (%s).\n", file);
|
||||
stderr, "ERROR: could not create temporary file (%s) : %s\n",
|
||||
file, strerror(errno));
|
||||
goto panic;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ _phone_entry_free_cb(void *data)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
||||
void *data, void *fdata)
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book EINA_UNUSED, const void *key,
|
||||
void *data, void *fdata EINA_UNUSED)
|
||||
{
|
||||
const char *name = key;
|
||||
const char *number = data;
|
||||
|
@ -51,6 +51,8 @@ _phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
Eina_Hash *phone_book = NULL;
|
||||
int i;
|
||||
const char *entry_name = "Heitor Villa-Lobos";
|
||||
|
|
|
@ -47,7 +47,9 @@ _phone_book_stringshared_free_cb(void *data)
|
|||
|
||||
static Eina_Bool
|
||||
_phone_book_stringshared_foreach_cb(const Eina_Hash *phone_book,
|
||||
const void *key, void *data, void *fdata)
|
||||
const void *key EINA_UNUSED,
|
||||
void *data,
|
||||
void *fdata EINA_UNUSED)
|
||||
{
|
||||
Phone_Entry *e = data;
|
||||
const char *name = e->name; // e->name == key
|
||||
|
@ -97,8 +99,8 @@ _phone_book_string_key_length(const char *key)
|
|||
}
|
||||
|
||||
static int
|
||||
_phone_book_string_key_cmp(const char *key1, int key1_length,
|
||||
const char *key2, int key2_length)
|
||||
_phone_book_string_key_cmp(const char *key1, int key1_length EINA_UNUSED,
|
||||
const char *key2, int key2_length EINA_UNUSED)
|
||||
{
|
||||
return strcmp(key1, key2);
|
||||
}
|
||||
|
@ -138,6 +140,8 @@ example_hash_big(void)
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
eina_init();
|
||||
|
||||
example_hash_stringshared();
|
||||
|
|
|
@ -38,7 +38,7 @@ _phone_entry_free_cb(void *data)
|
|||
|
||||
static Eina_Bool
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
||||
void *data, void *fdata)
|
||||
void *data, void *fdata EINA_UNUSED)
|
||||
{
|
||||
const char *name = key;
|
||||
const char *number = data;
|
||||
|
@ -51,6 +51,8 @@ _phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Hash *phone_book = NULL;
|
||||
int i;
|
||||
const char *entry_name = "Heitor Villa-Lobos";
|
||||
|
|
|
@ -38,7 +38,7 @@ _phone_entry_free_cb(void *data)
|
|||
|
||||
static Eina_Bool
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
||||
void *data, void *fdata)
|
||||
void *data, void *fdata EINA_UNUSED)
|
||||
{
|
||||
const char *name = key;
|
||||
const char *number = data;
|
||||
|
@ -51,6 +51,8 @@ _phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Hash *phone_book = NULL;
|
||||
int i;
|
||||
const char *entry_name = "Heitor Villa-Lobos";
|
||||
|
|
|
@ -38,7 +38,7 @@ _phone_entry_free_cb(void *data)
|
|||
|
||||
static Eina_Bool
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
||||
void *data, void *fdata)
|
||||
void *data, void *fdata EINA_UNUSED)
|
||||
{
|
||||
const int32_t *id = key;
|
||||
const char *number = data;
|
||||
|
@ -51,6 +51,8 @@ _phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Hash *phone_book = NULL;
|
||||
int i;
|
||||
int32_t entry_id = 4;
|
||||
|
|
|
@ -38,11 +38,11 @@ _phone_entry_free_cb(void *data)
|
|||
|
||||
static Eina_Bool
|
||||
_phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
||||
void *data, void *fdata)
|
||||
void *data, void *fdata EINA_UNUSED)
|
||||
{
|
||||
const int64_t *id = key;
|
||||
const char *number = data;
|
||||
printf("%lld: %s\n", *id, number);
|
||||
printf("%lld: %s\n", (long long int)*id, number);
|
||||
|
||||
// Return EINA_FALSE to stop this callback from being called
|
||||
return EINA_TRUE;
|
||||
|
@ -51,6 +51,8 @@ _phone_book_foreach_cb(const Eina_Hash *phone_book, const void *key,
|
|||
int
|
||||
main(int argc, const char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Hash *phone_book = NULL;
|
||||
int i;
|
||||
int64_t entry_id = 4;
|
||||
|
@ -75,7 +77,7 @@ main(int argc, const char *argv[])
|
|||
if (phone)
|
||||
{
|
||||
printf("Printing entry.\n");
|
||||
printf("Id: %lld\n", entry_id);
|
||||
printf("Id: %lld\n", (long long int)entry_id);
|
||||
printf("Number: %s\n\n", phone);
|
||||
}
|
||||
|
||||
|
@ -136,7 +138,7 @@ main(int argc, const char *argv[])
|
|||
Eina_Hash_Tuple *t = data;
|
||||
const int64_t *id = t->key;
|
||||
const char *number = t->data;
|
||||
printf("%lld: %s\n", *id, number);
|
||||
printf("%lld: %s\n", (long long int)*id, number);
|
||||
}
|
||||
eina_iterator_free(it); // Always free the iterator after its use
|
||||
printf("\n");
|
||||
|
@ -147,7 +149,7 @@ main(int argc, const char *argv[])
|
|||
while (eina_iterator_next(it, &data))
|
||||
{
|
||||
const int64_t *id = data;
|
||||
printf("%lld\n", *id);
|
||||
printf("%lld\n", (long long int)*id);
|
||||
}
|
||||
eina_iterator_free(it);
|
||||
printf("\n");
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_List *list = NULL;
|
||||
Eina_List *l;
|
||||
void *list_data;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_List *list = NULL, *other_list = NULL;
|
||||
Eina_List *l;
|
||||
void *data;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_List *list = NULL, *r_list;
|
||||
Eina_List *l;
|
||||
Eina_Iterator *itr;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_List *list = NULL;
|
||||
Eina_List *l;
|
||||
void *list_data;
|
||||
|
|
|
@ -25,7 +25,7 @@ int main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
eina_strbuf_reset(buf);
|
||||
|
||||
eina_strbuf_append_printf(buf, "%s%c", "buffe", 'r');
|
||||
eina_strbuf_insert_printf(buf, " %s: %d", 6, "length", eina_strbuf_length_get(buf));
|
||||
eina_strbuf_insert_printf(buf, " %s: %d", 6, "length", (int)eina_strbuf_length_get(buf));
|
||||
printf("%s\n", eina_strbuf_string_get(buf));
|
||||
|
||||
eina_strbuf_remove(buf, 0, 7);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Value v;
|
||||
int i;
|
||||
char *newstr;
|
||||
|
|
|
@ -79,6 +79,8 @@ void my_struct_use(Eina_Value *params)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
Eina_Value *v1, *v2;
|
||||
|
||||
eina_init();
|
||||
|
|
|
@ -26,7 +26,7 @@ _tz_copy(const Eina_Value_Type *type EINA_UNUSED, const void *src, void * dst)
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
static int
|
||||
_tz_compare(const Eina_Value_Type *type EINA_UNUSED, const void *a, const void *b)
|
||||
{
|
||||
struct timezone tza = *(struct timezone*)a;
|
||||
|
|
|
@ -37,7 +37,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
else if (strcmp(argv[1], "get") == 0)
|
||||
{
|
||||
size_t size = 0;
|
||||
ssize_t size = 0;
|
||||
const char *value;
|
||||
|
||||
if (argc < 4)
|
||||
|
|
|
@ -63,7 +63,7 @@ _fill_receive_array_of_string_int_with_size(Eldbus_Message *msg, int size, const
|
|||
|
||||
offset = _type_offset(sizeof(int), sizeof(Eina_Value_Array));
|
||||
main_members[0].name = "size";
|
||||
main_members[0].type = EINA_VALUE_TYPE_INT, 0;
|
||||
main_members[0].type = EINA_VALUE_TYPE_INT;
|
||||
main_members[0].offset = 0;
|
||||
main_members[1].name = "array";
|
||||
main_members[1].type = EINA_VALUE_TYPE_ARRAY;
|
||||
|
|
|
@ -166,9 +166,6 @@ _on_keydown(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *e
|
|||
{
|
||||
App_Data *ad = data;
|
||||
Evas_Event_Key_Down *ev = event;
|
||||
const Evas_Modifier *mods;
|
||||
|
||||
mods = evas_key_modifier_get(ad->canvas);
|
||||
switch (ev->key[0])
|
||||
{
|
||||
case 'a':
|
||||
|
|
|
@ -128,6 +128,7 @@ static void set_brks_to(
|
|||
while (posNext < posEnd)
|
||||
{
|
||||
utf32_t ch;
|
||||
(void)ch;
|
||||
ch = get_next_char(s, len, &posNext);
|
||||
assert(ch != EOS);
|
||||
for (; posStart < posNext - 1; ++posStart)
|
||||
|
|
|
@ -415,7 +415,7 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor *edd, Eina_Bool stream)
|
|||
eet_eina_stream_data_descriptor_class_set(&eddc,
|
||||
sizeof (Eet_Data_Descriptor_Class),
|
||||
"Eet_Test_Basic_Type",
|
||||
sizeof(Eet_Test_Basic_Type));
|
||||
sizeof(Eet_Test_Basic_Type));
|
||||
eddb = eet_data_descriptor_stream_new(&eddc);
|
||||
}
|
||||
else
|
||||
|
@ -423,7 +423,7 @@ _eet_build_ex_descriptor(Eet_Data_Descriptor *edd, Eina_Bool stream)
|
|||
eet_eina_file_data_descriptor_class_set(&eddc,
|
||||
sizeof (Eet_Data_Descriptor_Class),
|
||||
"Eet_Test_Basic_Type",
|
||||
sizeof(Eet_Test_Basic_Type));
|
||||
sizeof(Eet_Test_Basic_Type));
|
||||
eddb = eet_data_descriptor_file_new(&eddc);
|
||||
}
|
||||
fail_if(!eddb);
|
||||
|
@ -968,10 +968,12 @@ START_TEST(eet_file_simple_write)
|
|||
char *test;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int size;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
fail_if(eet_mode_get(NULL) != EET_FILE_MODE_INVALID);
|
||||
|
||||
|
@ -1040,6 +1042,7 @@ START_TEST(eet_file_data_test)
|
|||
Eet_Test_Ex_Type etbt;
|
||||
int size;
|
||||
int test;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -1071,7 +1074,8 @@ START_TEST(eet_file_data_test)
|
|||
|
||||
_eet_build_ex_descriptor(edd, EINA_FALSE);
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
/* Insert an error in etbt. */
|
||||
etbt.i = 0;
|
||||
|
@ -1194,6 +1198,7 @@ START_TEST(eet_file_data_dump_test)
|
|||
char *string1;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int test;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -1223,7 +1228,8 @@ START_TEST(eet_file_data_dump_test)
|
|||
|
||||
_eet_build_ex_descriptor(edd, EINA_FALSE);
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
/* Save the encoded data in a file. */
|
||||
ef = eet_open(file, EET_FILE_MODE_WRITE);
|
||||
|
@ -1294,10 +1300,12 @@ START_TEST(eet_image)
|
|||
int alpha;
|
||||
unsigned int w;
|
||||
unsigned int h;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
/* Save the encoded data in a file. */
|
||||
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
|
||||
|
@ -1660,6 +1668,7 @@ START_TEST(eet_small_image)
|
|||
int quality;
|
||||
Eet_Image_Encoding lossy;
|
||||
int result;
|
||||
int tmpfd;
|
||||
|
||||
image[0] = IM0;
|
||||
image[1] = IM1;
|
||||
|
@ -1668,7 +1677,8 @@ START_TEST(eet_small_image)
|
|||
|
||||
eet_init();
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_WRITE);
|
||||
fail_if(!ef);
|
||||
|
@ -1720,7 +1730,8 @@ START_TEST(eet_identity_simple)
|
|||
|
||||
eet_init();
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (fd = mkstemp(file)));
|
||||
fail_if(!!close(fd));
|
||||
fail_if(!(noread = fopen("/dev/null", "w")));
|
||||
|
||||
/* Sign an eet file. */
|
||||
|
@ -1880,10 +1891,12 @@ START_TEST(eet_cipher_decipher_simple)
|
|||
char *test;
|
||||
char *file = strdup("/tmp/eet_suite_testXXXXXX");
|
||||
int size;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
/* Crypt an eet file. */
|
||||
ef = eet_open(file, EET_FILE_MODE_WRITE);
|
||||
|
@ -1966,6 +1979,7 @@ START_TEST(eet_cache_concurrency)
|
|||
unsigned int n;
|
||||
Eina_Thread thread;
|
||||
Eina_Bool r;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
eina_threads_init();
|
||||
|
@ -1974,7 +1988,8 @@ START_TEST(eet_cache_concurrency)
|
|||
eina_condition_new(&open_worker_cond, &open_worker_mutex);
|
||||
|
||||
/* create a file to test with */
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
ef = eet_open(file, EET_FILE_MODE_WRITE);
|
||||
fail_if(!ef);
|
||||
fail_if(!eet_write(ef, "keys/tests", buffer, strlen(buffer) + 1, 0));
|
||||
|
@ -2235,6 +2250,7 @@ START_TEST(eet_file_fp)
|
|||
Eet_5FP origin;
|
||||
Eet_5DBL *convert;
|
||||
Eet_5FP *build;
|
||||
int tmpfd;
|
||||
|
||||
eet_init();
|
||||
|
||||
|
@ -2262,7 +2278,8 @@ START_TEST(eet_file_fp)
|
|||
origin.f1 = eina_f32p32_int_from(1);
|
||||
origin.f0 = 0;
|
||||
|
||||
fail_if(!(file = tmpnam(file)));
|
||||
fail_if(-1 == (tmpfd = mkstemp(file)));
|
||||
fail_if(!!close(tmpfd));
|
||||
|
||||
ef = eet_open(file, EET_FILE_MODE_READ_WRITE);
|
||||
fail_if(!ef);
|
||||
|
@ -2871,4 +2888,3 @@ main(int argc EINA_UNUSED, char *argv[])
|
|||
|
||||
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
} /* main */
|
||||
|
||||
|
|
Loading…
Reference in New Issue