Package: qutemol / 0.4.1~cvs20081111-15

10_hardsettings.cpp.patch Patch series | download
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
Description: Modifications to src/HardSettings.cpp
 Fix spelling error: 'tranparent' instead of 'transparent'
Author: Morten Kjeldgaard <mok@bioxray.au.dk>
Author: Graham Inggs <ginggs@debian.org>
Last-Update: 2017-12-25

--- a/src/HardSettings.cpp
+++ b/src/HardSettings.cpp
@@ -50,8 +50,7 @@
 };
 
 
-
-static char* names[NNAMES]={
+static const char* names[NNAMES]={
   "TSIZE",
   "MAX_TSIZE",
   "N_VIEW_DIR",
@@ -122,7 +121,7 @@
 }
 
 
-static char* comments[NNAMES]={
+static const char* comments[NNAMES]={
   "favoured texture size for molecule",
   "maximal texture size (used when molecule too large for TSIZE)",
   "number of view directions ussed in AO computation",
@@ -135,7 +134,7 @@
  
   "snapshots resolution (per side)",
   "if 1, antialias exported snapshots",
-  "if 1, save PNG images with tranparent background",
+  "if 1, save PNG images with transparent background",
  
     
   "resolution of exported GIF animations",
@@ -158,8 +157,13 @@
 
 
 
-bool HardSettings::Load(char *fn){
-  FILE *f=fopen(fn,"rt");
+bool HardSettings::Load(const char *fn){
+  char buf[512];
+  strcpy(buf, PKGDATADIR);
+  if (buf[strlen(buf)-1] != '/') {
+    strcat(buf,"/");
+  }
+  FILE *f=fopen(strcat(buf,fn),"rt");
   
   bool present[NNAMES];
   for (int i=0; i<NNAMES; i++) present[i]=false;
@@ -169,7 +173,7 @@
   if (!f) return false;
   char token[255];
   char last[255];
-  last[0]==0;
+  last[0]=0;
   while (1){
     if (fscanf(f,"%s",token)!=1) break;
     if (token[0]=='=') {
@@ -197,7 +201,7 @@
   return true;
 }
 
-bool HardSettings::Save(char *fn){
+bool HardSettings::Save(const char *fn){
   FILE *f=fopen(fn,"wt");
   
   static HardSettings defaults;
@@ -216,7 +220,7 @@
   return true;
 }
 
-bool HardSettings::OnStart(){
+void HardSettings::OnStart(){
   SetDefaults();
   if (!Load("qutemol.cfg")) {
     Save("qutemol.cfg");