File: post.patch

package info (click to toggle)
pymol 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 42,288 kB
  • sloc: cpp: 476,472; python: 76,538; ansic: 29,510; javascript: 6,792; sh: 47; makefile: 24
file content (348 lines) | stat: -rw-r--r-- 13,195 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
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 <string.h>
 #include <ply.h>
 
-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<molfile_atom_t> &atoms;
     std::vector<pos_t> &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) {