Browse Source

Merge pull request #202 from kanoi/jsonfix

save config bugfix: remove writing an extra ',' when no gpus
nfactor-troky
Con Kolivas 13 years ago
parent
commit
ad767371b7
  1. 9
      cgminer.c

9
cgminer.c

@ -2634,11 +2634,11 @@ void write_config(FILE *fcfg)
fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user); fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user);
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass); fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass);
} }
fputs("\n],\n\n", fcfg); fputs("\n]\n", fcfg);
if (nDevs) { if (nDevs) {
/* Write GPU device values */ /* Write GPU device values */
fputs("\"intensity\" : \"", fcfg); fputs(",\n\"intensity\" : \"", fcfg);
for(i = 0; i < nDevs; i++) for(i = 0; i < nDevs; i++)
fprintf(fcfg, gpus[i].dynamic ? "%sd" : "%s%d", i > 0 ? "," : "", gpus[i].intensity); fprintf(fcfg, gpus[i].dynamic ? "%sd" : "%s%d", i > 0 ? "," : "", gpus[i].intensity);
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
@ -2701,16 +2701,13 @@ void write_config(FILE *fcfg)
#endif #endif
#endif #endif
fputs("\"", fcfg); fputs("\"", fcfg);
#ifdef WANT_CPUMINE
fputs(",\n", fcfg);
#endif
} }
#ifdef HAVE_ADL #ifdef HAVE_ADL
if (opt_reorder) if (opt_reorder)
fprintf(fcfg, ",\n\"gpu-reorder\" : true"); fprintf(fcfg, ",\n\"gpu-reorder\" : true");
#endif #endif
#ifdef WANT_CPUMINE #ifdef WANT_CPUMINE
fprintf(fcfg, "\n\"algo\" : \"%s\"", algo_names[opt_algo]); fprintf(fcfg, ",\n\"algo\" : \"%s\"", algo_names[opt_algo]);
#endif #endif
/* Simple bool and int options */ /* Simple bool and int options */

Loading…
Cancel
Save