From: yangxx Date: Fri, 1 Aug 2003 16:38:35 +0000 (+0000) Subject: git-svn-id: http://ltt.polymtl.ca/svn@155 04897980-b3bd-0310-b5e0-8ef037075253 X-Git-Tag: v0.12.20~3334 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=89d4760c299207c7d0235fe2c326d51e0c37d73e;p=lttv.git git-svn-id: ltt.polymtl.ca/svn@155 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 0b20c3df..c8a8ee20 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -255,7 +255,7 @@ void ltt_event_field_element_select(LttEvent *e, LttField *f, unsigned i) return ; element_number = ltt_event_field_element_number(e,f); - if(element_number < i || i == 0) return; + if((element_number-1) < i || i < 0) return; fld = f->child[0]; diff --git a/ltt/branches/poly/ltt/type.c b/ltt/branches/poly/ltt/type.c index ee0d7193..4f90c69a 100644 --- a/ltt/branches/poly/ltt/type.c +++ b/ltt/branches/poly/ltt/type.c @@ -236,8 +236,8 @@ unsigned ltt_type_member_number(LttType *t) LttType *ltt_type_member_type(LttType *t, unsigned i) { if(t->type_class != LTT_STRUCT) return NULL; - if(i > t->element_number || i == 0 ) return NULL; - return t->element_type[i-1]; + if(i >= t->element_number || i < 0 ) return NULL; + return t->element_type[i]; } /***************************************************************************** @@ -255,8 +255,8 @@ LttType *ltt_type_member_type(LttType *t, unsigned i) char *ltt_enum_string_get(LttType *t, unsigned i) { if(t->type_class != LTT_ENUM) return NULL; - if(i > t->element_number || i == 0 ) return NULL; - return t->enum_strings[i-1]; + if(i >= t->element_number || i < 0 ) return NULL; + return t->enum_strings[i]; } /***************************************************************************** @@ -291,8 +291,8 @@ LttField *ltt_field_element(LttField *f) LttField *ltt_field_member(LttField *f, unsigned i) { if(f->field_type->type_class != LTT_STRUCT) return NULL; - if(i==0 || i>f->field_type->element_number) return NULL; - return f->child[i-1]; + if(i < 0 || i >= f->field_type->element_number) return NULL; + return f->child[i]; } /*****************************************************************************