- int res;
-
- char buffer[256], type[10];
-
- LttvAttributeName name;
-
- LttvAttributeValue value;
-
- LttvAttribute *subtree;
-
- fscanf(fp,"<ATTRS>");
- while(1) {
- res = fscanf(fp, "<ATTR NAME=\"%256[^\"]\" TYPE=%10[^ >]", buffer, type);
- g_assert(res == 2);
- name = g_quark_from_string(buffer);
- if(strcmp(type, "ATTRS") == 0) {
- fscanf(fp, ">");
- subtree = lttv_attribute_find_subdir(self, name);
- lttv_attribute_read_xml(subtree, fp);
- }
- else if(strcmp(type, "INT") == 0) {
- value = lttv_attribute_add(self, name, LTTV_INT);
- res = fscanf(fp, " VALUE=%d/>", value.v_int);
- g_assert(res == 1);
- }
- else if(strcmp(type, "UINT") == 0) {
- value = lttv_attribute_add(self, name, LTTV_UINT);
- res = fscanf(fp, " VALUE=%u/>", value.v_uint);
- g_assert(res == 1);
- }
- else if(strcmp(type, "LONG") == 0) {
- value = lttv_attribute_add(self, name, LTTV_LONG);
- res = fscanf(fp, " VALUE=%ld/>", value.v_long);
- g_assert(res == 1);
- }
- else if(strcmp(type, "ULONG") == 0) {
- value = lttv_attribute_add(self, name, LTTV_ULONG);
- res = fscanf(fp, " VALUE=%lu/>", value.v_ulong);
- g_assert(res == 1);
- }
- else if(strcmp(type, "FLOAT") == 0) {
- float d;
- value = lttv_attribute_add(self, name, LTTV_FLOAT);
- res = fscanf(fp, " VALUE=%f/>", &d);
- *(value.v_float) = d;
- g_assert(res == 1);
- }
- else if(strcmp(type, "DOUBLE") == 0) {
- value = lttv_attribute_add(self, name, LTTV_DOUBLE);
- res = fscanf(fp, " VALUE=%lf/>", value.v_double);
- g_assert(res == 1);
- }
- else if(strcmp(type, "TIME") == 0) {
- value = lttv_attribute_add(self, name, LTTV_TIME);
- res = fscanf(fp, " SEC=%lu NSEC=%lu/>", &(value.v_time->tv_sec),
- &(value.v_time->tv_nsec));
- g_assert(res == 2);
- }
- else if(strcmp(type, "POINTER") == 0) {
- value = lttv_attribute_add(self, name, LTTV_POINTER);
- res = fscanf(fp, " VALUE=%p/>", value.v_pointer);
- g_error("Cannot read a pointer");
- }
- else if(strcmp(type, "STRING") == 0) {
- value = lttv_attribute_add(self, name, LTTV_STRING);
- res = fscanf(fp, " VALUE=\"%256[^\"]\"/>", buffer);
- *(value.v_string) = g_strdup(buffer);
- g_assert(res == 1);
- }
- else if(strcmp(type, "GOBJECT") == 0) {
- value = lttv_attribute_add(self, name, LTTV_GOBJECT);
- res = fscanf(fp, " VALUE=%p/>", value.v_gobject);
- g_error("Cannot read a pointer");
- }
- else if(strcmp(type, "NONE") == 0) {
- value = lttv_attribute_add(self, name, LTTV_NONE);
- fscanf(fp, "/>");
- }
- else g_error("Unknown type to read");
- }
- fscanf(fp,"</ATTRS>");
+ int res;
+
+ char buffer[256], type[10];
+
+ LttvAttributeName name;
+
+ LttvAttributeValue value;
+
+ LttvAttribute *subtree;
+
+ fscanf(fp,"<ATTRS>");
+ while(1) {
+ res = fscanf(fp, "<ATTR NAME=\"%256[^\"]\" TYPE=%10[^ >]", buffer, type);
+ g_assert(res == 2);
+ name = g_quark_from_string(buffer);
+ if(strcmp(type, "ATTRS") == 0) {
+ fscanf(fp, ">");
+ subtree = lttv_attribute_find_subdir(self, name);
+ lttv_attribute_read_xml(subtree, fp);
+ }
+ else if(strcmp(type, "INT") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_INT);
+ res = fscanf(fp, " VALUE=%d/>", value.v_int);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "UINT") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_UINT);
+ res = fscanf(fp, " VALUE=%u/>", value.v_uint);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "LONG") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_LONG);
+ res = fscanf(fp, " VALUE=%ld/>", value.v_long);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "ULONG") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_ULONG);
+ res = fscanf(fp, " VALUE=%lu/>", value.v_ulong);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "FLOAT") == 0) {
+ float d;
+ value = lttv_attribute_add(self, name, LTTV_FLOAT);
+ res = fscanf(fp, " VALUE=%f/>", &d);
+ *(value.v_float) = d;
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "DOUBLE") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_DOUBLE);
+ res = fscanf(fp, " VALUE=%lf/>", value.v_double);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "TIME") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_TIME);
+ res = fscanf(fp, " SEC=%lu NSEC=%lu/>", &(value.v_time->tv_sec),
+ &(value.v_time->tv_nsec));
+ g_assert(res == 2);
+ }
+ else if(strcmp(type, "POINTER") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_POINTER);
+ res = fscanf(fp, " VALUE=%p/>", value.v_pointer);
+ g_error("Cannot read a pointer");
+ }
+ else if(strcmp(type, "STRING") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_STRING);
+ res = fscanf(fp, " VALUE=\"%256[^\"]\"/>", buffer);
+ *(value.v_string) = g_strdup(buffer);
+ g_assert(res == 1);
+ }
+ else if(strcmp(type, "GOBJECT") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_GOBJECT);
+ res = fscanf(fp, " VALUE=%p/>", value.v_gobject);
+ g_error("Cannot read a pointer");
+ }
+ else if(strcmp(type, "NONE") == 0) {
+ value = lttv_attribute_add(self, name, LTTV_NONE);
+ fscanf(fp, "/>");
+ }
+ else g_error("Unknown type to read");
+ }
+ fscanf(fp,"</ATTRS>");