From a0c1f62260816bb15c0ba8e88b10c223087b4f32 Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 23 Aug 2005 01:00:22 +0000 Subject: [PATCH] -Wall -Wformat fixes git-svn-id: http://ltt.polymtl.ca/svn@1055 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/ltt/convert/convert.c | 9 +++------ ltt/branches/poly/ltt/facility.c | 13 +++++++++---- ltt/branches/poly/ltt/facility.h | 4 ---- ltt/branches/poly/ltt/parser.c | 20 +++++++++++++++----- ltt/branches/poly/ltt/parser.h | 11 ----------- ltt/branches/poly/ltt/trace.h | 4 ++++ ltt/branches/poly/ltt/tracefile.c | 25 ++----------------------- 7 files changed, 33 insertions(+), 53 deletions(-) diff --git a/ltt/branches/poly/ltt/convert/convert.c b/ltt/branches/poly/ltt/convert/convert.c index 5f2de35f..55efb153 100644 --- a/ltt/branches/poly/ltt/convert/convert.c +++ b/ltt/branches/poly/ltt/convert/convert.c @@ -151,9 +151,6 @@ int main(int argc, char ** argv){ heartbeat beat; uint64_t adaptation_tsc; // (Mathieu) uint32_t size_lost; - int reserve_size = sizeof(buffer_start) + - sizeof(buffer_end) + //buffer_end event - sizeof(uint32_t); //lost size int nb_para; new_process process; @@ -318,7 +315,7 @@ int main(int argc, char ** argv){ end.block_id = start.block_id; - g_printf("Trace version %hu.%hu detected\n", + g_message("Trace version %hu.%hu detected\n", tStart->MajorVersion, tStart->MinorVersion); if(tStart->MinorVersion == 2) { @@ -335,7 +332,7 @@ int main(int argc, char ** argv){ * with TRACE_SYSCALL_ENTRY. */ g_warning("This is a 2.3 trace format that has a 2.2 tag. Please upgrade your kernel"); - g_printf("Processing the trace as a 2.3 format\n"); + g_message("Processing the trace as a 2.3 format\n"); tStart->MinorVersion = 3; } @@ -757,7 +754,7 @@ int main(int argc, char ** argv){ close(fdProc); fclose(fp); - g_printf("Conversion completed. Don't forget to copy core.xml to eventdefs directory\n"); + g_message("Conversion completed. Don't forget to copy core.xml to eventdefs directory\n"); return 0; } diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index 0b5f1ee7..53519c02 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -74,12 +74,12 @@ void freeLttNamedType(LttType * type); int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) { + int ret = 0; gchar *token; parse_file_t in; - gsize length; facility_t * fac; unsigned long checksum; - GError * error = NULL; + //GError * error = NULL; gchar buffer[BUFFER_SIZE]; in.buffer = &(buffer[0]); @@ -93,7 +93,8 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) if(in.fp == NULL) { g_warning("cannot open facility description file %s", in.name); - return 1; + ret = 1; + goto open_error; } //in.channel = g_io_channel_unix_new(in.fd); @@ -135,6 +136,7 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) } else { g_warning("facility token was expected in file %s", in.name); + ret = 1; goto parse_error; } } @@ -143,11 +145,13 @@ int ltt_facility_open(LttFacility *f, LttTrace * t, gchar * pathname) //g_io_channel_shutdown(in.channel, FALSE, &error); /* No flush */ //if(error != NULL) { fclose(in.fp); +open_error: // g_warning("Can not close file: \n%s\n", error->message); // g_error_free(error); //} //g_close(in.fd); + return ret; } @@ -250,7 +254,7 @@ void generateFacility(LttFacility *f, facility_t *fac, guint32 checksum) void construct_types_and_fields(LttFacility * fac, type_descriptor_t * td, LttField * fld) { - int i, flag; + int i; type_descriptor_t * tmpTd; switch(td->type) { @@ -654,5 +658,6 @@ LttEventType *ltt_facility_eventtype_get(LttFacility *f, guint8 i) LttEventType *ltt_facility_eventtype_get_by_name(LttFacility *f, GQuark name) { LttEventType *et = g_datalist_id_get_data(&f->events_by_name, name); + return et; } diff --git a/ltt/branches/poly/ltt/facility.h b/ltt/branches/poly/ltt/facility.h index 091d8af2..173fd143 100644 --- a/ltt/branches/poly/ltt/facility.h +++ b/ltt/branches/poly/ltt/facility.h @@ -47,9 +47,5 @@ LttEventType *ltt_facility_eventtype_get_by_name(LttFacility *f, GQuark name); void ltt_facility_close(LttFacility *f); -/* Reserved facility names */ - -static const char *ltt_facility_name_core = "core"; - #endif // FACILITY_H diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index aa87db95..795b3f96 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -38,11 +38,24 @@ This program is distributed in the hope that it will be useful, #include #include #include - +#include #include "parser.h" +static char *intOutputTypes[] = { + "int8_t", "int16_t", "int32_t", "int64_t", "short int", "int", "long int" }; + +static char *uintOutputTypes[] = { + "uint8_t", "uint16_t", "uint32_t", "uint64_t", "unsigned short int", + "unsigned int", "unsigned long int" }; + +static char *floatOutputTypes[] = { + "undef", "undef", "float", "double", "undef", "float", "double" }; + + + + /* helper function */ void strupper(char *string) { @@ -173,7 +186,6 @@ char *allocAndCopy(char *str) void getTypeAttributes(parse_file_t *in, type_descriptor_t *t) { char * token; - char car; t->fmt = NULL; t->size = -1; @@ -465,7 +477,6 @@ void parseEvent(parse_file_t *in, event_t * ev, sequence_t * unnamed_types, table_t * named_types) { char *token; - type_descriptor_t *t; // getEventAttributes(in, ev); @@ -1271,9 +1282,8 @@ void freeNamedType(table_t * t) void freeTypes(sequence_t *t) { - int pos, pos2; + int pos; type_descriptor_t *tp; - field_t *f; for(pos = 0 ; pos < t->position; pos++) { tp = (type_descriptor_t *)t->array[pos]; diff --git a/ltt/branches/poly/ltt/parser.h b/ltt/branches/poly/ltt/parser.h index 90410934..c846697b 100644 --- a/ltt/branches/poly/ltt/parser.h +++ b/ltt/branches/poly/ltt/parser.h @@ -167,17 +167,6 @@ char * getValueStrAttribute(parse_file_t *in); char * getDescription(parse_file_t *in); -static char *intOutputTypes[] = { - "int8_t", "int16_t", "int32_t", "int64_t", "short int", "int", "long int" }; - -static char *uintOutputTypes[] = { - "uint8_t", "uint16_t", "uint32_t", "uint64_t", "unsigned short int", - "unsigned int", "unsigned long int" }; - -static char *floatOutputTypes[] = { - "undef", "undef", "float", "double", "undef", "float", "double" }; - - /* Dynamic memory allocation and freeing */ void * memAlloc(int size); diff --git a/ltt/branches/poly/ltt/trace.h b/ltt/branches/poly/ltt/trace.h index bb586320..900a72de 100644 --- a/ltt/branches/poly/ltt/trace.h +++ b/ltt/branches/poly/ltt/trace.h @@ -172,4 +172,8 @@ gint check_fields_compatibility(LttEventType *event_type1, LttEventType *event_type2, LttField *field1, LttField *field2); +gint64 ltt_get_int(gboolean reverse_byte_order, gint size, void *data); + +guint64 ltt_get_uint(gboolean reverse_byte_order, gint size, void *data); + #endif // TRACE_H diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index 3eefa029..5f4b4e28 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -76,11 +76,6 @@ GQuark LTT_TRACEFILE_NAME_FACILITIES; #define PAGE_MASK (~(page_size-1)) #define PAGE_ALIGN(addr) (((addr)+page_size-1)&PAGE_MASK) -/* obtain the time of an event */ - -static inline LttTime getEventTime(LttTracefile * tf); - - /* set the offset of the fields belonging to the event, need the information of the archecture */ void set_fields_offsets(LttTracefile *tf, LttEventType *event_type); @@ -540,7 +535,6 @@ int get_tracefile_name_number(const gchar *raw_name, { guint raw_name_len = strlen(raw_name); gchar char_name[PATH_MAX]; - gchar *digit_begin; int i; int underscore_pos; long int cpu_num; @@ -689,8 +683,6 @@ static int open_tracefiles(LttTrace *trace, gchar *root_path, GQuark name; guint num; GArray *group; - LttTracefile *tf; - guint len; if(get_tracefile_name_number(rel_path, &name, &num)) continue; /* invalid name */ @@ -959,7 +951,6 @@ static int ltt_process_facility_tracefile(LttTracefile *tf) return 0; /* Error handling */ -facility_error: event_id_error: fac_id_error: update_error: @@ -1157,7 +1148,6 @@ LttTracefile *ltt_trace_find_tracefile(LttTrace *t, const gchar *name) static void ltt_tracefile_time_span_get(LttTracefile *tf, LttTime *start, LttTime *end) { - struct ltt_block_start_header * header; int err; err = map_block(tf, 0); @@ -1386,11 +1376,12 @@ int ltt_tracefile_seek_position(LttTracefile *tf, const LttEventPosition *ep) { err = ltt_tracefile_read_op(tf); if(err) goto fail; - return; + return 0; fail: g_error("ltt_tracefile_seek_time failed on tracefile %s", g_quark_to_string(tf->name)); + return 1; } /* Calculate the real event time based on the buffer boundaries */ @@ -1486,9 +1477,6 @@ int ltt_tracefile_read_seek(LttTracefile *tf) /* do specific operation on events */ int ltt_tracefile_read_op(LttTracefile *tf) { - int err; - LttFacility *f; - void * pos; LttEvent *event; event = &tf->event; @@ -1508,8 +1496,6 @@ int ltt_tracefile_read_op(LttTracefile *tf) * event specific operation. */ int ltt_tracefile_read_update_event(LttTracefile *tf) { - int err; - LttFacility *f; void * pos; LttEvent *event; @@ -1766,7 +1752,6 @@ static int ltt_seek_next_event(LttTracefile *tf) { int ret = 0; void *pos; - ssize_t event_size; /* seek over the buffer header if we are at the buffer start */ if(tf->event.offset == 0) { @@ -2038,7 +2023,6 @@ gint check_fields_compatibility(LttEventType *event_type1, LttField *field1, LttField *field2) { guint different = 0; - enum field_status local_fixed_root, local_fixed_parent; guint i; LttType *type1; LttType *type2; @@ -2064,11 +2048,6 @@ gint check_fields_compatibility(LttEventType *event_type1, type1 = field1->field_type; type2 = field2->field_type; - size_t current_root_offset; - size_t current_offset; - enum field_status current_child_status, final_child_status; - size_t max_size; - if(type1->type_class != type2->type_class) { different = 1; goto end; -- 2.34.1