Changeset 3786 for branches/1.3/gui
- Timestamp:
- Jul 12, 2013, 12:06:36 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.3/gui/src/RpPdbToVtk.c
r3665 r3786 32 32 33 33 static INLINE char * 34 GetLine(char **stringPtr, const char *endPtr )34 GetLine(char **stringPtr, const char *endPtr, int *lengthPtr) 35 35 { 36 36 char *line, *p; … … 40 40 if (*p == '\n') { 41 41 *stringPtr = p + 1; 42 *lengthPtr = p - line; 42 43 return line; 43 44 } … … 298 299 299 300 symbolIndex = elemIndex = -1; 300 301 elemName = SkipSpaces(elemName); 301 302 for (p = symbolNames; *p != NULL; p++) { 302 303 if (strcasecmp(elemName, *p) == 0) { … … 305 306 } 306 307 } 308 symbolName = SkipSpaces(symbolName); 307 309 for (p = symbolNames; *p != NULL; p++) { 308 310 if (strcasecmp(symbolName, *p) == 0) { … … 360 362 objPtr = NULL; 361 363 for (p = string, pend = p + length; p < pend; /*empty*/) { 362 char *line ;364 char *line, *q; 363 365 char c; 364 365 line = GetLine(&p, pend); 366 int lineLength; 367 368 line = GetLine(&p, pend, &lineLength); 366 369 if (line >= pend) { 367 370 break; /* EOF */ … … 381 384 int atom; 382 385 386 if (lineLength < 47) { 387 Tcl_AppendResult(interp, "short ATOM line \"", line, "\"", 388 (char *)NULL); 389 goto error; 390 } 383 391 strncpy(buf, line + 6, 5); 384 392 buf[5] = '\0'; … … 427 435 } 428 436 Tcl_ListObjAppendElement(interp, pointsObjPtr, Tcl_NewDoubleObj(z)); 429 strncpy(symbolName, line + 77, 2); 430 symbolName[2] = '\0'; 431 437 symbolName[0] = '\0'; 438 if (lineLength >= 78) { 439 symbolName[0] = line[76]; 440 symbolName[1] = line[77]; 441 symbolName[2] = '\0'; 442 } 432 443 atom = VerifyElement(SkipSpaces(atomName), SkipSpaces(symbolName)); 433 444 if (atom < 0) { 434 Tcl_AppendResult(interp, "bad atom /element \"", atomName,435 "\"\"", symbolName, "\"", (char *)NULL);445 Tcl_AppendResult(interp, "bad atom \"", atomName, 446 "\" or element \"", symbolName, "\"", (char *)NULL); 436 447 goto error; 437 448 }
Note: See TracChangeset
for help on using the changeset viewer.