Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 129778 | Differences between
and this patch

Collapse All | Expand All

(-)tomatoes-1.55-orig/include/config.h (-3 / +7 lines)
Lines 30-35 Link Here
30
#ifndef CONFIG_H
30
#ifndef CONFIG_H
31
#define CONFIG_H
31
#define CONFIG_H
32
32
33
#include <string>
34
35
using namespace std;
36
33
// Config structure
37
// Config structure
34
struct CONFIG {
38
struct CONFIG {
35
	int vid_w;				// Video mode width
39
	int vid_w;				// Video mode width
Lines 59-72 Link Here
59
// config file. It first checks the user's home directory,
63
// config file. It first checks the user's home directory,
60
// and if that fails it uses the CONFIG_DIR defined in the
64
// and if that fails it uses the CONFIG_DIR defined in the
61
// makefile.
65
// makefile.
62
char *get_config_location(bool write = false);
66
string get_config_location(bool write = false);
63
67
64
68
65
// Load config from file
69
// Load config from file
66
void load_config(char *file, CONFIG *conf);
70
void load_config(string file, CONFIG *conf);
67
71
68
// Save config to file
72
// Save config to file
69
void save_config(char *file, CONFIG *conf);
73
void save_config(string file, CONFIG *conf);
70
74
71
#endif
75
#endif
72
76
(-)tomatoes-1.55-orig/src/config.cpp (-8 / +8 lines)
Lines 76-82 Link Here
76
// config file. It first checks the user's home directory,
76
// config file. It first checks the user's home directory,
77
// and if that fails it uses the CONFIG_DIR defined in the
77
// and if that fails it uses the CONFIG_DIR defined in the
78
// makefile.
78
// makefile.
79
char *get_config_location(bool write) {
79
string get_config_location(bool write) {
80
#ifdef LINUX
80
#ifdef LINUX
81
	// Get the path to the config file
81
	// Get the path to the config file
82
	string tmp = get_tomatoes_dir() + "config.cfg";
82
	string tmp = get_tomatoes_dir() + "config.cfg";
Lines 91-97 Link Here
91
		fclose(ftest);
91
		fclose(ftest);
92
	}
92
	}
93
93
94
	return (char*)tmp.c_str();
94
	return tmp;
95
#endif
95
#endif
96
96
97
	// Return the CONFIG_DIR
97
	// Return the CONFIG_DIR
Lines 100-110 Link Here
100
100
101
101
102
// Load config from file
102
// Load config from file
103
void load_config(char *file, CONFIG *conf) {
103
void load_config(string file, CONFIG *conf) {
104
104
105
	FILE *f = fopen(file, "rt");
105
	FILE *f = fopen(file.c_str(), "rt");
106
	if(!f)
106
	if(!f)
107
		error_msg("Unable to load config file: %s!", file);
107
		error_msg("Unable to load config file: %s!", file.c_str());
108
108
109
	fscanf(f, "video_mode = %d x %d\n", &(conf->vid_w), &(conf->vid_h));
109
	fscanf(f, "video_mode = %d x %d\n", &(conf->vid_w), &(conf->vid_h));
110
	fscanf(f, "video_mode_color_depth = %d\n", &(conf->vid_color_depth));
110
	fscanf(f, "video_mode_color_depth = %d\n", &(conf->vid_color_depth));
Lines 127-137 Link Here
127
127
128
128
129
// Save config to file
129
// Save config to file
130
void save_config(char *file, CONFIG *conf) {
130
void save_config(string file, CONFIG *conf) {
131
131
132
	FILE *f = fopen(file, "wt");
132
	FILE *f = fopen(file.c_str(), "wt");
133
	if(!f)
133
	if(!f)
134
		error_msg("Unable to save config file: %s!", file);
134
		error_msg("Unable to save config file: %s!", file.c_str());
135
135
136
	fprintf(f, "video_mode = %d x %d\n", (conf->vid_w), (conf->vid_h));
136
	fprintf(f, "video_mode = %d x %d\n", (conf->vid_w), (conf->vid_h));
137
	fprintf(f, "video_mode_color_depth = %d\n", (conf->vid_color_depth));
137
	fprintf(f, "video_mode_color_depth = %d\n", (conf->vid_color_depth));

Return to bug 129778