From 0820b68115258d7260b69a5bfb179368aa265772 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sat, 31 Aug 2013 22:50:48 +0000 Subject: Removed some warnings by upgrading code to GLib 2.32. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@359 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 24 +++++++++++++++++++ src/debug/remgdb/stream-int.h | 6 ++--- src/debug/remgdb/stream.c | 29 +++++++++++----------- src/debug/stream-int.h | 6 ++--- src/debug/stream.c | 32 ++++++++++++------------- src/format/mangling/Makefile.am | 11 +++++---- src/format/mangling/demangler.c | 7 +++--- src/format/mangling/demangler.h | 2 +- src/glibext/delayed-int.h | 4 ++-- src/glibext/delayed.c | 53 ++++++++++++++++++----------------------- src/glibext/gbinportion.h | 6 ----- src/main.c | 1 - src/project.c | 9 ++++--- 13 files changed, 99 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index ade8874..61c93a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +13-09-01 Cyrille Bagard + + * src/debug/remgdb/stream.c: + * src/debug/remgdb/stream-int.h: + * src/debug/stream.c: + * src/debug/stream-int.h: + Remove some warnings by upgrading code to GLib 2.32. + + * src/format/mangling/demangler.c: + * src/format/mangling/demangler.h: + * src/format/mangling/Makefile.am: + Disable the buggy demangling for Itanium. + + * src/glibext/delayed.c: + * src/glibext/delayed-int.h: + Remove some warnings by upgrading code to GLib 2.32. + + * src/glibext/gbinportion.h: + Typo. + + * src/main.c: + * src/project.c: + Remove some warnings by upgrading code to GLib 2.32. + 13-08-31 Cyrille Bagard * src/arch/archbase.h: diff --git a/src/debug/remgdb/stream-int.h b/src/debug/remgdb/stream-int.h index bdfe11a..b93ac48 100644 --- a/src/debug/remgdb/stream-int.h +++ b/src/debug/remgdb/stream-int.h @@ -49,11 +49,11 @@ struct _GGdbStream GThread *listening; /* Thread pour les réceptions */ GGdbPacket *free_packets; /* Liste des disponibles */ - GMutex *free_mutex; /* Accès à la liste */ + GMutex free_mutex; /* Accès à la liste */ GGdbPacket *recv_packets; /* Liste des paquets reçus */ - GCond *recv_cond; /* Attente de disponibilité */ - GMutex *recv_mutex; /* Accès à la liste */ + GCond recv_cond; /* Attente de disponibilité */ + GMutex recv_mutex; /* Accès à la liste */ }; diff --git a/src/debug/remgdb/stream.c b/src/debug/remgdb/stream.c index 0ff442d..360c1cf 100644 --- a/src/debug/remgdb/stream.c +++ b/src/debug/remgdb/stream.c @@ -88,10 +88,10 @@ static void g_gdb_stream_class_init(GGdbStreamClass *klass) static void g_gdb_stream_init(GGdbStream *stream) { - stream->free_mutex = g_mutex_new(); + g_mutex_init(&stream->free_mutex); - stream->recv_cond = g_cond_new(); - stream->recv_mutex = g_mutex_new(); + g_cond_init(&stream->recv_cond); + g_mutex_init(&stream->recv_mutex); } @@ -111,11 +111,10 @@ static void g_gdb_stream_init(GGdbStream *stream) bool g_gdb_stream_listen(GGdbStream *stream) { bool result; /* Bilan final à retourner */ - GError *error; /* Bilan de création de thread */ result = true; - if (!g_thread_create((GThreadFunc)gdb_stream_thread, stream, FALSE, &error)) + if (!g_thread_new("chrysalide_gdb_stream", (GThreadFunc)gdb_stream_thread, stream)) result = false; return result; @@ -203,11 +202,11 @@ static void *gdb_stream_thread(GGdbStream *stream) /* On conserve le résultat */ - g_mutex_lock(stream->recv_mutex); + g_mutex_lock(&stream->recv_mutex); g_gdb_packet_push(&stream->recv_packets, packet); - g_mutex_unlock(stream->recv_mutex); + g_mutex_unlock(&stream->recv_mutex); - g_cond_signal(stream->recv_cond); + g_cond_signal(&stream->recv_cond); } @@ -244,7 +243,7 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream) { GGdbPacket *result; /* Paquet à retourner */ - g_mutex_lock(stream->free_mutex); + g_mutex_lock(&stream->free_mutex); if (dl_list_empty(stream->free_packets)) result = g_gdb_packet_new(); @@ -252,7 +251,7 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream) else result = g_gdb_packet_pop(&stream->free_packets); - g_mutex_unlock(stream->free_mutex); + g_mutex_unlock(&stream->free_mutex); return result; @@ -274,11 +273,11 @@ GGdbPacket *g_gdb_stream_get_free_packet(GGdbStream *stream) void g_gdb_stream_mark_packet_as_free(GGdbStream *stream, GGdbPacket *packet) { - g_mutex_lock(stream->free_mutex); + g_mutex_lock(&stream->free_mutex); g_gdb_packet_push(&stream->free_packets, packet); - g_mutex_unlock(stream->free_mutex); + g_mutex_unlock(&stream->free_mutex); } @@ -389,14 +388,14 @@ GGdbPacket *g_gdb_stream_recv_packet(GGdbStream *stream) { GGdbPacket *result; /* Paquet à retourner */ - g_mutex_lock(stream->recv_mutex); + g_mutex_lock(&stream->recv_mutex); if (dl_list_empty(stream->recv_packets)) - g_cond_wait(stream->recv_cond, stream->recv_mutex); + g_cond_wait(&stream->recv_cond, &stream->recv_mutex); result = g_gdb_packet_pop(&stream->recv_packets); - g_mutex_unlock(stream->recv_mutex); + g_mutex_unlock(&stream->recv_mutex); return result; diff --git a/src/debug/stream-int.h b/src/debug/stream-int.h index 05b6c42..ea229ba 100644 --- a/src/debug/stream-int.h +++ b/src/debug/stream-int.h @@ -71,11 +71,11 @@ struct _GDebugStream GType pkt_type; /* Type des paquets traités */ GDebugPacket *free_packets; /* Liste des disponibles */ - GMutex *free_mutex; /* Accès à la liste */ + GMutex free_mutex; /* Accès à la liste */ GDebugPacket *recv_packets; /* Liste des paquets reçus */ - GCond *recv_cond; /* Attente de disponibilité */ - GMutex *recv_mutex; /* Accès à la liste */ + GCond recv_cond; /* Attente de disponibilité */ + GMutex recv_mutex; /* Accès à la liste */ }; diff --git a/src/debug/stream.c b/src/debug/stream.c index 5d91aa8..13bdb65 100644 --- a/src/debug/stream.c +++ b/src/debug/stream.c @@ -84,10 +84,10 @@ static void g_debug_stream_class_init(GDebugStreamClass *klass) static void g_debug_stream_init(GDebugStream *stream) { - stream->free_mutex = g_mutex_new(); + g_mutex_init(&stream->free_mutex); - stream->recv_cond = g_cond_new(); - stream->recv_mutex = g_mutex_new(); + g_cond_init(&stream->recv_cond); + g_mutex_init(&stream->recv_mutex); } @@ -106,12 +106,10 @@ static void g_debug_stream_init(GDebugStream *stream) bool g_debug_stream_connect(GDebugStream *stream) { - GError *error; /* Bilan de création de thread */ - if (stream->connect == NULL || !stream->connect(stream)) return false; - if (!g_thread_create((GThreadFunc)debug_stream_thread, stream, FALSE, &error)) + if (!g_thread_new("chrysalide_stream", (GThreadFunc)debug_stream_thread, stream)) { /* TODO : disconnect ! */ return false; @@ -148,11 +146,11 @@ static void *debug_stream_thread(GDebugStream *stream) if (stream->recv_packet(stream, packet)) { - g_mutex_lock(stream->recv_mutex); + g_mutex_lock(&stream->recv_mutex); g_debug_packet_push(&stream->recv_packets, packet); - g_mutex_unlock(stream->recv_mutex); + g_mutex_unlock(&stream->recv_mutex); - g_cond_signal(stream->recv_cond); + g_cond_signal(&stream->recv_cond); } else g_debug_stream_mark_packet_as_free(stream, packet); @@ -180,7 +178,7 @@ GDebugPacket *g_debug_stream_get_free_packet(GDebugStream *stream) { GDebugPacket *result; /* Paquet à retourner */ - g_mutex_lock(stream->free_mutex); + g_mutex_lock(&stream->free_mutex); if (dl_list_empty(stream->free_packets)) result = g_object_new(stream->pkt_type, NULL); @@ -188,7 +186,7 @@ GDebugPacket *g_debug_stream_get_free_packet(GDebugStream *stream) else result = g_debug_packet_pop(&stream->free_packets); - g_mutex_unlock(stream->free_mutex); + g_mutex_unlock(&stream->free_mutex); return result; @@ -212,11 +210,11 @@ void g_debug_stream_mark_packet_as_free(GDebugStream *stream, GDebugPacket *pack { stream->free_packet(stream, packet); - g_mutex_lock(stream->free_mutex); + g_mutex_lock(&stream->free_mutex); g_debug_packet_push(&stream->free_packets, packet); - g_mutex_unlock(stream->free_mutex); + g_mutex_unlock(&stream->free_mutex); } @@ -263,7 +261,7 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc { GDebugPacket *result; /* Paquet à retourner */ - g_mutex_lock(stream->recv_mutex); + g_mutex_lock(&stream->recv_mutex); if (filter != NULL) { @@ -282,7 +280,7 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc if (result == NULL) { - g_cond_wait(stream->recv_cond, stream->recv_mutex); + g_cond_wait(&stream->recv_cond, &stream->recv_mutex); goto gdsrp_try_again; } @@ -290,13 +288,13 @@ GDebugPacket *g_debug_stream_recv_packet(GDebugStream *stream, filter_packet_fc else { if (dl_list_empty(stream->recv_packets)) - g_cond_wait(stream->recv_cond, stream->recv_mutex); + g_cond_wait(&stream->recv_cond, &stream->recv_mutex); result = g_debug_packet_pop(&stream->recv_packets); } - g_mutex_unlock(stream->recv_mutex); + g_mutex_unlock(&stream->recv_mutex); return result; diff --git a/src/format/mangling/Makefile.am b/src/format/mangling/Makefile.am index 6298743..9774b73 100644 --- a/src/format/mangling/Makefile.am +++ b/src/format/mangling/Makefile.am @@ -1,5 +1,6 @@ -BUILT_SOURCES = itanium_gram.h libjavamangling_la-java_gram.h +#BUILT_SOURCES = itanium_gram.h libjavamangling_la-java_gram.h +BUILT_SOURCES = libjavamangling_la-java_gram.h AM_YFLAGS = -d @@ -8,10 +9,10 @@ noinst_LTLIBRARIES = libjavamangling.la libformatmangling.la libformatmangling_la_SOURCES = \ context-int.h \ context.h context.c \ - demangler.h demangler.c \ - itanium.h \ - itanium_gram.y \ - itanium_tok.l + demangler.h demangler.c +#itanium.h \ +#itanium_gram.y \ +#itanium_tok.l libformatmangling_la_LDFLAGS = diff --git a/src/format/mangling/demangler.c b/src/format/mangling/demangler.c index 52dad54..bdcdf15 100644 --- a/src/format/mangling/demangler.c +++ b/src/format/mangling/demangler.c @@ -28,7 +28,7 @@ #include -#include "itanium.h" +//#include "itanium.h" #include "java.h" @@ -60,13 +60,14 @@ typedef struct _demangling_properties /* Liste des décodeurs */ static demangling_properties demanglers[DGT_COUNT] = { + /* [DGT_ITANIUM] = { .can_demangle = (can_be_demangled_fc)can_be_itanium_demangled, .create_context = (create_context_fc)g_itanium_dcontext_new, .demangle_routine = (demangle_fc)demangle_itanium_routine, .demangle_type = (demangle_fc)NULL }, - + */ [DGT_JAVA] = { .can_demangle = (can_be_demangled_fc)NULL, .create_context = (create_context_fc)g_java_dcontext_new, @@ -239,7 +240,7 @@ GDataType *demangle_type(DemanglerType type, const char *desc) * Remarques : - * * * ******************************************************************************/ -#ifdef DEBUG +#if 0 void test_itanium_demangling(void) { GBinRoutine *routine; diff --git a/src/format/mangling/demangler.h b/src/format/mangling/demangler.h index 8b1c160..0b83cc1 100644 --- a/src/format/mangling/demangler.h +++ b/src/format/mangling/demangler.h @@ -32,7 +32,7 @@ /* Identifiant des décodeurs existants */ typedef enum _DemanglerType { - DGT_ITANIUM, /* Gnu V3 */ + //DGT_ITANIUM, /* Gnu V3 */ DGT_JAVA, /* Java / DEX */ DGT_COUNT diff --git a/src/glibext/delayed-int.h b/src/glibext/delayed-int.h index d56f2e9..60363e1 100644 --- a/src/glibext/delayed-int.h +++ b/src/glibext/delayed-int.h @@ -46,8 +46,8 @@ struct _GDelayedWork run_task_fc run; /* Traitement externalisé */ bool completed; /* Fin de la tâche ? */ - GMutex *mutex; /* Accès à la variable */ - GCond *cond; /* Attente de changement */ + GMutex mutex; /* Accès à la variable */ + GCond cond; /* Attente de changement */ }; diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c index ae943d7..1a8c5bb 100644 --- a/src/glibext/delayed.c +++ b/src/glibext/delayed.c @@ -72,8 +72,8 @@ typedef struct _GTypedQueue GtkExtStatusBar *statusbar; /* Barre de statut principale */ GDelayedWork *works; /* Tâches à mener à bien */ - GMutex *mutex; /* Verrou pour l'accès */ - GCond *cond; /* Réveil pour un traitement */ + GMutex mutex; /* Verrou pour l'accès */ + GCond cond; /* Réveil pour un traitement */ GThread *thread; /* Procédure de traitement */ @@ -200,8 +200,8 @@ static void g_delayed_work_class_init(GDelayedWorkClass *klass) static void g_delayed_work_init(GDelayedWork *work) { work->completed = false; - work->mutex = g_mutex_new(); - work->cond = g_cond_new(); + g_mutex_init(&work->mutex); + g_cond_init(&work->cond); } @@ -220,8 +220,8 @@ static void g_delayed_work_init(GDelayedWork *work) static void g_delayed_work_dispose(GDelayedWork *work) { - g_mutex_free(work->mutex); - g_cond_free(work->cond); + g_mutex_clear(&work->mutex); + g_cond_clear(&work->cond); G_OBJECT_CLASS(g_delayed_work_parent_class)->dispose(G_OBJECT(work)); @@ -264,12 +264,12 @@ static void g_delayed_work_process(GDelayedWork *work, GtkExtStatusBar *statusba { work->run(work, statusbar); - g_mutex_lock(work->mutex); + g_mutex_lock(&work->mutex); work->completed = true; - g_cond_signal(work->cond); - g_mutex_unlock(work->mutex); + g_cond_signal(&work->cond); + g_mutex_unlock(&work->mutex); g_signal_emit_by_name(work, "work-completed"); @@ -290,12 +290,12 @@ static void g_delayed_work_process(GDelayedWork *work, GtkExtStatusBar *statusba void g_delayed_work_wait_for_completion(GDelayedWork *work) { - g_mutex_lock(work->mutex); + g_mutex_lock(&work->mutex); while (!work->completed) - g_cond_wait(work->cond, work->mutex); + g_cond_wait(&work->cond, &work->mutex); - g_mutex_unlock(work->mutex); + g_mutex_unlock(&work->mutex); } @@ -348,17 +348,10 @@ static void g_typed_queue_class_init(GTypedQueueClass *klass) static void g_typed_queue_init(GTypedQueue *queue) { - GError *error; /* Bilan de création de thread */ + g_mutex_init(&queue->mutex); + g_cond_init(&queue->cond); - queue->mutex = g_mutex_new(); - if (queue->mutex == NULL) - goto gtqi_error; - - queue->cond = g_cond_new(); - if (queue->cond == NULL) - goto gtqi_error; - - queue->thread = g_thread_create((GThreadFunc)g_typed_queue_process, queue, FALSE, &error); + queue->thread = g_thread_new("chrysalide_queue", (GThreadFunc)g_typed_queue_process, queue); if (!queue->thread) goto gtqi_error; @@ -383,8 +376,8 @@ static void g_typed_queue_init(GTypedQueue *queue) static void g_typed_queue_dispose(GTypedQueue *queue) { - g_mutex_free(queue->mutex); - g_cond_free(queue->cond); + g_mutex_clear(&queue->mutex); + g_cond_clear(&queue->cond); G_OBJECT_CLASS(g_typed_queue_parent_class)->dispose(G_OBJECT(queue)); @@ -454,13 +447,13 @@ static GTypedQueue *g_typed_queue_new(GType type, GtkExtStatusBar *statusbar) static void g_typed_queue_schedule(GTypedQueue *queue, GDelayedWork *work) { - g_mutex_lock(queue->mutex); + g_mutex_lock(&queue->mutex); delayed_work_list_add_tail(work, &queue->works); - g_cond_signal(queue->cond); + g_cond_signal(&queue->cond); - g_mutex_unlock(queue->mutex); + g_mutex_unlock(&queue->mutex); } @@ -483,15 +476,15 @@ static void *g_typed_queue_process(GTypedQueue *queue) while (1) { - g_mutex_lock(queue->mutex); + g_mutex_lock(&queue->mutex); if (dl_list_empty(queue->works)) - g_cond_wait(queue->cond, queue->mutex); + g_cond_wait(&queue->cond, &queue->mutex); work = queue->works; delayed_work_list_del(work, &queue->works); - g_mutex_unlock(queue->mutex); + g_mutex_unlock(&queue->mutex); g_delayed_work_process(work, queue->statusbar); diff --git a/src/glibext/gbinportion.h b/src/glibext/gbinportion.h index 826d65f..ca232d4 100644 --- a/src/glibext/gbinportion.h +++ b/src/glibext/gbinportion.h @@ -48,7 +48,6 @@ typedef fnv64_t bp_color_t; #define BP_INHERIT_COLOR 1 - #define BPC_RAW "raw" #define BPC_CODE "code" #define BPC_DATA "data" @@ -56,9 +55,6 @@ typedef fnv64_t bp_color_t; #define BPC_DISASS_ERROR "disassembly-error" - - - /* Enregistre une couleur pour le dessin de portions. */ bool register_binary_portion_color(const char *, uint8_t, uint8_t, uint8_t, uint8_t); @@ -73,8 +69,6 @@ void exit_binary_portion_colors(void); - - #define G_TYPE_BIN_PORTION (g_binary_portion_get_type()) #define G_BIN_PORTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BIN_PORTION, GBinPortion)) #define G_IS_BIN_PORTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BIN_PORTION)) diff --git a/src/main.c b/src/main.c index 7dbb055..ef89cb7 100644 --- a/src/main.c +++ b/src/main.c @@ -116,7 +116,6 @@ int main(int argc, char **argv) textdomain(PACKAGE); /* init threads */ - g_thread_init(NULL); gdk_threads_init(); gdk_threads_enter(); diff --git a/src/project.c b/src/project.c index 8a8f803..cf50ef9 100644 --- a/src/project.c +++ b/src/project.c @@ -66,7 +66,7 @@ struct _GStudyProject loaded_binary **binaries; /* Fichiers binaires associés */ size_t binaries_count; /* Nombre de ces fichiers */ - GMutex *mutex; /* Modification de la liste */ + GMutex mutex; /* Modification de la liste */ }; @@ -131,8 +131,7 @@ static void g_study_project_class_init(GStudyProjectClass *klass) static void g_study_project_init(GStudyProject *project) { - project->mutex = g_mutex_new(); - if (project->mutex == NULL) /* FIXME */; + g_mutex_init(&project->mutex); } @@ -419,7 +418,7 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina /* Enregistrement dans le projet */ - g_mutex_lock(project->mutex); + g_mutex_lock(&project->mutex); project->binaries = (loaded_binary **)realloc(project->binaries, ++project->binaries_count * sizeof(loaded_binary *)); @@ -428,7 +427,7 @@ size_t g_study_project_attach_binary(GStudyProject *project, GLoadedBinary *bina project->binaries[result] = loaded; - g_mutex_unlock(project->mutex); + g_mutex_unlock(&project->mutex); update_project_area(project); -- cgit v0.11.2-87-g4458