Merge remote-tracking branch 'gerrit/release-4-5-patches' into release-4-6
[alexxy/gromacs.git] / src / kernel / pdb2top.c
index 98b5d13347601f7353edcff672f91b28219ce2f5..ca2f0ca61d50b774b532fa30d4549cdae678fa79 100644 (file)
@@ -410,7 +410,7 @@ void choose_watermodel(const char *wmsel,const char *ffdir,
             sfree(model[nwm]);
         }
     }
-    fclose(fp);
+    ffclose(fp);
     fprintf(stderr,"%2d: %s\n",nwm+1,"None");
 
     do
@@ -553,6 +553,7 @@ void print_top_comment(FILE *out,
   else
   {
       strncpy(ffdir_parent,ffdir,STRLEN-1);
+      ffdir_parent[STRLEN-1]='\0'; /*make sure it is 0-terminated even for long string*/
       p=strrchr(ffdir_parent,'/');
 
       *p='\0';
@@ -739,12 +740,6 @@ static void do_ssbonds(t_params *ps,t_atoms *atoms,
   }
 }
 
-static gmx_bool inter_res_bond(const t_rbonded *b)
-{
-    return (b->AI[0] == '-' || b->AI[0] == '+' ||
-            b->AJ[0] == '-' || b->AJ[0] == '+');
-}
-
 static void at2bonds(t_params *psb, t_hackblock *hb,
                      t_atoms *atoms,
                      rvec x[],
@@ -1357,7 +1352,7 @@ static void gen_cmap(t_params *psb, t_restp *restp, t_atoms *atoms, gmx_residuet
     int nres = atoms->nres;
     gmx_bool bAddCMAP;
     atom_id cmap_atomid[NUM_CMAP_ATOMS];
-    int cmap_chainnum, this_residue_index;
+    int cmap_chainnum=-1, this_residue_index;
 
        if (debug)
                ptr = "cmap";