source:
issm/oecreview/Archive/11401-11425/ISSM-11405-11406.diff@
13980
Last change on this file since 13980 was 11515, checked in by , 13 years ago | |
---|---|
File size: 2.7 KB |
-
proj/ice/larour/issm-uci-clean/trunk-jpl/src/c/objects/KML/KML_Unknown.cpp
67 67 /*FUNCTION KML_Unknown::DeepEcho {{{1*/ 68 68 void KML_Unknown::DeepEcho(const char* indent){ 69 69 70 bool flag=true; 70 char* valuei; 71 char* vtoken; 72 char nl[]={'\n','\0'}; 73 bool flag=true; 71 74 72 75 _printf_(flag,"%sKML_Unknown %s:\n",indent,name); 73 76 KML_Object::DeepEcho(indent); 74 77 75 if (value ) 76 _printf_(flag,"%s value: \"%s\"\n" ,indent,value); 78 if (value ) { 79 valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char)); 80 memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); 81 82 vtoken=strtok(valuei,nl); 83 _printf_(flag,"%s value: \"%s" ,indent,vtoken); 84 85 while (vtoken=strtok(NULL,nl)) 86 _printf_(flag,"\n%s %s" ,indent,vtoken); 87 _printf_(flag,"\"\n"); 88 89 xfree((void**)&valuei); 90 } 77 91 else 78 92 _printf_(flag,"%s value: [none]\n" ,indent); 79 93 … … 83 97 /*FUNCTION KML_Unknown::Write {{{1*/ 84 98 void KML_Unknown::Write(FILE* filout,const char* indent){ 85 99 100 char* valuei; 101 char* vtoken; 102 char nl[]={'\n','\0'}; 103 86 104 fprintf(filout,"%s<%s",indent,name); 87 105 WriteAttrib(filout," "); 88 106 fprintf(filout,">\n"); 89 107 WriteCommnt(filout,indent); 90 108 91 if (value ) 92 fprintf(filout,"%s %s\n",indent,value); 109 if (value ) { 110 valuei=(char *) xmalloc((strlen(value)+1)*sizeof(char)); 111 memcpy(valuei,value,(strlen(value)+1)*sizeof(char)); 112 113 vtoken=strtok(valuei,nl); 114 fprintf(filout,"%s %s\n",indent,vtoken); 115 116 while (vtoken=strtok(NULL,nl)) 117 fprintf(filout,"%s %s\n",indent,vtoken); 93 118 119 xfree((void**)&valuei); 120 } 121 94 122 KML_Object::Write(filout,indent); 95 123 96 124 fprintf(filout,"%s</%s>\n",indent,name); … … 104 132 char* kstri; 105 133 int ncom=0; 106 134 char** pcom=NULL; 135 char nl[]={'\n','\0'}; 107 136 108 137 /* get object name */ 109 138 … … 132 161 _error_("KML_Unknown::Read -- Unexpected closing tag %s.\n",kstri); 133 162 134 163 else if (strncmp(kstri,"<",1)) { 135 value=(char *) xmalloc((strlen(kstri)+1)*sizeof(char)); 136 memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char)); 164 if (value) { 165 value=(char *) xrealloc(value,(strlen(value)+1+strlen(kstri)+1)*sizeof(char)); 166 strcat(value,nl); 167 strcat(value,kstri); 168 } 169 else { 170 value=(char *) xmalloc((strlen(kstri)+1)*sizeof(char)); 171 memcpy(value,kstri,(strlen(kstri)+1)*sizeof(char)); 172 } 137 173 } 138 174 139 175 else if (!strncmp(kstri,"<",1))
Note:
See TracBrowser
for help on using the repository browser.