X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fvisualization%2Fgalaktos%2Fpreset.c;h=e7aea345ddb48ca71c10b8c33d2c4578712eb47d;hb=cc1d1e62c5dd636338ac45a560486dfcc05f2de9;hp=3824835e82de30b531b8885d0f5f4a3d3c18d387;hpb=fe087a38282e93addb25fa9598393e40ea233b09;p=vlc diff --git a/modules/visualization/galaktos/preset.c b/modules/visualization/galaktos/preset.c index 3824835e82..e7aea345dd 100644 --- a/modules/visualization/galaktos/preset.c +++ b/modules/visualization/galaktos/preset.c @@ -19,14 +19,18 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include -#include -#include #include +#include #include #include #include "common.h" @@ -381,7 +385,6 @@ int loadPresetByFile(char * filename) { int init_idle_preset() { preset_t * preset; - int i; /* Initialize idle preset struct */ if ((preset = (preset_t*)malloc(sizeof(preset_t))) == NULL) @@ -519,7 +522,7 @@ int load_preset_file(char * pathname, preset_t * preset) { return FAILURE; /* Open the file corresponding to pathname */ - if ((fs = fopen(pathname, "r")) == 0) { + if ((fs = utf8_fopen(pathname, "r")) == NULL) { if (PRESET_DEBUG) printf("load_preset_file: loading of file %s failed!\n", pathname); return ERROR; } @@ -737,7 +740,6 @@ void reloadPerFrame(char * s, preset_t * preset) { preset_t * load_preset(char * pathname) { preset_t * preset; - int i; /* Initialize preset struct */ if ((preset = (preset_t*)malloc(sizeof(preset_t))) == NULL) @@ -791,7 +793,7 @@ void savePreset(char * filename) { return; /* Open the file corresponding to pathname */ - if ((fs = fopen(filename, "w+")) == 0) { + if ((fs = utf8_fopen(filename, "w+")) == NULL) { if (PRESET_DEBUG) printf("savePreset: failed to create filename \"%s\"!\n", filename); return; } @@ -886,15 +888,19 @@ void write_init(init_cond_t * init_cond) { sprintf(s, "%s=%d\n", init_cond->param->name, init_cond->init_val.int_val); else if (init_cond->param->type == P_TYPE_DOUBLE) - sprintf(s, "%s=%f\n", init_cond->param->name, init_cond->init_val.double_val); + { + lldiv_t div = lldiv( init_cond->init_val.double_val * 1000000,1000000 ); + sprintf(s, "%s=%"PRId64".%06u\n", init_cond->param->name, div.quot, + (unsigned int) div.rem ); + } else { printf("write_init: unknown parameter type!\n"); return; } - + len = strlen(s); if ((fwrite(s, 1, len, write_stream)) != len) printf("write_init: failed writing to file stream! Out of disk space?\n"); - + }