source: issm/oecreview/Archive/11401-11425/ISSM-11405-11406.diff@ 15393

Last change on this file since 15393 was 11515, checked in by Eric.Larour, 13 years ago

Oecreview up to 11509

File size: 2.7 KB
RevLine 
[11515]1Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/KML/KML_Unknown.cpp
2===================================================================
3--- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/KML/KML_Unknown.cpp (revision 11405)
4+++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/KML/KML_Unknown.cpp (revision 11406)
5@@ -67,13 +67,27 @@
6 /*FUNCTION KML_Unknown::DeepEcho {{{1*/
7 void KML_Unknown::DeepEcho(const char* indent){
8
9- bool flag=true;
10+ char* valuei;
11+ char* vtoken;
12+ char nl[]={'\n','\0'};
13+ bool flag=true;
14
15 _printf_(flag,"%sKML_Unknown %s:\n",indent,name);
16 KML_Object::DeepEcho(indent);
17
18- if (value )
19- _printf_(flag,"%s value: \"%s\"\n" ,indent,value);
20+ if (value ) {
21+ valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char));
22+ memcpy(valuei,value,(strlen(value)+1)*sizeof(char));
23+
24+ vtoken=strtok(valuei,nl);
25+ _printf_(flag,"%s value: \"%s" ,indent,vtoken);
26+
27+ while (vtoken=strtok(NULL,nl))
28+ _printf_(flag,"\n%s %s" ,indent,vtoken);
29+ _printf_(flag,"\"\n");
30+
31+ xfree((void**)&valuei);
32+ }
33 else
34 _printf_(flag,"%s value: [none]\n" ,indent);
35
36@@ -83,14 +97,28 @@
37 /*FUNCTION KML_Unknown::Write {{{1*/
38 void KML_Unknown::Write(FILE* filout,const char* indent){
39
40+ char* valuei;
41+ char* vtoken;
42+ char nl[]={'\n','\0'};
43+
44 fprintf(filout,"%s<%s",indent,name);
45 WriteAttrib(filout," ");
46 fprintf(filout,">\n");
47 WriteCommnt(filout,indent);
48
49- if (value )
50- fprintf(filout,"%s %s\n",indent,value);
51+ if (value ) {
52+ valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char));
53+ memcpy(valuei,value,(strlen(value)+1)*sizeof(char));
54+
55+ vtoken=strtok(valuei,nl);
56+ fprintf(filout,"%s %s\n",indent,vtoken);
57+
58+ while (vtoken=strtok(NULL,nl))
59+ fprintf(filout,"%s %s\n",indent,vtoken);
60
61+ xfree((void**)&valuei);
62+ }
63+
64 KML_Object::Write(filout,indent);
65
66 fprintf(filout,"%s</%s>\n",indent,name);
67@@ -104,6 +132,7 @@
68 char* kstri;
69 int ncom=0;
70 char** pcom=NULL;
71+ char nl[]={'\n','\0'};
72
73 /* get object name */
74
75@@ -132,8 +161,15 @@
76 _error_("KML_Unknown::Read -- Unexpected closing tag %s.\n",kstri);
77
78 else if (strncmp(kstri,"<",1)) {
79- value=(char *) xmalloc((strlen(kstri)+1)*sizeof(char));
80- memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char));
81+ if (value) {
82+ value=(char *) xrealloc(value,(strlen(value)+1+strlen(kstri)+1)*sizeof(char));
83+ strcat(value,nl);
84+ strcat(value,kstri);
85+ }
86+ else {
87+ value=(char *) xmalloc((strlen(kstri)+1)*sizeof(char));
88+ memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char));
89+ }
90 }
91
92 else if (!strncmp(kstri,"<",1))
Note: See TracBrowser for help on using the repository browser.