diff --git a/contrib/uiuc/plugins/molfile_plugin/src/jsplugin.c b/contrib/uiuc/plugins/molfile_plugin/src/jsplugin.c index e4285af..468411e 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/jsplugin.c +++ b/contrib/uiuc/plugins/molfile_plugin/src/jsplugin.c @@ -218,7 +218,7 @@ typedef struct { /* Use block-based I/O by default when writing structures larger */ /* than JSBLOCKIO_THRESH atoms, or when directed by the user and */ /* not otherwise prohibited... */ -static int js_blockio_check_and_set(jshandle *js) { +static void js_blockio_check_and_set(jshandle *js) { if ((getenv("VMDJSNOBLOCKIO") == NULL) && ((js->natoms > JSBLOCKIO_THRESH) || getenv("VMDJSBLOCKIO"))) { js->optflags |= JSOPT_TS_BLOCKIO; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/moldenplugin.c b/contrib/uiuc/plugins/molfile_plugin/src/moldenplugin.c index 5cca862..5f1e9f0 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/moldenplugin.c +++ b/contrib/uiuc/plugins/molfile_plugin/src/moldenplugin.c @@ -1280,7 +1280,7 @@ static int read_wave_coeffs(FILE *file, qm_wavefunction_t *wave) { // DEBUG //printf("moldenplugin) %d,%d: %d %f\n", i, AOid-1, AOid, wave_coeffs[i*wave->num_coeffs+AOid-1]); - nr2 = sscanf(buffer, "%s", &keystring); + nr2 = sscanf(buffer, "%s", keystring); if(!strcmp(keystring,"Ene=")||nr2==-1) break; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/ply.h b/contrib/uiuc/plugins/molfile_plugin/src/ply.h index 127844c..784378f 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/ply.h +++ b/contrib/uiuc/plugins/molfile_plugin/src/ply.h @@ -66,7 +66,7 @@ extern "C" { typedef struct PlyProperty { /* description of a property */ - char *name; /* property name */ + const char *name; /* property name */ int external_type; /* file's data type */ int internal_type; /* program's data type */ int offset; /* offset bytes of prop in a struct */ @@ -222,7 +222,6 @@ void set_prop_rules_ply (PlyFile *, PlyRuleList *); PlyRuleList *append_prop_rule (PlyRuleList *, char *, char *); int matches_rule_name (char *); -int equal_strings(char *, char *); char *recreate_command_line (int, char *argv[]); diff --git a/contrib/uiuc/plugins/molfile_plugin/src/ply_c.h b/contrib/uiuc/plugins/molfile_plugin/src/ply_c.h index 272d31a..31a7d5f 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/ply_c.h +++ b/contrib/uiuc/plugins/molfile_plugin/src/ply_c.h @@ -37,12 +37,12 @@ WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. #include #include -char *type_names[] = { /* names of scalar types */ +const char *type_names[] = { /* names of scalar types */ "invalid", "int8", "int16", "int32", "uint8", "uint16", "uint32", "float32", "float64", }; -char *old_type_names[] = { /* old names of types for backward compatability */ +const char *old_type_names[] = { /* old names of types for backward compatability */ "invalid", "char", "short", "int", "uchar", "ushort", "uint", "float", "double", }; @@ -60,13 +60,14 @@ int ply_type_size[] = { #define NAMED_PROP 1 /* returns 1 if strings are equal, 0 if not */ -int equal_strings(char *, char *); +static +int equal_strings(const char *, const char *); /* find an element in a plyfile's list */ -PlyElement *find_element(PlyFile *, char *); +PlyElement *find_element(PlyFile *, const char *); /* find a property in an element's list */ -PlyProperty *find_property(PlyElement *, char *, int *); +PlyProperty *find_property(PlyElement *, const char *, int *); /* write to a file the word describing a PLY file data type */ void write_scalar_type (FILE *, int); @@ -105,7 +106,7 @@ void ascii_get_element(PlyFile *, char *); void binary_get_element(PlyFile *, char *); /* memory allocation */ -static char *my_alloc(int, int, char *); +static char *my_alloc(int, int, const char *); /*************/ @@ -188,9 +189,7 @@ PlyFile *open_for_writing_ply( int file_type ) { - int i; PlyFile *plyfile; - PlyElement *elem; char *name; FILE *fp; @@ -333,9 +332,7 @@ void element_count_ply( int nelems ) { - int i; PlyElement *elem; - PlyProperty *prop; /* look for appropriate element */ elem = find_element (plyfile, elem_name); @@ -613,7 +610,6 @@ PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names) PlyFile *plyfile; int nwords; char **words; - int found_format = 0; char **elist; PlyElement *elem; char *orig_line; @@ -656,7 +652,6 @@ PlyFile *ply_read(FILE *fp, int *nelems, char ***elem_names) else return (NULL); plyfile->version = atof (words[2]); - found_format = 1; } else if (equal_strings (words[0], "element")) add_element (plyfile, words, nwords); @@ -1302,10 +1297,9 @@ void get_info_ply(PlyFile *ply, float *version, int *file_type) Compare two strings. Returns 1 if they are the same, 0 if not. ******************************************************************************/ -int equal_strings(char *s1, char *s2) +static +int equal_strings(const char *s1, const char *s2) { - int i; - while (*s1 && *s2) if (*s1++ != *s2++) return (0); @@ -1361,7 +1355,7 @@ Exit: returns the element, or NULL if not found ******************************************************************************/ -PlyElement *find_element(PlyFile *plyfile, char *element) +PlyElement *find_element(PlyFile *plyfile, const char *element) { int i; @@ -1385,7 +1379,7 @@ Exit: returns a pointer to the property, or NULL if not found ******************************************************************************/ -PlyProperty *find_property(PlyElement *elem, char *prop_name, int *index) +PlyProperty *find_property(PlyElement *elem, const char *prop_name, int *index) { int i; @@ -1416,7 +1410,6 @@ void ascii_get_element(PlyFile *plyfile, char *elem_ptr) char **words; int nwords; int which_word; - FILE *fp = plyfile->fp; char *elem_data,*item; char *item_ptr; int item_size; @@ -1697,7 +1690,6 @@ Exit: char **get_words(FILE *fp, int *nwords, char **orig_line) { #define BIG_STRING 4096 - int i,j; static char str[BIG_STRING]; static char str_copy[BIG_STRING]; char **words; @@ -2310,8 +2302,6 @@ Entry: void add_property (PlyFile *plyfile, char **words, int nwords) { - int prop_type; - int count_type; PlyProperty *prop; PlyElement *elem; @@ -2421,7 +2411,7 @@ Entry: fname - file name from which memory was requested ******************************************************************************/ -static char *my_alloc(int size, int lnum, char *fname) +static char *my_alloc(int size, int lnum, const char *fname) { char *ptr; @@ -2759,9 +2749,7 @@ void describe_element_ply( int nelems ) { - int i; PlyElement *elem; - PlyProperty *prop; /* look for appropriate element */ elem = find_element (plyfile, elem_name); @@ -2916,7 +2904,7 @@ void describe_other_elements_ply ( typedef struct RuleName { int code; - char *name; + const char *name; } RuleName; RuleName rule_name_list[] = { @@ -3043,10 +3031,6 @@ Entry: void start_props_ply (PlyFile *ply, PlyPropRules *rules) { - int i; - int count; - PlyElement *elem = rules->elem; - /* save pointer to the rules in the PLY object */ ply->current_rules = rules; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/plyplugin.cpp b/contrib/uiuc/plugins/molfile_plugin/src/plyplugin.cpp index a0f6c8e..e79fb98 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/plyplugin.cpp +++ b/contrib/uiuc/plugins/molfile_plugin/src/plyplugin.cpp @@ -44,10 +44,6 @@ typedef struct Face { void *other_props; /* other properties */ } Face; -char *elem_names[] = { /* list of the elements in the object */ - "vertex", "face" -}; - PlyProperty vert_props[] = { /* list of property information for a vertex */ {"x", Float32, Float32, offsetof(Vertex,x), 0, 0, 0, 0}, {"y", Float32, Float32, offsetof(Vertex,y), 0, 0, 0, 0}, diff --git a/contrib/uiuc/plugins/molfile_plugin/src/msmsplugin.cpp b/contrib/uiuc/plugins/molfile_plugin/src/msmsplugin.cpp index a8acdcb1d..008ad6c28 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/msmsplugin.cpp +++ b/contrib/uiuc/plugins/molfile_plugin/src/msmsplugin.cpp @@ -109,6 +109,8 @@ static void *open_file_read(const char *filepath, const char *filetype, msms->vfd = vfd; msms->graphics = NULL; *natoms = 0; + free(facefilepath); + free(vertfilepath); return msms; } diff --git a/contrib/uiuc/plugins/molfile_plugin/src/vaspoutcarplugin.c b/contrib/uiuc/plugins/molfile_plugin/src/vaspoutcarplugin.c index 7d74ba305..d981df93f 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/vaspoutcarplugin.c +++ b/contrib/uiuc/plugins/molfile_plugin/src/vaspoutcarplugin.c @@ -139,7 +139,7 @@ static int read_vaspoutcar_structure(void *mydata, int *optflags, molfile_atom_t * that contains the name of the element (H, He, C etc.). * Otherwise try to find similar mass in periodic table. */ - if (strstr(potcarfile, "OUTCAR")) { + if (strstr(data->filename, "OUTCAR")) { strcpy(potcarfile, data->filename); strcpy(strstr(potcarfile, "OUTCAR"), "POTCAR"); potcar = fopen(potcarfile, "r"); diff --git a/contrib/uiuc/plugins/molfile_plugin/src/vaspposcarplugin.c b/contrib/uiuc/plugins/molfile_plugin/src/vaspposcarplugin.c index 5bff3c70b..42f02409e 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/vaspposcarplugin.c +++ b/contrib/uiuc/plugins/molfile_plugin/src/vaspposcarplugin.c @@ -75,13 +75,14 @@ static void *open_vaspposcar_read(const char *filename, const char *filetype, in /* Read the number of atoms per atom type */ data->numatoms = 0; for (i = 0; i < MAXATOMTYPES; ++i) { - char const *tmplineptr = strdup(lineptr); + char const *tmplineptr = lineptr; char const *token = (i == 0 ? strtok(lineptr, " ") : strtok(NULL, " ")); int const n = (token ? atoi(token) : -1); /* if fails to read number of atoms, then assume VASP5 */ if (i == 0 && n <= 0) { data->version = 5; + free(data->titleline); data->titleline = strdup(tmplineptr); fgets(lineptr, LINESIZE, data->file); break; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/corplugin.c b/contrib/uiuc/plugins/molfile_plugin/src/corplugin.c index a01ea4241..9243b4f25 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/corplugin.c +++ b/contrib/uiuc/plugins/molfile_plugin/src/corplugin.c @@ -127,7 +127,7 @@ static FILE *open_cor_file(const char *fname, int *natom, int *iofoext) { return NULL; } - if (sscanf(inbuf, "%10c", header) != 1) { + if (sscanf(inbuf, "%10s", header) != 1) { fclose(f); printf("corplugin) Error opening file: improperly formatted line.\n"); return NULL; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/maeffplugin.cpp b/contrib/uiuc/plugins/molfile_plugin/src/maeffplugin.cpp index 8308fd90f..e55e6f0db 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/maeffplugin.cpp +++ b/contrib/uiuc/plugins/molfile_plugin/src/maeffplugin.cpp @@ -799,6 +799,7 @@ namespace { class AtomArray : public Array { int i_name, i_resname, i_resid, i_x, i_y, i_z, i_vx, i_vy, i_vz, + i_inscode, i_anum, i_chain, i_segid, i_charge; std::vector &atoms; std::vector &pos; @@ -811,6 +812,7 @@ namespace { i_name(-1), i_resname(-1), i_resid(-1), i_x(-1), i_y(-1), i_z(-1), i_vx(-1), i_vy(-1), i_vz(-1), + i_inscode(-1), i_anum(-1), i_chain(-1), i_segid(-1), i_charge(0), atoms( h->ctmap[m_ct].particles ), @@ -840,6 +842,7 @@ namespace { else if (attr=="m_chain_name") i_chain=i; else if (attr=="m_pdb_segment_name") i_segid=i; else if (attr=="m_formal_charge") { i_charge=i; h->optflags |= MOLFILE_CHARGE; } + else if (attr=="m_insertion_code") { i_inscode=i; } } } @@ -852,6 +855,7 @@ namespace { if (i_resid>=0) get_int(row[i_resid], a.resid); if (i_segid>=0) GET_STR(row[i_segid], a.segid); if (i_chain>=0) GET_STR(row[i_chain], a.chain); + if (i_inscode>=0) GET_STR(row[i_inscode], a.insertion); #if defined(DESRES_CTNUMBER) a.ctnumber = m_ct; diff --git a/contrib/uiuc/plugins/molfile_plugin/src/cubeplugin.cpp b/contrib/uiuc/plugins/molfile_plugin/src/cubeplugin.cpp index 5d95c4344..f6a8f02bf 100644 --- a/contrib/uiuc/plugins/molfile_plugin/src/cubeplugin.cpp +++ b/contrib/uiuc/plugins/molfile_plugin/src/cubeplugin.cpp @@ -231,7 +231,9 @@ static void *open_cube_read(const char *filepath, const char *filetype, // the cellvectors (and the coordinates) in such a way, // that the a-vector is collinear with the x-axis and // the b-vector is in the xy-plane. +#if 0 cube_buildrotmat(cube, voltmpl.origin, a, b); +#endif // print warning, if the rotation will be significant: if ((fabs((double) a[1]) + fabs((double) a[2]) + fabs((double) b[2])) > 0.001) {