Skip to content

Commit ed5dffc

Browse files
committed
further removal of warnings
1 parent 8108008 commit ed5dffc

2 files changed

Lines changed: 22 additions & 62 deletions

File tree

src/setupSM.cpp

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,10 @@ void printsppct(stringPM *A, int t){
214214

215215
int run_one_comass_trial(const int rr, stringPM *A, int * params, struct runparams *R){
216216

217-
218-
FILE *mc;char fn[256],pfn[256];FILE *ftmp;
219-
//sprintf(fn,"maxcodes%03d.txt",rr);
220-
//mc = fopen(fn,"w");
221-
//fclose(mc);
222-
217+
char pfn[256];FILE *ftmp;
223218

224219
int *maxcode;
220+
225221
//todo: what is the relationship between maxcode and params...?
226222
//if(!rr)
227223
maxcode = (int *) malloc(A->blosum->N * sizeof(int));
@@ -314,30 +310,6 @@ void setmaxcode(stringPM *A, int *maxcode){
314310
//}
315311

316312

317-
int make_mtx_file(char *fn, char *basisfn, int **mut, const int N){
318-
FILE *in,*out;
319-
char line[2048];
320-
int ncodes;
321-
//int **mut;
322-
in = fopen(basisfn,"r");
323-
out = fopen(fn,"w");
324-
325-
//Get the 1st line - it contains the codes:
326-
fscanf(in,line);
327-
ncodes = strlen(line);
328-
fprintf(out,"%s\n",line);
329-
330-
//Copy the sw table
331-
for(int i=0;i<ncodes+1;i++){
332-
fscanf(in,line);
333-
fprintf(out,"%s\n",line);
334-
}
335-
336-
//print the mutation network
337-
338-
return 0;
339-
}
340-
341313
void setmutnet(int * mutnet, swt *blosum){
342314

343315
int i,j;
@@ -385,7 +357,8 @@ float **swdt(stringPM * A, stringPM * B,s_sw **spp_matches, int *mol_class, floa
385357
if(swa==NULL){
386358
swa = read_sw(*spp_matches,pB->spp,pA->spp);
387359
if(swa==NULL){
388-
float bprob = SmithWatermanV2(pA->S,pB->S,&sw,A->blosum,0);
360+
//TODO: this returns a float - we don't use it...
361+
SmithWatermanV2(pA->S,pB->S,&sw,A->blosum,0);
389362

390363
lB = strlen(pB->S);
391364
L = lA>lB?lA:lB;
@@ -641,7 +614,7 @@ void init_randseed_config(int argc, char *argv[]){
641614
memset(test,0,128*sizeof(char));
642615
sprintf(test,"-873302838");
643616
long dummy;
644-
sscanf(test,"%d",&dummy);
617+
sscanf(test,"%ld",&dummy);
645618
//printf("Random seed is %d\n",dummy);
646619
//printf("Random seed is %lu (unsigned)\n",dummy);
647620

@@ -691,7 +664,7 @@ void init_randseed_config(int argc, char *argv[]){
691664
//todo: SmPm_AlifeXII() should call this
692665
int run_one_AlifeXII_trial(stringPM *A){
693666

694-
int i,div;
667+
int i;
695668

696669

697670

src/stringPM.cpp

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -548,10 +548,10 @@ int stringPM::load_agents(char *fn, char *fntab, int test, int verbose){
548548
l_spp *s;
549549

550550
//TODO: Should be passing 'code' into this, not 'lab'..
551-
pag = make_ag(lab);//,1);
551+
pag = make_ag(code);//,1);
552552

553553
pag->S =(char *) malloc(maxl0*sizeof(char));
554-
pag->label = code;
554+
555555
memset(pag->S,0,maxl0*sizeof(char));
556556

557557
if(strlen(label) > maxl0){
@@ -749,14 +749,12 @@ void stringPM::print_spp_count(FILE *fp,int style, int state){
749749

750750
void stringPM::get_spp_count(int state){
751751

752-
//char fn[128];
753-
s_ag *pa;
754752
int nag,*done;
755753
int *spno, *spct, nspp = count_spp();
756754

757755
nag = nagents(nowhead,-1);
758756

759-
l_spp *pA;
757+
l_spp *pSpp;
760758

761759
done = (int *) malloc(nag*sizeof(int));
762760
memset(done,0,nag*sizeof(int));
@@ -767,14 +765,14 @@ void stringPM::get_spp_count(int state){
767765
memset(spct,0,nspp*sizeof(int));
768766

769767
//Set the spl->count param to zero
770-
for(pA=spl->species;pA!=NULL;pA=pA->next){
771-
pA->count = 0;
768+
for(pSpp=spl->species;pSpp!=NULL;pSpp=pSpp->next){
769+
pSpp->count = 0;
772770
}
773771

774772

775773
s_ag *p;
776774
for(p = nowhead;p!=NULL;p=p->next){
777-
if(state==-1 || pa->status == state){
775+
if(state==-1 || p->status == state){
778776
p->spp->count++;
779777
}
780778
}
@@ -1006,7 +1004,7 @@ s_ag * stringPM::rand_ag(s_ag *head, int state){
10061004
* parameters:
10071005
*
10081006
* alab: a single-character label for the string (e.g. 'C')
1009-
* randpos: unused ...
1007+
*
10101008
*/
10111009
s_ag * stringPM::make_ag(int alab){
10121010

@@ -2969,6 +2967,8 @@ int stringPM::load_comass(char *fn, int verbose){
29692967
mass = (int*) malloc(blosum->N * sizeof(int));
29702968

29712969
if((fp=fopen(fn,"r"))!=NULL){
2970+
2971+
//todo: do something with the error...
29722972
finderr=read_param_int(fp,"MASS",&massval,verbose);
29732973
fclose(fp);
29742974
//Load the massvalue into the mass table;
@@ -2985,11 +2985,8 @@ int stringPM::load_comass(char *fn, int verbose){
29852985

29862986

29872987
int stringPM::set_mass(int *param){
2988-
//int massval = 2000;
2989-
FILE *fp;
2990-
int finderr;
2988+
29912989
int i;
2992-
int massval;
29932990

29942991
mass = (int*) malloc(blosum->N * sizeof(int));
29952992

@@ -3329,8 +3326,8 @@ int stringPM::energetic_exec_step(s_ag *act, s_ag *pass){//pset *p,char *s1, swt
33293326

33303327

33313328

3332-
return 1;
3333-
//return finished;
3329+
//return 1;
3330+
return finished;
33343331
}
33353332

33363333

@@ -3394,7 +3391,6 @@ int stringPM::energetic_testbind(s_ag *pag){
33943391

33953392
void stringPM::energetic_make_next(){
33963393
s_ag *pag,*bag;
3397-
s_bind bb;
33983394
int changed;
33993395
while(nowhead!=NULL){
34003396

@@ -3404,7 +3400,6 @@ void stringPM::energetic_make_next(){
34043400

34053401
//extract any partner:
34063402
bag = NULL;
3407-
bb = pag->status;
34083403
switch(pag->status){
34093404
case B_UNBOUND:
34103405
break;
@@ -4257,15 +4252,12 @@ int stringPM::Network_cleave(s_ag *act){
42574252

42584253

42594254

4260-
4255+
/* Used to calculate a network...needs work*/
42614256
int stringPM::Network_exec_step(s_ag *act, s_ag *pass){
42624257

42634258
int finished=0;
42644259
char *tmp; //Holds the modifier, where needed
4265-
//s_ag *c;
4266-
//int cpy;
42674260
int dac=0;
4268-
int safe_append=1;
42694261

42704262
switch(*(act->i[act->it])){
42714263

@@ -4377,7 +4369,6 @@ int stringPM::Network_exec_step(s_ag *act, s_ag *pass){
43774369
//unbind_ag(act);
43784370
//unbind_ag(pass);
43794371
finished = 1;
4380-
safe_append=0; //extract_ag(&nowhead,p);
43814372
}
43824373
break;
43834374

@@ -4405,8 +4396,7 @@ int stringPM::Network_exec_step(s_ag *act, s_ag *pass){
44054396
// print_exec(stdout,act,pass);
44064397
//#endif
44074398

4408-
return 1;
4409-
//return finished;
4399+
return finished;
44104400
}
44114401

44124402
void stringPM::get_spp_network(char *fn){
@@ -4592,7 +4582,7 @@ void stringPM::set_epochs(){
45924582
int stringPM::share_agents(s_ag **hp){
45934583

45944584
s_ag *pa,**head,*tmp,*aa,*tmphead;
4595-
int ntot=0,herect=0,therect=0,*pct,*nact;
4585+
int ntot=0,herect=0,therect=0;
45964586
float rno;
45974587

45984588
tmphead = *hp;
@@ -4606,12 +4596,10 @@ int stringPM::share_agents(s_ag **hp){
46064596
if((rno = rand0to1()) < 0.5){
46074597
head = hp;
46084598
therect++;
4609-
nact = &therect;
46104599
}
46114600
else{
46124601
head = &nowhead;
46134602
herect++;
4614-
nact = &herect;
46154603
}
46164604

46174605
//Move it and any partners.
@@ -4632,7 +4620,6 @@ int stringPM::share_agents(s_ag **hp){
46324620
}
46334621

46344622
if(aa){
4635-
*pct++;
46364623
ntot++;
46374624
if(tmp==aa)
46384625
tmp=tmp->next;
@@ -4764,7 +4751,7 @@ int stringPM::print_conf(FILE *fp){
47644751
USING /n/staff/sjh/current/ewSTRING/SMconfigs/instr_set1.mis
47654752
*/
47664753
fprintf(fp,"%%%%%%AUTOMATICALLY GENERATED Stringmol CONFIG FILE\n");
4767-
fprintf(fp,"%%%%%%Generated at time: %d\n\n",extit);
4754+
fprintf(fp,"%%%%%%Generated at time: %ld\n\n",extit);
47684755
fprintf(fp,"%%%%%%CELL PARAMETERS\n");
47694756
fprintf(fp,"CELLRAD %d\n",(int) cellrad);
47704757
fprintf(fp,"AGRAD %d\n",(int) agrad);

0 commit comments

Comments
 (0)