Changeset 11406
- Timestamp:
- 02/13/12 11:36:44 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/KML/KML_Unknown.cpp
r11343 r11406 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); … … 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," "); … … 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); 118 119 xfree((void**)&valuei); 120 } 93 121 94 122 KML_Object::Write(filout,indent); … … 105 133 int ncom=0; 106 134 char** pcom=NULL; 135 char nl[]={'\n','\0'}; 107 136 108 137 /* get object name */ … … 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
Note:
See TracChangeset
for help on using the changeset viewer.