mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	build: remove extern "C" linkage
No more C source files, no more necessity to use C-linkage. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									03b910ee7f
								
							
						
					
					
						commit
						b56dd13add
					
				
					 104 changed files with 364 additions and 577 deletions
				
			
		|  | @ -401,7 +401,6 @@ close to our coding standards. | |||
| filetype plugin indent on | ||||
| filetype detect | ||||
| set cindent tabstop=8 shiftwidth=8 cinoptions=l1,:0,(0,g0 | ||||
| " TODO: extern "C" gets indented | ||||
| 
 | ||||
| " And some sane defaults, optional, but quite nice | ||||
| set nocompatible | ||||
|  |  | |||
|  | @ -41,8 +41,6 @@ static std::string make_default_filename() | |||
| 	return system_default_path() + "/subsurface.xml"; | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| const char android_system_divelist_default_font[] = "Roboto"; | ||||
| const char *system_divelist_default_font = android_system_divelist_default_font; | ||||
| double system_divelist_default_font_size = -1; | ||||
|  | @ -251,7 +249,6 @@ bool subsurface_user_is_root() | |||
| { | ||||
| 	return false; | ||||
| } | ||||
| } | ||||
| 
 | ||||
| /* called from QML manager */ | ||||
| void checkPendingIntents() | ||||
|  |  | |||
|  | @ -200,7 +200,7 @@ void CheckCloudConnection::gotContinent(QNetworkReply *reply) | |||
| } | ||||
| 
 | ||||
| // helper to be used from C code
 | ||||
| extern "C" bool canReachCloudServer(struct git_info *info) | ||||
| bool canReachCloudServer(struct git_info *info) | ||||
| { | ||||
| 	if (verbose) | ||||
| 		qWarning() << "Cloud storage: checking connection to cloud server" << info->url.c_str(); | ||||
|  |  | |||
|  | @ -216,7 +216,7 @@ static double vpmb_tolerated_ambient_pressure(struct deco_state *ds, double refe | |||
| 	return ds->tissue_n2_sat[ci] + ds->tissue_he_sat[ci] + vpmb_config.other_gases_pressure - total_gradient; | ||||
| } | ||||
| 
 | ||||
| extern "C" double tissue_tolerance_calc(struct deco_state *ds, const struct dive *dive, double pressure, bool in_planner) | ||||
| double tissue_tolerance_calc(struct deco_state *ds, const struct dive *dive, double pressure, bool in_planner) | ||||
| { | ||||
| 	int ci = -1; | ||||
| 	double ret_tolerance_limit_ambient_pressure = 0.0; | ||||
|  | @ -323,7 +323,7 @@ static double calc_surface_phase(double surface_pressure, double he_pressure, do | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void vpmb_start_gradient(struct deco_state *ds) | ||||
| void vpmb_start_gradient(struct deco_state *ds) | ||||
| { | ||||
| 	int ci; | ||||
| 
 | ||||
|  | @ -333,7 +333,7 @@ extern "C" void vpmb_start_gradient(struct deco_state *ds) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_pressure, bool in_planner) | ||||
| void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_pressure, bool in_planner) | ||||
| { | ||||
| 	int ci; | ||||
| 	double n2_b, n2_c; | ||||
|  | @ -379,7 +379,7 @@ static double solve_cubic(double A, double B, double C) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| extern "C" void nuclear_regeneration(struct deco_state *ds, double time) | ||||
| void nuclear_regeneration(struct deco_state *ds, double time) | ||||
| { | ||||
| 	time /= 60.0; | ||||
| 	int ci; | ||||
|  | @ -411,7 +411,7 @@ static double calc_inner_pressure(double crit_radius, double onset_tension, doub | |||
| } | ||||
| 
 | ||||
| // Calculates the crushing pressure in the given moment. Updates crushing_onset_tension and critical radius if needed
 | ||||
| extern "C" void calc_crushing_pressure(struct deco_state *ds, double pressure) | ||||
| void calc_crushing_pressure(struct deco_state *ds, double pressure) | ||||
| { | ||||
| 	int ci; | ||||
| 	double gradient; | ||||
|  | @ -443,7 +443,7 @@ extern "C" void calc_crushing_pressure(struct deco_state *ds, double pressure) | |||
| } | ||||
| 
 | ||||
| /* add period_in_seconds at the given pressure and gas to the deco calculation */ | ||||
| extern "C" void add_segment(struct deco_state *ds, double pressure, struct gasmix gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int, bool in_planner) | ||||
| void add_segment(struct deco_state *ds, double pressure, struct gasmix gasmix, int period_in_seconds, int ccpo2, enum divemode_t divemode, int, bool in_planner) | ||||
| { | ||||
| 	int ci; | ||||
| 	struct gas_pressures pressures; | ||||
|  | @ -476,7 +476,7 @@ extern "C" void add_segment(struct deco_state *ds, double pressure, struct gasmi | |||
| } | ||||
| 
 | ||||
| #if DECO_CALC_DEBUG | ||||
| extern "C" void dump_tissues(struct deco_state *ds) | ||||
| void dump_tissues(struct deco_state *ds) | ||||
| { | ||||
| 	int ci; | ||||
| 	printf("N2 tissues:"); | ||||
|  | @ -489,7 +489,7 @@ extern "C" void dump_tissues(struct deco_state *ds) | |||
| } | ||||
| #endif | ||||
| 
 | ||||
| extern "C" void clear_vpmb_state(struct deco_state *ds) | ||||
| void clear_vpmb_state(struct deco_state *ds) | ||||
| { | ||||
| 	int ci; | ||||
| 	for (ci = 0; ci < 16; ci++) { | ||||
|  | @ -501,7 +501,7 @@ extern "C" void clear_vpmb_state(struct deco_state *ds) | |||
| 	ds->max_bottom_ceiling_pressure.mbar = 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void clear_deco(struct deco_state *ds, double surface_pressure, bool in_planner) | ||||
| void clear_deco(struct deco_state *ds, double surface_pressure, bool in_planner) | ||||
| { | ||||
| 	int ci; | ||||
| 
 | ||||
|  | @ -545,7 +545,7 @@ void deco_state_cache::restore(struct deco_state *target, bool keep_vpmb_state) | |||
| 	*target = *data; | ||||
| } | ||||
| 
 | ||||
| extern "C" int deco_allowed_depth(double tissues_tolerance, double surface_pressure, const struct dive *dive, bool smooth) | ||||
| int deco_allowed_depth(double tissues_tolerance, double surface_pressure, const struct dive *dive, bool smooth) | ||||
| { | ||||
| 	int depth; | ||||
| 	double pressure_delta; | ||||
|  | @ -564,7 +564,7 @@ extern "C" int deco_allowed_depth(double tissues_tolerance, double surface_press | |||
| 	return depth; | ||||
| } | ||||
| 
 | ||||
| extern "C" void set_gf(short gflow, short gfhigh) | ||||
| void set_gf(short gflow, short gfhigh) | ||||
| { | ||||
| 	if (gflow != -1) | ||||
| 		buehlmann_config.gf_low = (double)gflow / 100.0; | ||||
|  | @ -572,7 +572,7 @@ extern "C" void set_gf(short gflow, short gfhigh) | |||
| 		buehlmann_config.gf_high = (double)gfhigh / 100.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void set_vpmb_conservatism(short conservatism) | ||||
| void set_vpmb_conservatism(short conservatism) | ||||
| { | ||||
| 	if (conservatism < 0) | ||||
| 		vpmb_config.conservatism = 0; | ||||
|  | @ -582,7 +582,7 @@ extern "C" void set_vpmb_conservatism(short conservatism) | |||
| 		vpmb_config.conservatism = conservatism; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_gf(struct deco_state *ds, double ambpressure_bar, const struct dive *dive) | ||||
| double get_gf(struct deco_state *ds, double ambpressure_bar, const struct dive *dive) | ||||
| { | ||||
| 	double surface_pressure_bar = get_surface_pressure_in_mbar(dive, true) / 1000.0; | ||||
| 	double gf_low = buehlmann_config.gf_low; | ||||
|  | @ -596,7 +596,7 @@ extern "C" double get_gf(struct deco_state *ds, double ambpressure_bar, const st | |||
| 	return gf; | ||||
| } | ||||
| 
 | ||||
| extern "C" double regressiona(const struct deco_state *ds) | ||||
| double regressiona(const struct deco_state *ds) | ||||
| { | ||||
| 	if (ds->sum1 > 1) { | ||||
| 		double avxy = ds->sumxy / ds->sum1; | ||||
|  | @ -609,7 +609,7 @@ extern "C" double regressiona(const struct deco_state *ds) | |||
| 		return 0.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" double regressionb(const struct deco_state *ds) | ||||
| double regressionb(const struct deco_state *ds) | ||||
| { | ||||
| 	if (ds->sum1) | ||||
| 		return ds->sumy / ds->sum1 - ds->sumx * regressiona(ds) / ds->sum1; | ||||
|  | @ -617,14 +617,14 @@ extern "C" double regressionb(const struct deco_state *ds) | |||
| 		return 0.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void reset_regression(struct deco_state *ds) | ||||
| void reset_regression(struct deco_state *ds) | ||||
| { | ||||
| 	ds->sum1 = 0; | ||||
| 	ds->sumxx = ds->sumx = 0L; | ||||
| 	ds->sumy = ds->sumxy = 0.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void update_regression(struct deco_state *ds, const struct dive *dive) | ||||
| void update_regression(struct deco_state *ds, const struct dive *dive) | ||||
| { | ||||
| 	if (!ds->plot_depth) | ||||
| 		return; | ||||
|  |  | |||
|  | @ -7,8 +7,6 @@ | |||
| #include "divemode.h" | ||||
| #include <memory> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| struct divecomputer; | ||||
| struct decostop; | ||||
|  | @ -69,8 +67,6 @@ extern double regressionb(const struct deco_state *ds); | |||
| extern void reset_regression(struct deco_state *ds); | ||||
| extern void update_regression(struct deco_state *ds, const struct dive *dive); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| struct deco_state_cache { | ||||
| 	// Test if there is cached data
 | ||||
| 	operator bool () { | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ bool device::operator<(const device &a) const | |||
| 	return serialNumber < a.serialNumber; | ||||
| } | ||||
| 
 | ||||
| extern "C" const struct device *get_device_for_dc(const struct device_table *table, const struct divecomputer *dc) | ||||
| const struct device *get_device_for_dc(const struct device_table *table, const struct divecomputer *dc) | ||||
| { | ||||
| 	if (!dc->model || !dc->serial) | ||||
| 		return NULL; | ||||
|  | @ -38,7 +38,7 @@ extern "C" const struct device *get_device_for_dc(const struct device_table *tab | |||
| 	return it != dcs.end() && same_device(*it, dev) ? &*it : NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_or_add_device_for_dc(struct device_table *table, const struct divecomputer *dc) | ||||
| int get_or_add_device_for_dc(struct device_table *table, const struct divecomputer *dc) | ||||
| { | ||||
| 	if (!dc->model || !dc->serial) | ||||
| 		return -1; | ||||
|  | @ -50,7 +50,7 @@ extern "C" int get_or_add_device_for_dc(struct device_table *table, const struct | |||
| 	return create_device_node(table, dc->model, dc->serial, ""); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool device_exists(const struct device_table *device_table, const struct device *dev) | ||||
| bool device_exists(const struct device_table *device_table, const struct device *dev) | ||||
| { | ||||
| 	auto it = std::lower_bound(device_table->devices.begin(), device_table->devices.end(), *dev); | ||||
| 	return it != device_table->devices.end() && same_device(*it, *dev); | ||||
|  | @ -86,17 +86,17 @@ static int addDC(std::vector<device> &dcs, const std::string &m, const std::stri | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" int create_device_node(struct device_table *device_table, const char *model, const char *serial, const char *nickname) | ||||
| int create_device_node(struct device_table *device_table, const char *model, const char *serial, const char *nickname) | ||||
| { | ||||
| 	return addDC(device_table->devices, model ?: "", serial ?: "", nickname ?: ""); | ||||
| } | ||||
| 
 | ||||
| extern "C" int add_to_device_table(struct device_table *device_table, const struct device *dev) | ||||
| int add_to_device_table(struct device_table *device_table, const struct device *dev) | ||||
| { | ||||
| 	return create_device_node(device_table, dev->model.c_str(), dev->serialNumber.c_str(), dev->nickName.c_str()); | ||||
| } | ||||
| 
 | ||||
| extern "C" int remove_device(struct device_table *device_table, const struct device *dev) | ||||
| int remove_device(struct device_table *device_table, const struct device *dev) | ||||
| { | ||||
| 	auto it = std::lower_bound(device_table->devices.begin(), device_table->devices.end(), *dev); | ||||
| 	if (it != device_table->devices.end() && same_device(*it, *dev)) { | ||||
|  | @ -108,20 +108,20 @@ extern "C" int remove_device(struct device_table *device_table, const struct dev | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void remove_from_device_table(struct device_table *device_table, int idx) | ||||
| void remove_from_device_table(struct device_table *device_table, int idx) | ||||
| { | ||||
| 	if (idx < 0 || idx >= (int)device_table->devices.size()) | ||||
| 		return; | ||||
| 	device_table->devices.erase(device_table->devices.begin() + idx); | ||||
| } | ||||
| 
 | ||||
| extern "C" void clear_device_table(struct device_table *device_table) | ||||
| void clear_device_table(struct device_table *device_table) | ||||
| { | ||||
| 	device_table->devices.clear(); | ||||
| } | ||||
| 
 | ||||
| /* Returns whether the given device is used by a selected dive. */ | ||||
| extern "C" bool device_used_by_selected_dive(const struct device *dev) | ||||
| bool device_used_by_selected_dive(const struct device *dev) | ||||
| { | ||||
| 	for (dive *d: getDiveSelection()) { | ||||
| 		struct divecomputer *dc; | ||||
|  | @ -133,7 +133,7 @@ extern "C" bool device_used_by_selected_dive(const struct device *dev) | |||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| extern "C" int is_default_dive_computer_device(const char *name) | ||||
| int is_default_dive_computer_device(const char *name) | ||||
| { | ||||
| 	return qPrefDiveComputer::device() == name; | ||||
| } | ||||
|  | @ -148,46 +148,46 @@ const char *get_dc_nickname(const struct divecomputer *dc) | |||
| 		return dc->model; | ||||
| } | ||||
| 
 | ||||
| extern "C" int nr_devices(const struct device_table *table) | ||||
| int nr_devices(const struct device_table *table) | ||||
| { | ||||
| 	return (int)table->devices.size(); | ||||
| } | ||||
| 
 | ||||
| extern "C" const struct device *get_device(const struct device_table *table, int i) | ||||
| const struct device *get_device(const struct device_table *table, int i) | ||||
| { | ||||
| 	if (i < 0 || i > nr_devices(table)) | ||||
| 		return NULL; | ||||
| 	return &table->devices[i]; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct device *get_device_mutable(struct device_table *table, int i) | ||||
| struct device *get_device_mutable(struct device_table *table, int i) | ||||
| { | ||||
| 	if (i < 0 || i > nr_devices(table)) | ||||
| 		return NULL; | ||||
| 	return &table->devices[i]; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *device_get_model(const struct device *dev) | ||||
| const char *device_get_model(const struct device *dev) | ||||
| { | ||||
| 	return dev ? dev->model.c_str() : NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *device_get_serial(const struct device *dev) | ||||
| const char *device_get_serial(const struct device *dev) | ||||
| { | ||||
| 	return dev ? dev->serialNumber.c_str() : NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *device_get_nickname(const struct device *dev) | ||||
| const char *device_get_nickname(const struct device *dev) | ||||
| { | ||||
| 	return dev ? dev->nickName.c_str() : NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct device_table *alloc_device_table() | ||||
| struct device_table *alloc_device_table() | ||||
| { | ||||
| 	return new struct device_table; | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_device_table(struct device_table *devices) | ||||
| void free_device_table(struct device_table *devices) | ||||
| { | ||||
| 	delete devices; | ||||
| } | ||||
|  | @ -202,7 +202,7 @@ bool fingerprint_record::operator<(const fingerprint_record &a) const | |||
| 
 | ||||
| // annoyingly, the Cressi Edy doesn't support a serial number (it's always 0), but still uses fingerprints
 | ||||
| // so we can't bail on the serial number being 0
 | ||||
| extern "C" unsigned int get_fingerprint_data(const struct fingerprint_table *table, uint32_t model, uint32_t serial, const unsigned char **fp_out) | ||||
| unsigned int get_fingerprint_data(const struct fingerprint_table *table, uint32_t model, uint32_t serial, const unsigned char **fp_out) | ||||
| { | ||||
| 	if (model == 0 || fp_out == nullptr) | ||||
| 		return 0; | ||||
|  | @ -219,7 +219,7 @@ extern "C" unsigned int get_fingerprint_data(const struct fingerprint_table *tab | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void create_fingerprint_node(struct fingerprint_table *table, uint32_t model, uint32_t serial, | ||||
| void create_fingerprint_node(struct fingerprint_table *table, uint32_t model, uint32_t serial, | ||||
| 				       const unsigned char *raw_data_in, unsigned int fsize, uint32_t fdeviceid, uint32_t fdiveid) | ||||
| { | ||||
| 	// since raw data can contain \0 we copy this manually, not as string
 | ||||
|  | @ -245,7 +245,7 @@ extern "C" void create_fingerprint_node(struct fingerprint_table *table, uint32_ | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void create_fingerprint_node_from_hex(struct fingerprint_table *table, uint32_t model, uint32_t serial, | ||||
| void create_fingerprint_node_from_hex(struct fingerprint_table *table, uint32_t model, uint32_t serial, | ||||
| 						const char *hex_data, uint32_t fdeviceid, uint32_t fdiveid) | ||||
| { | ||||
| 	QByteArray raw = QByteArray::fromHex(hex_data); | ||||
|  | @ -253,33 +253,33 @@ extern "C" void create_fingerprint_node_from_hex(struct fingerprint_table *table | |||
| 				(const unsigned char *)raw.constData(), raw.size(), fdeviceid, fdiveid); | ||||
| } | ||||
| 
 | ||||
| extern "C" int nr_fingerprints(struct fingerprint_table *table) | ||||
| int nr_fingerprints(struct fingerprint_table *table) | ||||
| { | ||||
| 	return table->fingerprints.size(); | ||||
| } | ||||
| 
 | ||||
| extern "C" uint32_t fp_get_model(struct fingerprint_table *table, unsigned int i) | ||||
| uint32_t fp_get_model(struct fingerprint_table *table, unsigned int i) | ||||
| { | ||||
| 	if (!table || i >= table->fingerprints.size()) | ||||
| 		return 0; | ||||
| 	return table->fingerprints[i].model; | ||||
| } | ||||
| 
 | ||||
| extern "C" uint32_t fp_get_serial(struct fingerprint_table *table, unsigned int i) | ||||
| uint32_t fp_get_serial(struct fingerprint_table *table, unsigned int i) | ||||
| { | ||||
| 	if (!table || i >= table->fingerprints.size()) | ||||
| 		return 0; | ||||
| 	return table->fingerprints[i].serial; | ||||
| } | ||||
| 
 | ||||
| extern "C" uint32_t fp_get_deviceid(struct fingerprint_table *table, unsigned int i) | ||||
| uint32_t fp_get_deviceid(struct fingerprint_table *table, unsigned int i) | ||||
| { | ||||
| 	if (!table || i >= table->fingerprints.size()) | ||||
| 		return 0; | ||||
| 	return table->fingerprints[i].fdeviceid; | ||||
| } | ||||
| 
 | ||||
| extern "C" uint32_t fp_get_diveid(struct fingerprint_table *table, unsigned int i) | ||||
| uint32_t fp_get_diveid(struct fingerprint_table *table, unsigned int i) | ||||
| { | ||||
| 	if (!table || i >= table->fingerprints.size()) | ||||
| 		return 0; | ||||
|  |  | |||
|  | @ -6,8 +6,6 @@ | |||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct divecomputer; | ||||
| struct device; | ||||
| struct device_table; | ||||
|  | @ -61,8 +59,6 @@ typedef void (*device_callback_t)(const char *name, void *userdata); | |||
| 
 | ||||
| extern int enumerate_devices(device_callback_t callback, void *userdata, unsigned int transport); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // Functions and global variables that are only available to C++ code
 | ||||
| struct device { | ||||
| 	bool operator<(const device &a) const; | ||||
|  |  | |||
							
								
								
									
										130
									
								
								core/dive.cpp
									
										
									
									
									
								
							
							
						
						
									
										130
									
								
								core/dive.cpp
									
										
									
									
									
								
							|  | @ -51,7 +51,7 @@ static double calculate_depth_to_mbarf(int depth, pressure_t surface_pressure, i | |||
|  * This function returns a negative number for "no legacy mode", | ||||
|  * or a non-negative number that indicates the o2 sensor index. | ||||
|  */ | ||||
| extern "C" int legacy_format_o2pressures(const struct dive *dive, const struct divecomputer *dc) | ||||
| int legacy_format_o2pressures(const struct dive *dive, const struct divecomputer *dc) | ||||
| { | ||||
| 	int i, o2sensor; | ||||
| 
 | ||||
|  | @ -83,7 +83,7 @@ extern "C" int legacy_format_o2pressures(const struct dive *dive, const struct d | |||
| } | ||||
| 
 | ||||
| /* warning: does not test idx for validity */ | ||||
| extern "C" struct event *create_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx) | ||||
| struct event *create_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx) | ||||
| { | ||||
| 	/* The gas switch event format is insane for historical reasons */ | ||||
| 	struct gasmix mix = get_cylinder(dive, idx)->gasmix; | ||||
|  | @ -102,7 +102,7 @@ extern "C" struct event *create_gas_switch_event(struct dive *dive, struct divec | |||
| 	return ev; | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx) | ||||
| void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int seconds, int idx) | ||||
| { | ||||
| 	/* sanity check so we don't crash */ | ||||
| 	/* FIXME: The planner uses a dummy cylinder one past the official number of cylinders
 | ||||
|  | @ -120,7 +120,7 @@ extern "C" void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, | |||
|  * have to actually remove the existing event and replace it with a new one. | ||||
|  * WARNING, WARNING... this may end up freeing event in case that event is indeed | ||||
|  * WARNING, WARNING... part of this divecomputer on this dive! */ | ||||
| extern "C" void update_event_name(struct dive *d, int dc_number, struct event *event, const char *name) | ||||
| void update_event_name(struct dive *d, int dc_number, struct event *event, const char *name) | ||||
| { | ||||
| 	if (!d || !event) | ||||
| 		return; | ||||
|  | @ -140,7 +140,7 @@ extern "C" void update_event_name(struct dive *d, int dc_number, struct event *e | |||
| 	invalidate_dive_cache(d); | ||||
| } | ||||
| 
 | ||||
| extern "C" struct gasmix get_gasmix_from_event(const struct dive *dive, const struct event *ev) | ||||
| struct gasmix get_gasmix_from_event(const struct dive *dive, const struct event *ev) | ||||
| { | ||||
| 	if (ev && event_is_gaschange(ev)) { | ||||
| 		int index = ev->gas.index; | ||||
|  | @ -156,14 +156,14 @@ extern "C" struct gasmix get_gasmix_from_event(const struct dive *dive, const st | |||
| 
 | ||||
| // we need this to be uniq. oh, and it has no meaning whatsoever
 | ||||
| // - that's why we have the silly initial number and increment by 3 :-)
 | ||||
| extern "C" int dive_getUniqID() | ||||
| int dive_getUniqID() | ||||
| { | ||||
| 	static int maxId = 83529; | ||||
| 	maxId += 3; | ||||
| 	return maxId; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *alloc_dive(void) | ||||
| struct dive *alloc_dive(void) | ||||
| { | ||||
| 	struct dive *dive; | ||||
| 
 | ||||
|  | @ -235,7 +235,7 @@ static void free_dive_structures(struct dive *d) | |||
| 	free(d->pictures.pictures); | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_dive(struct dive *d) | ||||
| void free_dive(struct dive *d) | ||||
| { | ||||
| 	free_dive_structures(d); | ||||
| 	free(d); | ||||
|  | @ -245,7 +245,7 @@ extern "C" void free_dive(struct dive *d) | |||
|  * in order not to leak memory, we need to free those . | ||||
|  * copy_dive doesn't play with the divetrip and forward/backward pointers | ||||
|  * so we can ignore those */ | ||||
| extern "C" void clear_dive(struct dive *d) | ||||
| void clear_dive(struct dive *d) | ||||
| { | ||||
| 	if (!d) | ||||
| 		return; | ||||
|  | @ -278,7 +278,7 @@ static void copy_dive_nodc(const struct dive *s, struct dive *d) | |||
| 	d->tag_list = taglist_copy(s->tag_list); | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_dive(const struct dive *s, struct dive *d) | ||||
| void copy_dive(const struct dive *s, struct dive *d) | ||||
| { | ||||
| 	copy_dive_nodc(s, d); | ||||
| 
 | ||||
|  | @ -297,7 +297,7 @@ static void copy_dive_onedc(const struct dive *s, const struct divecomputer *sdc | |||
| /* make a clone of the source dive and clean out the source dive;
 | ||||
|  * this allows us to create a dive on the stack and then | ||||
|  * add it to the divelist. */ | ||||
| extern "C" struct dive *move_dive(struct dive *s) | ||||
| struct dive *move_dive(struct dive *s) | ||||
| { | ||||
| 	struct dive *dive = alloc_dive(); | ||||
| 	*dive = *s;			   // so all the pointers in dive point to the things s pointed to
 | ||||
|  | @ -310,7 +310,7 @@ extern "C" struct dive *move_dive(struct dive *s) | |||
| 		d->_component = copy_string(s->_component) | ||||
| 
 | ||||
| // copy elements, depending on bits in what that are set
 | ||||
| extern "C" void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear) | ||||
| void selective_copy_dive(const struct dive *s, struct dive *d, struct dive_components what, bool clear) | ||||
| { | ||||
| 	if (clear) | ||||
| 		clear_dive(d); | ||||
|  | @ -342,7 +342,7 @@ extern "C" void selective_copy_dive(const struct dive *s, struct dive *d, struct | |||
| /* copies all events from the given dive computer before a given time
 | ||||
|    this is used when editing a dive in the planner to preserve the events | ||||
|    of the old dive */ | ||||
| extern "C" void copy_events_until(const struct dive *sd, struct dive *dd, int dcNr, int time) | ||||
| void copy_events_until(const struct dive *sd, struct dive *dd, int dcNr, int time) | ||||
| { | ||||
| 	if (!sd || !dd) | ||||
| 		return; | ||||
|  | @ -363,17 +363,17 @@ extern "C" void copy_events_until(const struct dive *sd, struct dive *dd, int dc | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" int nr_cylinders(const struct dive *dive) | ||||
| int nr_cylinders(const struct dive *dive) | ||||
| { | ||||
| 	return dive->cylinders.nr; | ||||
| } | ||||
| 
 | ||||
| extern "C" int nr_weightsystems(const struct dive *dive) | ||||
| int nr_weightsystems(const struct dive *dive) | ||||
| { | ||||
| 	return dive->weightsystems.nr; | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_used_cylinders(const struct dive *s, struct dive *d, bool used_only) | ||||
| void copy_used_cylinders(const struct dive *s, struct dive *d, bool used_only) | ||||
| { | ||||
| 	int i; | ||||
| 	if (!s || !d) | ||||
|  | @ -488,7 +488,7 @@ static bool has_unknown_used_cylinders(const struct dive *dive, const struct div | |||
| 	return num > 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration) | ||||
| void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration) | ||||
| { | ||||
| 	int i; | ||||
| 	int32_t lasttime = 0; | ||||
|  | @ -597,7 +597,7 @@ static int same_rounded_pressure(pressure_t a, pressure_t b) | |||
|  * first cylinder - in which case cylinder 0 is indeed the first cylinder. | ||||
|  * We likewise return 0 if the event concerns a cylinder that doesn't exist. | ||||
|  * If the dive has no cylinders, -1 is returned. */ | ||||
| extern "C" int explicit_first_cylinder(const struct dive *dive, const struct divecomputer *dc) | ||||
| int explicit_first_cylinder(const struct dive *dive, const struct divecomputer *dc) | ||||
| { | ||||
| 	int res = 0; | ||||
| 	if (!dive->cylinders.nr) | ||||
|  | @ -615,7 +615,7 @@ extern "C" int explicit_first_cylinder(const struct dive *dive, const struct div | |||
| /* this gets called when the dive mode has changed (so OC vs. CC)
 | ||||
|  * there are two places we might have setpoints... events or in the samples | ||||
|  */ | ||||
| extern "C" void update_setpoint_events(const struct dive *dive, struct divecomputer *dc) | ||||
| void update_setpoint_events(const struct dive *dive, struct divecomputer *dc) | ||||
| { | ||||
| 	struct event *ev; | ||||
| 	int new_setpoint = 0; | ||||
|  | @ -775,7 +775,7 @@ static struct event *find_previous_event(struct divecomputer *dc, struct event * | |||
| 	return previous; | ||||
| } | ||||
| 
 | ||||
| extern "C" pressure_t calculate_surface_pressure(const struct dive *dive) | ||||
| pressure_t calculate_surface_pressure(const struct dive *dive) | ||||
| { | ||||
| 	const struct divecomputer *dc; | ||||
| 	pressure_t res; | ||||
|  | @ -799,7 +799,7 @@ static void fixup_surface_pressure(struct dive *dive) | |||
| /* if the surface pressure in the dive data is redundant to the calculated
 | ||||
|  * value (i.e., it was added by running fixup on the dive) return 0, | ||||
|  * otherwise return the surface pressure given in the dive */ | ||||
| extern "C" pressure_t un_fixup_surface_pressure(const struct dive *d) | ||||
| pressure_t un_fixup_surface_pressure(const struct dive *d) | ||||
| { | ||||
| 	pressure_t res = d->surface_pressure; | ||||
| 	if (res.mbar && res.mbar == calculate_surface_pressure(d).mbar) | ||||
|  | @ -824,7 +824,7 @@ static void fixup_water_salinity(struct dive *dive) | |||
| 		dive->salinity = (sum + nr / 2) / nr; | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_dive_salinity(const struct dive *dive) | ||||
| int get_dive_salinity(const struct dive *dive) | ||||
| { | ||||
| 	return dive->user_salinity ? dive->user_salinity : dive->salinity; | ||||
| } | ||||
|  | @ -1263,7 +1263,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) | |||
| 		fake_dc(dc); | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *fixup_dive(struct dive *dive) | ||||
| struct dive *fixup_dive(struct dive *dive) | ||||
| { | ||||
| 	int i; | ||||
| 	struct divecomputer *dc; | ||||
|  | @ -1653,7 +1653,7 @@ pick_b: | |||
|  * A negative number returned indicates that a match could not be found. | ||||
|  * Call parameters: dive = the dive being processed | ||||
|  *                  cylinder_use_type = an enum, one of {oxygen, diluent, bailout} */ | ||||
| extern "C" int get_cylinder_idx_by_use(const struct dive *dive, enum cylinderuse cylinder_use_type) | ||||
| int get_cylinder_idx_by_use(const struct dive *dive, enum cylinderuse cylinder_use_type) | ||||
| { | ||||
| 	int cylinder_index; | ||||
| 	for (cylinder_index = 0; cylinder_index < dive->cylinders.nr; cylinder_index++) { | ||||
|  | @ -1750,14 +1750,14 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, con | |||
|  * Also note that we assume that the initial cylinder is cylinder 0, | ||||
|  * so if that got renamed, we need to create a fake gas change event | ||||
|  */ | ||||
| extern "C" void cylinder_renumber(struct dive *dive, int mapping[]) | ||||
| void cylinder_renumber(struct dive *dive, int mapping[]) | ||||
| { | ||||
| 	struct divecomputer *dc; | ||||
| 	for_each_dc (dive, dc) | ||||
| 		dc_cylinder_renumber(dive, dc, mapping); | ||||
| } | ||||
| 
 | ||||
| extern "C" int same_gasmix_cylinder(const cylinder_t *cyl, int cylid, const struct dive *dive, bool check_unused) | ||||
| int same_gasmix_cylinder(const cylinder_t *cyl, int cylid, const struct dive *dive, bool check_unused) | ||||
| { | ||||
| 	struct gasmix mygas = cyl->gasmix; | ||||
| 	for (int i = 0; i < dive->cylinders.nr; i++) { | ||||
|  | @ -2352,7 +2352,7 @@ static int likely_same_dive(const struct dive *a, const struct dive *b) | |||
|  * Attn: The dive_site parameter of the dive will be set, but the caller | ||||
|  * still has to register the dive in the dive site! | ||||
|  */ | ||||
| extern "C" struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded) | ||||
| struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded) | ||||
| { | ||||
| 	struct dive *res; | ||||
| 	struct dive_site *site; | ||||
|  | @ -2562,12 +2562,12 @@ static bool has_dc_type(const struct dive *dive, bool dc_is_planner) | |||
| } | ||||
| 
 | ||||
| // Does this dive have a dive computer for which is_dc_planner has value planned
 | ||||
| extern "C" bool is_planned(const struct dive *dive) | ||||
| bool is_planned(const struct dive *dive) | ||||
| { | ||||
| 	return has_dc_type(dive, true); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool is_logged(const struct dive *dive) | ||||
| bool is_logged(const struct dive *dive) | ||||
| { | ||||
| 	return has_dc_type(dive, false); | ||||
| } | ||||
|  | @ -2601,7 +2601,7 @@ extern "C" bool is_logged(const struct dive *dive) | |||
|  * The dive site the new dive should be added to (if any) is returned | ||||
|  * in the "dive_site" output parameter. | ||||
|  */ | ||||
| extern "C" struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip, struct dive_site **site) | ||||
| struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip, struct dive_site **site) | ||||
| { | ||||
| 	struct dive *res = alloc_dive(); | ||||
| 
 | ||||
|  | @ -2871,7 +2871,7 @@ static bool should_split(const struct divecomputer *dc, int t1, int t2) | |||
|  * | ||||
|  * In other words, this is a (simplified) reversal of the dive merging. | ||||
|  */ | ||||
| extern "C" int split_dive(const struct dive *dive, struct dive **new1, struct dive **new2) | ||||
| int split_dive(const struct dive *dive, struct dive **new1, struct dive **new2) | ||||
| { | ||||
| 	int i; | ||||
| 	int at_surface, surface_start; | ||||
|  | @ -2914,7 +2914,7 @@ extern "C" int split_dive(const struct dive *dive, struct dive **new1, struct di | |||
| 	return -1; | ||||
| } | ||||
| 
 | ||||
| extern "C" int split_dive_at_time(const struct dive *dive, duration_t time, struct dive **new1, struct dive **new2) | ||||
| int split_dive_at_time(const struct dive *dive, duration_t time, struct dive **new1, struct dive **new2) | ||||
| { | ||||
| 	int i = 0; | ||||
| 
 | ||||
|  | @ -2977,12 +2977,12 @@ static inline int dive_totaltime(const struct dive *dive) | |||
| 	return time; | ||||
| } | ||||
| 
 | ||||
| extern "C" timestamp_t dive_endtime(const struct dive *dive) | ||||
| timestamp_t dive_endtime(const struct dive *dive) | ||||
| { | ||||
| 	return dive->when + dive_totaltime(dive); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool time_during_dive_with_offset(const struct dive *dive, timestamp_t when, timestamp_t offset) | ||||
| bool time_during_dive_with_offset(const struct dive *dive, timestamp_t when, timestamp_t offset) | ||||
| { | ||||
| 	timestamp_t start = dive->when; | ||||
| 	timestamp_t end = dive_endtime(dive); | ||||
|  | @ -2999,7 +2999,7 @@ extern "C" bool time_during_dive_with_offset(const struct dive *dive, timestamp_ | |||
|  * functionality for the core library that Subsurface itself doesn't | ||||
|  * use but that another consumer of the library (like an HTML exporter) | ||||
|  * will need */ | ||||
| extern "C" void set_informational_units(const char *units) | ||||
| void set_informational_units(const char *units) | ||||
| { | ||||
| 	if (strstr(units, "METRIC")) { | ||||
| 		git_prefs.unit_system = METRIC; | ||||
|  | @ -3035,7 +3035,7 @@ extern "C" void set_informational_units(const char *units) | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| extern "C" void set_git_prefs(const char *prefs) | ||||
| void set_git_prefs(const char *prefs) | ||||
| { | ||||
| 	if (strstr(prefs, "TANKBAR")) | ||||
| 		git_prefs.tankbar = 1; | ||||
|  | @ -3048,7 +3048,7 @@ extern "C" void set_git_prefs(const char *prefs) | |||
| } | ||||
| 
 | ||||
| /* clones a dive and moves given dive computer to front */ | ||||
| extern "C" struct dive *make_first_dc(const struct dive *d, int dc_number) | ||||
| struct dive *make_first_dc(const struct dive *d, int dc_number) | ||||
| { | ||||
| 	struct dive *res; | ||||
| 	struct divecomputer *dc, *newdc, *old_dc; | ||||
|  | @ -3112,7 +3112,7 @@ static void delete_divecomputer(struct dive *d, int num) | |||
| } | ||||
| 
 | ||||
| /* Clone a dive and delete goven dive computer */ | ||||
| extern "C" struct dive *clone_delete_divecomputer(const struct dive *d, int dc_number) | ||||
| struct dive *clone_delete_divecomputer(const struct dive *d, int dc_number) | ||||
| { | ||||
| 	struct dive *res; | ||||
| 
 | ||||
|  | @ -3135,7 +3135,7 @@ extern "C" struct dive *clone_delete_divecomputer(const struct dive *d, int dc_n | |||
|  * The dives will not be associated with a trip. | ||||
|  * On error, both output parameters are set to NULL. | ||||
|  */ | ||||
| extern "C" void split_divecomputer(const struct dive *src, int num, struct dive **out1, struct dive **out2) | ||||
| void split_divecomputer(const struct dive *src, int num, struct dive **out1, struct dive **out2) | ||||
| { | ||||
| 	const struct divecomputer *srcdc = get_dive_dc_const(src, num); | ||||
| 
 | ||||
|  | @ -3161,7 +3161,7 @@ extern "C" void split_divecomputer(const struct dive *src, int num, struct dive | |||
| } | ||||
| 
 | ||||
| //Calculate O2 in best mix
 | ||||
| extern "C" fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner) | ||||
| fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner) | ||||
| { | ||||
| 	fraction_t fo2; | ||||
| 	int po2 = in_planner ? prefs.bottompo2 : (int)(prefs.modpO2 * 1000.0); | ||||
|  | @ -3174,7 +3174,7 @@ extern "C" fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_pl | |||
| } | ||||
| 
 | ||||
| //Calculate He in best mix. O2 is considered narcopic
 | ||||
| extern "C" fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2) | ||||
| fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2) | ||||
| { | ||||
| 	fraction_t fhe; | ||||
| 	int pnarcotic, ambient; | ||||
|  | @ -3190,18 +3190,18 @@ extern "C" fraction_t best_he(depth_t depth, const struct dive *dive, bool o2nar | |||
| 	return fhe; | ||||
| } | ||||
| 
 | ||||
| extern "C" void invalidate_dive_cache(struct dive *dive) | ||||
| void invalidate_dive_cache(struct dive *dive) | ||||
| { | ||||
| 	memset(dive->git_id, 0, 20); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool dive_cache_is_valid(const struct dive *dive) | ||||
| bool dive_cache_is_valid(const struct dive *dive) | ||||
| { | ||||
| 	static const unsigned char null_id[20] = { 0, }; | ||||
| 	return !!memcmp(dive->git_id, null_id, 20); | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null) | ||||
| int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null) | ||||
| { | ||||
| 	int mbar = dive->surface_pressure.mbar; | ||||
| 	if (!mbar && non_null) | ||||
|  | @ -3237,12 +3237,12 @@ static double calculate_depth_to_mbarf(int depth, pressure_t surface_pressure, i | |||
| 	return mbar + depth * specific_weight; | ||||
| } | ||||
| 
 | ||||
| extern "C" int depth_to_mbar(int depth, const struct dive *dive) | ||||
| int depth_to_mbar(int depth, const struct dive *dive) | ||||
| { | ||||
| 	return lrint(depth_to_mbarf(depth, dive)); | ||||
| } | ||||
| 
 | ||||
| extern "C" double depth_to_mbarf(int depth, const struct dive *dive) | ||||
| double depth_to_mbarf(int depth, const struct dive *dive) | ||||
| { | ||||
| 	// For downloaded and planned dives, use DC's values
 | ||||
| 	int salinity = dive->dc.salinity; | ||||
|  | @ -3255,12 +3255,12 @@ extern "C" double depth_to_mbarf(int depth, const struct dive *dive) | |||
| 	return calculate_depth_to_mbarf(depth, surface_pressure, salinity); | ||||
| } | ||||
| 
 | ||||
| extern "C" double depth_to_bar(int depth, const struct dive *dive) | ||||
| double depth_to_bar(int depth, const struct dive *dive) | ||||
| { | ||||
| 	return depth_to_mbar(depth, dive) / 1000.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" double depth_to_atm(int depth, const struct dive *dive) | ||||
| double depth_to_atm(int depth, const struct dive *dive) | ||||
| { | ||||
| 	return mbar_to_atm(depth_to_mbar(depth, dive)); | ||||
| } | ||||
|  | @ -3269,7 +3269,7 @@ extern "C" double depth_to_atm(int depth, const struct dive *dive) | |||
|  * (that's the one that some dive computers like the Uemis Zurich | ||||
|  * provide - for the other models that do this libdivecomputer has to | ||||
|  * take care of this, but the Uemis we support natively */ | ||||
| extern "C" int rel_mbar_to_depth(int mbar, const struct dive *dive) | ||||
| int rel_mbar_to_depth(int mbar, const struct dive *dive) | ||||
| { | ||||
| 	// For downloaded and planned dives, use DC's salinity. Manual dives, use user's salinity
 | ||||
| 	int salinity = is_dc_manually_added_dive(&dive->dc) ? dive->user_salinity : dive->dc.salinity; | ||||
|  | @ -3281,7 +3281,7 @@ extern "C" int rel_mbar_to_depth(int mbar, const struct dive *dive) | |||
| 	return (int)lrint(mbar / specific_weight); | ||||
| } | ||||
| 
 | ||||
| extern "C" int mbar_to_depth(int mbar, const struct dive *dive) | ||||
| int mbar_to_depth(int mbar, const struct dive *dive) | ||||
| { | ||||
| 	// For downloaded and planned dives, use DC's pressure. Manual dives, use user's pressure
 | ||||
| 	pressure_t surface_pressure = is_dc_manually_added_dive(&dive->dc) | ||||
|  | @ -3295,7 +3295,7 @@ extern "C" int mbar_to_depth(int mbar, const struct dive *dive) | |||
| } | ||||
| 
 | ||||
| /* MOD rounded to multiples of roundto mm */ | ||||
| extern "C" depth_t gas_mod(struct gasmix mix, pressure_t po2_limit, const struct dive *dive, int roundto) | ||||
| depth_t gas_mod(struct gasmix mix, pressure_t po2_limit, const struct dive *dive, int roundto) | ||||
| { | ||||
| 	depth_t rounded_depth; | ||||
| 
 | ||||
|  | @ -3305,7 +3305,7 @@ extern "C" depth_t gas_mod(struct gasmix mix, pressure_t po2_limit, const struct | |||
| } | ||||
| 
 | ||||
| /* Maximum narcotic depth rounded to multiples of roundto mm */ | ||||
| extern "C" depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int roundto) | ||||
| depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int roundto) | ||||
| { | ||||
| 	depth_t rounded_depth; | ||||
| 	pressure_t ppo2n2; | ||||
|  | @ -3323,14 +3323,14 @@ extern "C" depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *di | |||
| 	return rounded_depth; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *get_dive(int nr) | ||||
| struct dive *get_dive(int nr) | ||||
| { | ||||
| 	if (nr >= divelog.dives->nr || nr < 0) | ||||
| 		return NULL; | ||||
| 	return divelog.dives->dives[nr]; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive_site *get_dive_site_for_dive(const struct dive *dive) | ||||
| struct dive_site *get_dive_site_for_dive(const struct dive *dive) | ||||
| { | ||||
| 	return dive->dive_site; | ||||
| } | ||||
|  | @ -3347,7 +3347,7 @@ std::string get_dive_location(const struct dive *dive) | |||
| 	return ds ? ds->name : std::string(); | ||||
| } | ||||
| 
 | ||||
| extern "C" unsigned int number_of_computers(const struct dive *dive) | ||||
| unsigned int number_of_computers(const struct dive *dive) | ||||
| { | ||||
| 	unsigned int total_number = 0; | ||||
| 	const struct divecomputer *dc = &dive->dc; | ||||
|  | @ -3362,7 +3362,7 @@ extern "C" unsigned int number_of_computers(const struct dive *dive) | |||
| 	return total_number; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct divecomputer *get_dive_dc(struct dive *dive, int nr) | ||||
| struct divecomputer *get_dive_dc(struct dive *dive, int nr) | ||||
| { | ||||
| 	struct divecomputer *dc; | ||||
| 	if (!dive) | ||||
|  | @ -3377,12 +3377,12 @@ extern "C" struct divecomputer *get_dive_dc(struct dive *dive, int nr) | |||
| 	return dc; | ||||
| } | ||||
| 
 | ||||
| extern "C" const struct divecomputer *get_dive_dc_const(const struct dive *dive, int nr) | ||||
| const struct divecomputer *get_dive_dc_const(const struct dive *dive, int nr) | ||||
| { | ||||
| 	return get_dive_dc((struct dive *)dive, nr); | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *get_dive_by_uniq_id(int id) | ||||
| struct dive *get_dive_by_uniq_id(int id) | ||||
| { | ||||
| 	int i; | ||||
| 	struct dive *dive = NULL; | ||||
|  | @ -3400,7 +3400,7 @@ extern "C" struct dive *get_dive_by_uniq_id(int id) | |||
| 	return dive; | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_idx_by_uniq_id(int id) | ||||
| int get_idx_by_uniq_id(int id) | ||||
| { | ||||
| 	int i; | ||||
| 	struct dive *dive = NULL; | ||||
|  | @ -3418,12 +3418,12 @@ extern "C" int get_idx_by_uniq_id(int id) | |||
| 	return i; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool dive_site_has_gps_location(const struct dive_site *ds) | ||||
| bool dive_site_has_gps_location(const struct dive_site *ds) | ||||
| { | ||||
| 	return ds && has_location(&ds->location); | ||||
| } | ||||
| 
 | ||||
| extern "C" int dive_has_gps_location(const struct dive *dive) | ||||
| int dive_has_gps_location(const struct dive *dive) | ||||
| { | ||||
| 	if (!dive) | ||||
| 		return false; | ||||
|  | @ -3458,7 +3458,7 @@ static location_t dc_get_gps_location(const struct divecomputer *dc) | |||
|  * This function is potentially slow, therefore only call sparingly | ||||
|  * and remember the result. | ||||
|  */ | ||||
| extern "C" location_t dive_get_gps_location(const struct dive *d) | ||||
| location_t dive_get_gps_location(const struct dive *d) | ||||
| { | ||||
| 	location_t res = { }; | ||||
| 
 | ||||
|  | @ -3478,7 +3478,7 @@ extern "C" location_t dive_get_gps_location(const struct dive *d) | |||
| } | ||||
| 
 | ||||
| /* When evaluated at the time of a gasswitch, this returns the new gas */ | ||||
| extern "C" struct gasmix get_gasmix(const struct dive *dive, const struct divecomputer *dc, int time, const struct event **evp, struct gasmix gasmix) | ||||
| struct gasmix get_gasmix(const struct dive *dive, const struct divecomputer *dc, int time, const struct event **evp, struct gasmix gasmix) | ||||
| { | ||||
| 	const struct event *ev = *evp; | ||||
| 	struct gasmix res; | ||||
|  | @ -3506,7 +3506,7 @@ extern "C" struct gasmix get_gasmix(const struct dive *dive, const struct diveco | |||
| 
 | ||||
| /* get the gas at a certain time during the dive */ | ||||
| /* If there is a gasswitch at that time, it returns the new gasmix */ | ||||
| extern "C" struct gasmix get_gasmix_at_time(const struct dive *d, const struct divecomputer *dc, duration_t time) | ||||
| struct gasmix get_gasmix_at_time(const struct dive *d, const struct divecomputer *dc, duration_t time) | ||||
| { | ||||
| 	const struct event *ev = NULL; | ||||
| 	struct gasmix gasmix = gasmix_air; | ||||
|  | @ -3514,7 +3514,7 @@ extern "C" struct gasmix get_gasmix_at_time(const struct dive *d, const struct d | |||
| } | ||||
| 
 | ||||
| /* Does that cylinder have any pressure readings? */ | ||||
| extern "C" bool cylinder_with_sensor_sample(const struct dive *dive, int cylinder_id) | ||||
| bool cylinder_with_sensor_sample(const struct dive *dive, int cylinder_id) | ||||
| { | ||||
| 	for (const struct divecomputer *dc = &dive->dc; dc; dc = dc->next) { | ||||
| 		for (int i = 0; i < dc->samples; ++i) { | ||||
|  |  | |||
|  | @ -13,8 +13,6 @@ | |||
| #include <stdlib.h> | ||||
| #include <string> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern int last_xml_version; | ||||
| 
 | ||||
| extern const char *divemode_text_ui[]; | ||||
|  | @ -218,7 +216,6 @@ extern struct gasmix get_gasmix(const struct dive *dive, const struct divecomput | |||
| extern struct gasmix get_gasmix_at_time(const struct dive *dive, const struct divecomputer *dc, duration_t time); | ||||
| 
 | ||||
| extern void update_setpoint_events(const struct dive *dive, struct divecomputer *dc); | ||||
| } | ||||
| 
 | ||||
| /* Make pointers to dive and dive_trip "Qt metatypes" so that they can be passed through
 | ||||
|  * QVariants and through QML. | ||||
|  |  | |||
|  | @ -117,7 +117,7 @@ static void fill_samples_no_avg(struct sample *s, int max_d, int max_t, double s | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void fake_dc(struct divecomputer *dc) | ||||
| void fake_dc(struct divecomputer *dc) | ||||
| { | ||||
| 	alloc_samples(dc, 6); | ||||
| 	struct sample *fake = dc->sample; | ||||
|  | @ -199,7 +199,7 @@ extern "C" void fake_dc(struct divecomputer *dc) | |||
|  * saving the dive mode for each event. When the events occur AFTER 'time' seconds, the last stored divemode | ||||
|  * is returned. This function is self-tracking, relying on setting the event pointer 'evp' so that, in each iteration | ||||
|  * that calls this function, the search does not have to begin at the first event of the dive */ | ||||
| extern "C" enum divemode_t get_current_divemode(const struct divecomputer *dc, int time, const struct event **evp, enum divemode_t *divemode) | ||||
| enum divemode_t get_current_divemode(const struct divecomputer *dc, int time, const struct event **evp, enum divemode_t *divemode) | ||||
| { | ||||
| 	const struct event *ev = *evp; | ||||
| 	if (dc) { | ||||
|  | @ -221,7 +221,7 @@ extern "C" enum divemode_t get_current_divemode(const struct divecomputer *dc, i | |||
| 
 | ||||
| /* helper function to make it easier to work with our structures
 | ||||
|  * we don't interpolate here, just use the value from the last sample up to that time */ | ||||
| extern "C" int get_depth_at_time(const struct divecomputer *dc, unsigned int time) | ||||
| int get_depth_at_time(const struct divecomputer *dc, unsigned int time) | ||||
| { | ||||
| 	int depth = 0; | ||||
| 	if (dc && dc->sample) | ||||
|  | @ -236,7 +236,7 @@ extern "C" int get_depth_at_time(const struct divecomputer *dc, unsigned int tim | |||
| 
 | ||||
| /* The first divecomputer is embedded in the dive structure. Free its data but not
 | ||||
|  * the structure itself. For all remainding dcs in the list, free data *and* structures. */ | ||||
| extern "C" void free_dive_dcs(struct divecomputer *dc) | ||||
| void free_dive_dcs(struct divecomputer *dc) | ||||
| { | ||||
| 	free_dc_contents(dc); | ||||
| 	STRUCTURED_LIST_FREE(struct divecomputer, dc->next, free_dc); | ||||
|  | @ -244,7 +244,7 @@ extern "C" void free_dive_dcs(struct divecomputer *dc) | |||
| 
 | ||||
| /* make room for num samples; if not enough space is available, the sample
 | ||||
|  * array is reallocated and the existing samples are copied. */ | ||||
| extern "C" void alloc_samples(struct divecomputer *dc, int num) | ||||
| void alloc_samples(struct divecomputer *dc, int num) | ||||
| { | ||||
| 	if (num > dc->alloc_samples) { | ||||
| 		dc->alloc_samples = (num * 3) / 2 + 10; | ||||
|  | @ -254,7 +254,7 @@ extern "C" void alloc_samples(struct divecomputer *dc, int num) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_samples(struct divecomputer *dc) | ||||
| void free_samples(struct divecomputer *dc) | ||||
| { | ||||
| 	if (dc) { | ||||
| 		free(dc->sample); | ||||
|  | @ -264,7 +264,7 @@ extern "C" void free_samples(struct divecomputer *dc) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" struct sample *prepare_sample(struct divecomputer *dc) | ||||
| struct sample *prepare_sample(struct divecomputer *dc) | ||||
| { | ||||
| 	if (dc) { | ||||
| 		int nr = dc->samples; | ||||
|  | @ -291,12 +291,12 @@ extern "C" struct sample *prepare_sample(struct divecomputer *dc) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| extern "C" void finish_sample(struct divecomputer *dc) | ||||
| void finish_sample(struct divecomputer *dc) | ||||
| { | ||||
| 	dc->samples++; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct sample *add_sample(const struct sample *sample, int time, struct divecomputer *dc) | ||||
| struct sample *add_sample(const struct sample *sample, int time, struct divecomputer *dc) | ||||
| { | ||||
| 	struct sample *p = prepare_sample(dc); | ||||
| 
 | ||||
|  | @ -314,7 +314,7 @@ extern "C" struct sample *add_sample(const struct sample *sample, int time, stru | |||
|  * | ||||
|  * This ignores any surface time in the middle of the dive. | ||||
|  */ | ||||
| extern "C" void fixup_dc_duration(struct divecomputer *dc) | ||||
| void fixup_dc_duration(struct divecomputer *dc) | ||||
| { | ||||
| 	int duration, i; | ||||
| 	int lasttime, lastdepth, depthtime; | ||||
|  | @ -347,7 +347,7 @@ extern "C" void fixup_dc_duration(struct divecomputer *dc) | |||
|  * What do the dive computers say the water temperature is? | ||||
|  * (not in the samples, but as dc property for dcs that support that) | ||||
|  */ | ||||
| extern "C" unsigned int dc_watertemp(const struct divecomputer *dc) | ||||
| unsigned int dc_watertemp(const struct divecomputer *dc) | ||||
| { | ||||
| 	int sum = 0, nr = 0; | ||||
| 
 | ||||
|  | @ -365,7 +365,7 @@ extern "C" unsigned int dc_watertemp(const struct divecomputer *dc) | |||
| /*
 | ||||
|  * What do the dive computers say the air temperature is? | ||||
|  */ | ||||
| extern "C" unsigned int dc_airtemp(const struct divecomputer *dc) | ||||
| unsigned int dc_airtemp(const struct divecomputer *dc) | ||||
| { | ||||
| 	int sum = 0, nr = 0; | ||||
| 
 | ||||
|  | @ -381,7 +381,7 @@ extern "C" unsigned int dc_airtemp(const struct divecomputer *dc) | |||
| } | ||||
| 
 | ||||
| /* copies all events in this dive computer */ | ||||
| extern "C" void copy_events(const struct divecomputer *s, struct divecomputer *d) | ||||
| void copy_events(const struct divecomputer *s, struct divecomputer *d) | ||||
| { | ||||
| 	const struct event *ev; | ||||
| 	struct event **pev; | ||||
|  | @ -398,7 +398,7 @@ extern "C" void copy_events(const struct divecomputer *s, struct divecomputer *d | |||
| 	*pev = NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_samples(const struct divecomputer *s, struct divecomputer *d) | ||||
| void copy_samples(const struct divecomputer *s, struct divecomputer *d) | ||||
| { | ||||
| 	/* instead of carefully copying them one by one and calling add_sample
 | ||||
| 	 * over and over again, let's just copy the whole blob */ | ||||
|  | @ -420,7 +420,7 @@ extern "C" void copy_samples(const struct divecomputer *s, struct divecomputer * | |||
| 		memcpy(d->sample, s->sample, nr * sizeof(struct sample)); | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_event_to_dc(struct divecomputer *dc, struct event *ev) | ||||
| void add_event_to_dc(struct divecomputer *dc, struct event *ev) | ||||
| { | ||||
| 	struct event **p; | ||||
| 
 | ||||
|  | @ -433,7 +433,7 @@ extern "C" void add_event_to_dc(struct divecomputer *dc, struct event *ev) | |||
| 	*p = ev; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name) | ||||
| struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name) | ||||
| { | ||||
| 	struct event *ev = create_event(time, type, flags, value, name); | ||||
| 
 | ||||
|  | @ -446,7 +446,7 @@ extern "C" struct event *add_event(struct divecomputer *dc, unsigned int time, i | |||
| } | ||||
| 
 | ||||
| /* Substitutes an event in a divecomputer for another. No reordering is performed! */ | ||||
| extern "C" void swap_event(struct divecomputer *dc, struct event *from, struct event *to) | ||||
| void swap_event(struct divecomputer *dc, struct event *from, struct event *to) | ||||
| { | ||||
| 	for (struct event **ep = &dc->events; *ep; ep = &(*ep)->next) { | ||||
| 		if (*ep == from) { | ||||
|  | @ -459,7 +459,7 @@ extern "C" void swap_event(struct divecomputer *dc, struct event *from, struct e | |||
| } | ||||
| 
 | ||||
| /* Remove given event from dive computer. Does *not* free the event. */ | ||||
| extern "C" void remove_event_from_dc(struct divecomputer *dc, struct event *event) | ||||
| void remove_event_from_dc(struct divecomputer *dc, struct event *event) | ||||
| { | ||||
| 	for (struct event **ep = &dc->events; *ep; ep = &(*ep)->next) { | ||||
| 		if (*ep == event) { | ||||
|  | @ -470,7 +470,7 @@ extern "C" void remove_event_from_dc(struct divecomputer *dc, struct event *even | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_extra_data(struct divecomputer *dc, const char *key, const char *value) | ||||
| void add_extra_data(struct divecomputer *dc, const char *key, const char *value) | ||||
| { | ||||
| 	struct extra_data **ed = &dc->extra_data; | ||||
| 
 | ||||
|  | @ -492,13 +492,21 @@ extern "C" void add_extra_data(struct divecomputer *dc, const char *key, const c | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| <<<<<<< HEAD | ||||
| ======= | ||||
| bool is_dc_planner(const struct divecomputer *dc) | ||||
| { | ||||
| 	return same_string(dc->model, "planned dive"); | ||||
| } | ||||
| 
 | ||||
| >>>>>>> ed6cdf19f (build: remove extern "C" linkage) | ||||
| /*
 | ||||
|  * Match two dive computer entries against each other, and | ||||
|  * tell if it's the same dive. Return 0 if "don't know", | ||||
|  * positive for "same dive" and negative for "definitely | ||||
|  * not the same dive" | ||||
|  */ | ||||
| extern "C" int match_one_dc(const struct divecomputer *a, const struct divecomputer *b) | ||||
| int match_one_dc(const struct divecomputer *a, const struct divecomputer *b) | ||||
| { | ||||
| 	/* Not same model? Don't know if matching.. */ | ||||
| 	if (!a->model || !b->model) | ||||
|  | @ -527,7 +535,7 @@ static void free_extra_data(struct extra_data *ed) | |||
| 	free((void *)ed->value); | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_dc_contents(struct divecomputer *dc) | ||||
| void free_dc_contents(struct divecomputer *dc) | ||||
| { | ||||
| 	free(dc->sample); | ||||
| 	free((void *)dc->model); | ||||
|  | @ -537,7 +545,7 @@ extern "C" void free_dc_contents(struct divecomputer *dc) | |||
| 	STRUCTURED_LIST_FREE(struct extra_data, dc->extra_data, free_extra_data); | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_dc(struct divecomputer *dc) | ||||
| void free_dc(struct divecomputer *dc) | ||||
| { | ||||
| 	free_dc_contents(dc); | ||||
| 	free(dc); | ||||
|  | @ -545,12 +553,12 @@ extern "C" void free_dc(struct divecomputer *dc) | |||
| 
 | ||||
| static const char *planner_dc_name = "planned dive"; | ||||
| 
 | ||||
| extern "C" bool is_dc_planner(const struct divecomputer *dc) | ||||
| bool is_dc_planner(const struct divecomputer *dc) | ||||
| { | ||||
| 	return same_string(dc->model, planner_dc_name); | ||||
| } | ||||
| 
 | ||||
| extern "C" void make_planner_dc(struct divecomputer *dc) | ||||
| void make_planner_dc(struct divecomputer *dc) | ||||
| { | ||||
| 	free((void *)dc->model); | ||||
| 	dc->model = strdup(planner_dc_name); | ||||
|  | @ -558,12 +566,12 @@ extern "C" void make_planner_dc(struct divecomputer *dc) | |||
| 
 | ||||
| const char *manual_dc_name = "manually added dive"; | ||||
| 
 | ||||
| extern "C" bool is_dc_manually_added_dive(const struct divecomputer *dc) | ||||
| bool is_dc_manually_added_dive(const struct divecomputer *dc) | ||||
| { | ||||
| 	return dc && same_string(dc->model, manual_dc_name); | ||||
| } | ||||
| 
 | ||||
| extern "C" void make_manually_added_dive_dc(struct divecomputer *dc) | ||||
| void make_manually_added_dive_dc(struct divecomputer *dc) | ||||
| { | ||||
| 	free((void *)dc->model); | ||||
| 	dc->model = strdup(manual_dc_name); | ||||
|  |  | |||
|  | @ -5,8 +5,6 @@ | |||
| #include "divemode.h" | ||||
| #include "units.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct extra_data; | ||||
| struct sample; | ||||
| 
 | ||||
|  | @ -75,6 +73,4 @@ extern void make_manually_added_dive_dc(struct divecomputer *dc); | |||
| /* Check if two dive computer entries are the exact same dive (-1=no/0=maybe/1=yes) */ | ||||
| extern int match_one_dc(const struct divecomputer *a, const struct divecomputer *b); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ | |||
|  *  - Nitrox trumps air (even if hypoxic) | ||||
|  * These are the same rules as the inter-dive sorting rules. | ||||
|  */ | ||||
| extern "C" void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2max_p) | ||||
| void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2max_p) | ||||
| { | ||||
| 	int i; | ||||
| 	int maxo2 = -1, maxhe = -1, mino2 = 1000; | ||||
|  | @ -63,7 +63,7 @@ extern "C" void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int | |||
| 	*o2max_p = maxo2; | ||||
| } | ||||
| 
 | ||||
| extern "C" int total_weight(const struct dive *dive) | ||||
| int total_weight(const struct dive *dive) | ||||
| { | ||||
| 	int i, total_grams = 0; | ||||
| 
 | ||||
|  | @ -424,7 +424,7 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive, bool in_p | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_divenr(const struct dive *dive) | ||||
| int get_divenr(const struct dive *dive) | ||||
| { | ||||
| 	int i; | ||||
| 	const struct dive *d; | ||||
|  | @ -442,7 +442,7 @@ extern "C" int get_divenr(const struct dive *dive) | |||
| /* return negative surface time if dives are overlapping */ | ||||
| /* The place you call this function is likely the place where you want
 | ||||
|  * to create the deco_state */ | ||||
| extern "C" int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_planner) | ||||
| int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_planner) | ||||
| { | ||||
| 	int i, divenr = -1; | ||||
| 	int surface_time = 48 * 60 * 60; | ||||
|  | @ -656,7 +656,7 @@ static int comp_dc(const struct divecomputer *dc1, const struct divecomputer *dc | |||
|  * We might also consider sorting by end-time and other criteria, | ||||
|  * but see the caveat above (editing means rearrangement of the dives). | ||||
|  */ | ||||
| extern "C" int comp_dives(const struct dive *a, const struct dive *b) | ||||
| int comp_dives(const struct dive *a, const struct dive *b) | ||||
| { | ||||
| 	int cmp; | ||||
| 	if (a->when < b->when) | ||||
|  | @ -697,7 +697,7 @@ MAKE_REMOVE(dive_table, struct dive *, dive) | |||
| MAKE_CLEAR_TABLE(dive_table, dives, dive) | ||||
| MAKE_MOVE_TABLE(dive_table, dives) | ||||
| 
 | ||||
| extern "C" void insert_dive(struct dive_table *table, struct dive *d) | ||||
| void insert_dive(struct dive_table *table, struct dive *d) | ||||
| { | ||||
| 	int idx = dive_table_get_insertion_index(table, d); | ||||
| 	add_to_dive_table(table, idx, d); | ||||
|  | @ -733,13 +733,13 @@ static void autogroup_dives(struct dive_table *table, struct trip_table *trip_ta | |||
| /* Remove a dive from a dive table. This assumes that the
 | ||||
|  * dive was already removed from any trip and deselected. | ||||
|  * It simply shrinks the table and frees the trip */ | ||||
| extern "C" void delete_dive_from_table(struct dive_table *table, int idx) | ||||
| void delete_dive_from_table(struct dive_table *table, int idx) | ||||
| { | ||||
| 	free_dive(table->dives[idx]); | ||||
| 	remove_from_dive_table(table, idx); | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *get_dive_from_table(int nr, const struct dive_table *dt) | ||||
| struct dive *get_dive_from_table(int nr, const struct dive_table *dt) | ||||
| { | ||||
| 	if (nr >= dt->nr || nr < 0) | ||||
| 		return NULL; | ||||
|  | @ -750,7 +750,7 @@ extern "C" struct dive *get_dive_from_table(int nr, const struct dive_table *dt) | |||
|  * resources associated with the dive. The caller must removed the dive | ||||
|  * from the trip-list. Returns a pointer to the unregistered dive. | ||||
|  * The unregistered dive has the selection- and hidden-flags cleared. */ | ||||
| extern "C" struct dive *unregister_dive(int idx) | ||||
| struct dive *unregister_dive(int idx) | ||||
| { | ||||
| 	struct dive *dive = get_dive(idx); | ||||
| 	if (!dive) | ||||
|  | @ -765,7 +765,7 @@ extern "C" struct dive *unregister_dive(int idx) | |||
| 	return dive; | ||||
| } | ||||
| 
 | ||||
| extern "C" void process_loaded_dives() | ||||
| void process_loaded_dives() | ||||
| { | ||||
| 	sort_dive_table(divelog.dives); | ||||
| 	sort_trip_table(divelog.trips); | ||||
|  | @ -944,7 +944,7 @@ static bool merge_dive_tables(struct dive_table *dives_from, struct dive_table * | |||
| /* Merge the dives of the trip "from" and the dive_table "dives_from" into the trip "to"
 | ||||
|  * and dive_table "dives_to". If "prefer_imported" is true, dive data of "from" takes | ||||
|  * precedence */ | ||||
| extern "C" void add_imported_dives(struct divelog *import_log, int flags) | ||||
| void add_imported_dives(struct divelog *import_log, int flags) | ||||
| { | ||||
| 	int i, idx; | ||||
| 	struct dive_table dives_to_add = empty_dive_table; | ||||
|  | @ -1024,7 +1024,6 @@ extern "C" void add_imported_dives(struct divelog *import_log, int flags) | |||
|  * Returns true if trip was merged. In this case, the trip will be | ||||
|  * freed. | ||||
|  */ | ||||
| extern "C" | ||||
| bool try_to_merge_trip(struct dive_trip *trip_import, struct dive_table *import_table, bool prefer_imported, | ||||
| 		       /* output parameters: */ | ||||
| 		       struct dive_table *dives_to_add, struct dive_table *dives_to_remove, | ||||
|  | @ -1081,7 +1080,6 @@ bool try_to_merge_trip(struct dive_trip *trip_import, struct dive_table *import_ | |||
|  * - If IMPORT_ADD_TO_NEW_TRIP is true, dives that are not assigned | ||||
|  *   to a trip will be added to a newly generated trip. | ||||
|  */ | ||||
| extern "C" | ||||
| void process_imported_dives(struct divelog *import_log, int flags, | ||||
| 			    /* output parameters: */ | ||||
| 			    struct dive_table *dives_to_add, struct dive_table *dives_to_remove, | ||||
|  | @ -1249,7 +1247,7 @@ static struct dive *get_last_valid_dive() | |||
|  * 	- last_nr+1 for addition at end of log (if last dive had a number) | ||||
|  * 	- 0 for all other cases | ||||
|  */ | ||||
| extern "C" int get_dive_nr_at_idx(int idx) | ||||
| int get_dive_nr_at_idx(int idx) | ||||
| { | ||||
| 	if (idx < divelog.dives->nr) | ||||
| 		return 0; | ||||
|  | @ -1261,12 +1259,12 @@ extern "C" int get_dive_nr_at_idx(int idx) | |||
| 
 | ||||
| static int min_datafile_version; | ||||
| 
 | ||||
| extern "C" int get_min_datafile_version() | ||||
| int get_min_datafile_version() | ||||
| { | ||||
| 	return min_datafile_version; | ||||
| } | ||||
| 
 | ||||
| extern "C" void report_datafile_version(int version) | ||||
| void report_datafile_version(int version) | ||||
| { | ||||
| 	if (min_datafile_version == 0 || min_datafile_version > version) | ||||
| 		min_datafile_version = version; | ||||
|  | @ -1291,7 +1289,7 @@ void clear_dive_file_data() | |||
| 	emit_reset_signal(); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool dive_less_than(const struct dive *a, const struct dive *b) | ||||
| bool dive_less_than(const struct dive *a, const struct dive *b) | ||||
| { | ||||
| 	return comp_dives(a, b) < 0; | ||||
| } | ||||
|  | @ -1330,7 +1328,7 @@ static int comp_dive_or_trip(struct dive_or_trip a, struct dive_or_trip b) | |||
| 		return -comp_dive_to_trip(b.dive, a.trip); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_trip b) | ||||
| bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_trip b) | ||||
| { | ||||
| 	return comp_dive_or_trip(a, b) < 0; | ||||
| } | ||||
|  | @ -1345,7 +1343,7 @@ extern "C" bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_tri | |||
|  * that happened inside other dives. The interval will always be calculated | ||||
|  * with respect to the dive that started previously. | ||||
|  */ | ||||
| extern "C" timestamp_t get_surface_interval(timestamp_t when) | ||||
| timestamp_t get_surface_interval(timestamp_t when) | ||||
| { | ||||
| 	int i; | ||||
| 	timestamp_t prev_end; | ||||
|  | @ -1366,7 +1364,7 @@ extern "C" timestamp_t get_surface_interval(timestamp_t when) | |||
| 
 | ||||
| /* Find visible dive close to given date. First search towards older,
 | ||||
|  * then newer dives. */ | ||||
| extern "C" struct dive *find_next_visible_dive(timestamp_t when) | ||||
| struct dive *find_next_visible_dive(timestamp_t when) | ||||
| { | ||||
| 	int i, j; | ||||
| 
 | ||||
|  | @ -1392,7 +1390,7 @@ extern "C" struct dive *find_next_visible_dive(timestamp_t when) | |||
| 	return NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool has_dive(unsigned int deviceid, unsigned int diveid) | ||||
| bool has_dive(unsigned int deviceid, unsigned int diveid) | ||||
| { | ||||
|        int i; | ||||
|        struct dive *dive; | ||||
|  |  | |||
|  | @ -4,8 +4,6 @@ | |||
| 
 | ||||
| #include "units.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| struct divelog; | ||||
| struct trip_table; | ||||
|  | @ -60,6 +58,4 @@ void move_dive_table(struct dive_table *src, struct dive_table *dst); | |||
| struct dive *unregister_dive(int idx); | ||||
| extern bool has_dive(unsigned int deviceid, unsigned int diveid); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // DIVELIST_H
 | ||||
|  |  | |||
|  | @ -92,7 +92,7 @@ void divelog::clear() | |||
| 	filter_presets->clear(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void clear_divelog(struct divelog *log) | ||||
| void clear_divelog(struct divelog *log) | ||||
| { | ||||
| 	log->clear(); | ||||
| } | ||||
|  |  | |||
|  | @ -27,11 +27,7 @@ struct divelog { | |||
| 
 | ||||
| extern struct divelog divelog; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| void clear_divelog(struct divelog *); | ||||
| extern void delete_single_dive(struct divelog *, int idx); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -25,26 +25,26 @@ | |||
|  * is freed, but the data it references. The object itself is passed in by value. | ||||
|  * This is due to the fact how the table macros work. | ||||
|  */ | ||||
| extern "C" void free_weightsystem(weightsystem_t ws) | ||||
| void free_weightsystem(weightsystem_t ws) | ||||
| { | ||||
| 	free((void *)ws.description); | ||||
| 	ws.description = NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_cylinder(cylinder_t c) | ||||
| void free_cylinder(cylinder_t c) | ||||
| { | ||||
| 	free((void *)c.type.description); | ||||
| 	c.type.description = NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_weights(const struct weightsystem_table *s, struct weightsystem_table *d) | ||||
| void copy_weights(const struct weightsystem_table *s, struct weightsystem_table *d) | ||||
| { | ||||
| 	clear_weightsystem_table(d); | ||||
| 	for (int i = 0; i < s->nr; i++) | ||||
| 		add_cloned_weightsystem(d, s->weightsystems[i]); | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_cylinders(const struct cylinder_table *s, struct cylinder_table *d) | ||||
| void copy_cylinders(const struct cylinder_table *s, struct cylinder_table *d) | ||||
| { | ||||
| 	int i; | ||||
| 	clear_cylinder_table(d); | ||||
|  | @ -76,7 +76,7 @@ const char *cylinderuse_text[NUM_GAS_USE] = { | |||
| 	QT_TRANSLATE_NOOP("gettextFromC", "OC-gas"), QT_TRANSLATE_NOOP("gettextFromC", "diluent"), QT_TRANSLATE_NOOP("gettextFromC", "oxygen"), QT_TRANSLATE_NOOP("gettextFromC", "not used") | ||||
| }; | ||||
| 
 | ||||
| extern "C" enum cylinderuse cylinderuse_from_text(const char *text) | ||||
| enum cylinderuse cylinderuse_from_text(const char *text) | ||||
| { | ||||
| 	for (int i = 0; i < static_cast<int>(NUM_GAS_USE); i++) { | ||||
| 		if (same_string(text, cylinderuse_text[i]) || same_string(text, translate("gettextFromC", cylinderuse_text[i]))) | ||||
|  | @ -178,7 +178,7 @@ weight_t get_weightsystem_weight(const std::string &name) | |||
| 	return it != ws_info_table.end() ? it->weight : weight_t(); | ||||
| } | ||||
| 
 | ||||
| extern "C" weightsystem_t clone_weightsystem(weightsystem_t ws) | ||||
| weightsystem_t clone_weightsystem(weightsystem_t ws) | ||||
| { | ||||
| 	weightsystem_t res = { ws.weight, copy_string(ws.description), ws.auto_filled }; | ||||
| 	return res; | ||||
|  | @ -186,19 +186,19 @@ extern "C" weightsystem_t clone_weightsystem(weightsystem_t ws) | |||
| 
 | ||||
| /* Add a clone of a weightsystem to the end of a weightsystem table.
 | ||||
|  * Cloned means that the description-string is copied. */ | ||||
| extern "C" void add_cloned_weightsystem(struct weightsystem_table *t, weightsystem_t ws) | ||||
| void add_cloned_weightsystem(struct weightsystem_table *t, weightsystem_t ws) | ||||
| { | ||||
| 	add_to_weightsystem_table(t, t->nr, clone_weightsystem(ws)); | ||||
| } | ||||
| 
 | ||||
| extern "C" cylinder_t clone_cylinder(cylinder_t cyl) | ||||
| cylinder_t clone_cylinder(cylinder_t cyl) | ||||
| { | ||||
| 	cylinder_t res = cyl; | ||||
| 	res.type.description = copy_string(res.type.description); | ||||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_cylinder(struct cylinder_table *t, int idx, cylinder_t cyl) | ||||
| void add_cylinder(struct cylinder_table *t, int idx, cylinder_t cyl) | ||||
| { | ||||
| 	add_to_cylinder_table(t, idx, cyl); | ||||
| 	/* FIXME: This is a horrible hack: we make sure that at the end of
 | ||||
|  | @ -212,18 +212,18 @@ extern "C" void add_cylinder(struct cylinder_table *t, int idx, cylinder_t cyl) | |||
| 
 | ||||
| /* Add a clone of a cylinder to the end of a cylinder table.
 | ||||
|  * Cloned means that the description-string is copied. */ | ||||
| extern "C" void add_cloned_cylinder(struct cylinder_table *t, cylinder_t cyl) | ||||
| void add_cloned_cylinder(struct cylinder_table *t, cylinder_t cyl) | ||||
| { | ||||
| 	add_cylinder(t, t->nr, clone_cylinder(cyl)); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool same_weightsystem(weightsystem_t w1, weightsystem_t w2) | ||||
| bool same_weightsystem(weightsystem_t w1, weightsystem_t w2) | ||||
| { | ||||
| 	return w1.weight.grams == w2.weight.grams && | ||||
| 	       same_string(w1.description, w2.description); | ||||
| } | ||||
| 
 | ||||
| extern "C" void get_gas_string(struct gasmix gasmix, char *text, int len) | ||||
| void get_gas_string(struct gasmix gasmix, char *text, int len) | ||||
| { | ||||
| 	if (gasmix_is_air(gasmix)) | ||||
| 		snprintf(text, len, "%s", translate("gettextFromC", "air")); | ||||
|  | @ -236,21 +236,21 @@ extern "C" void get_gas_string(struct gasmix gasmix, char *text, int len) | |||
| } | ||||
| 
 | ||||
| /* Returns a static char buffer - only good for immediate use by printf etc */ | ||||
| extern "C" const char *gasname(struct gasmix gasmix) | ||||
| const char *gasname(struct gasmix gasmix) | ||||
| { | ||||
| 	static char gas[64]; | ||||
| 	get_gas_string(gasmix, gas, sizeof(gas)); | ||||
| 	return gas; | ||||
| } | ||||
| 
 | ||||
| extern "C" int gas_volume(const cylinder_t *cyl, pressure_t p) | ||||
| int gas_volume(const cylinder_t *cyl, pressure_t p) | ||||
| { | ||||
| 	double bar = p.mbar / 1000.0; | ||||
| 	double z_factor = gas_compressibility_factor(cyl->gasmix, bar); | ||||
| 	return lrint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); | ||||
| } | ||||
| 
 | ||||
| extern "C" int find_best_gasmix_match(struct gasmix mix, const struct cylinder_table *cylinders) | ||||
| int find_best_gasmix_match(struct gasmix mix, const struct cylinder_table *cylinders) | ||||
| { | ||||
| 	int i; | ||||
| 	int best = -1, score = INT_MAX; | ||||
|  | @ -355,18 +355,18 @@ struct std::vector<ws_info> ws_info_table = { | |||
| 	{ QT_TRANSLATE_NOOP("gettextFromC", "clip-on"), weight_t() }, | ||||
| }; | ||||
| 
 | ||||
| extern "C" void remove_cylinder(struct dive *dive, int idx) | ||||
| void remove_cylinder(struct dive *dive, int idx) | ||||
| { | ||||
| 	remove_from_cylinder_table(&dive->cylinders, idx); | ||||
| } | ||||
| 
 | ||||
| extern "C" void remove_weightsystem(struct dive *dive, int idx) | ||||
| void remove_weightsystem(struct dive *dive, int idx) | ||||
| { | ||||
| 	remove_from_weightsystem_table(&dive->weightsystems, idx); | ||||
| } | ||||
| 
 | ||||
| // ws is cloned.
 | ||||
| extern "C" void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws) | ||||
| void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws) | ||||
| { | ||||
| 	if (idx < 0 || idx >= dive->weightsystems.nr) | ||||
| 		return; | ||||
|  | @ -376,7 +376,7 @@ extern "C" void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws) | |||
| 
 | ||||
| /* when planning a dive we need to make sure that all cylinders have a sane depth assigned
 | ||||
|  * and if we are tracking gas consumption the pressures need to be reset to start = end = workingpressure */ | ||||
| extern "C" void reset_cylinders(struct dive *dive, bool track_gas) | ||||
| void reset_cylinders(struct dive *dive, bool track_gas) | ||||
| { | ||||
| 	pressure_t decopo2 = {.mbar = prefs.decopo2}; | ||||
| 
 | ||||
|  | @ -403,7 +403,7 @@ static void copy_cylinder_type(const cylinder_t *s, cylinder_t *d) | |||
| } | ||||
| 
 | ||||
| /* copy the equipment data part of the cylinders but keep pressures */ | ||||
| extern "C" void copy_cylinder_types(const struct dive *s, struct dive *d) | ||||
| void copy_cylinder_types(const struct dive *s, struct dive *d) | ||||
| { | ||||
| 	int i; | ||||
| 	if (!s || !d) | ||||
|  | @ -416,7 +416,7 @@ extern "C" void copy_cylinder_types(const struct dive *s, struct dive *d) | |||
| 		add_cloned_cylinder(&d->cylinders, *get_cylinder(s, i)); | ||||
| } | ||||
| 
 | ||||
| extern "C" cylinder_t *add_empty_cylinder(struct cylinder_table *t) | ||||
| cylinder_t *add_empty_cylinder(struct cylinder_table *t) | ||||
| { | ||||
| 	cylinder_t cyl = empty_cylinder; | ||||
| 	cyl.type.description = strdup(""); | ||||
|  | @ -432,7 +432,7 @@ extern "C" cylinder_t *add_empty_cylinder(struct cylinder_table *t) | |||
|  *   Multiple cylinders might be created if the index is bigger than the | ||||
|  *   number of existing cylinders | ||||
|  */ | ||||
| extern "C" cylinder_t *get_cylinder(const struct dive *d, int idx) | ||||
| cylinder_t *get_cylinder(const struct dive *d, int idx) | ||||
| { | ||||
| 	/* FIXME: The planner uses a dummy cylinder one past the official number of cylinders
 | ||||
| 	 * in the table to mark no-cylinder surface interavals. This is horrendous. Fix ASAP. */ | ||||
|  | @ -444,7 +444,7 @@ extern "C" cylinder_t *get_cylinder(const struct dive *d, int idx) | |||
| 	return &d->cylinders.cylinders[idx]; | ||||
| } | ||||
| 
 | ||||
| extern "C" cylinder_t *get_or_create_cylinder(struct dive *d, int idx) | ||||
| cylinder_t *get_or_create_cylinder(struct dive *d, int idx) | ||||
| { | ||||
| 	if (idx < 0) { | ||||
| 		report_info("Warning: accessing invalid cylinder %d", idx); | ||||
|  | @ -456,7 +456,7 @@ extern "C" cylinder_t *get_or_create_cylinder(struct dive *d, int idx) | |||
| } | ||||
| 
 | ||||
| /* if a default cylinder is set, use that */ | ||||
| extern "C" void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl) | ||||
| void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl) | ||||
| { | ||||
| 	const char *cyl_name = prefs.default_cylinder; | ||||
| 	pressure_t pO2 = {.mbar = static_cast<int>(lrint(prefs.modpO2 * 1000.0))}; | ||||
|  | @ -481,7 +481,7 @@ extern "C" void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" cylinder_t create_new_cylinder(const struct dive *d) | ||||
| cylinder_t create_new_cylinder(const struct dive *d) | ||||
| { | ||||
| 	cylinder_t cyl = empty_cylinder; | ||||
| 	fill_default_cylinder(d, &cyl); | ||||
|  | @ -537,7 +537,7 @@ static bool show_cylinder(const struct dive *d, int i) | |||
| } | ||||
| 
 | ||||
| /* The unused cylinders at the end of the cylinder list are hidden. */ | ||||
| extern "C" int first_hidden_cylinder(const struct dive *d) | ||||
| int first_hidden_cylinder(const struct dive *d) | ||||
| { | ||||
| 	int res = d->cylinders.nr; | ||||
| 	while (res > 0 && !show_cylinder(d, res - 1)) | ||||
|  | @ -546,7 +546,7 @@ extern "C" int first_hidden_cylinder(const struct dive *d) | |||
| } | ||||
| 
 | ||||
| #ifdef DEBUG_CYL | ||||
| extern "C" void dump_cylinders(struct dive *dive, bool verbose) | ||||
| void dump_cylinders(struct dive *dive, bool verbose) | ||||
| { | ||||
| 	printf("Cylinder list:\n"); | ||||
| 	for (int i = 0; i < dive->cylinders; i++) { | ||||
|  |  | |||
|  | @ -8,8 +8,6 @@ | |||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| 
 | ||||
| enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NOT_USED, NUM_GAS_USE}; // The different uses for cylinders
 | ||||
|  | @ -109,8 +107,6 @@ extern void add_cylinder(struct cylinder_table *, int idx, cylinder_t cyl); | |||
| void get_gas_string(struct gasmix gasmix, char *text, int len); | ||||
| const char *gasname(struct gasmix gasmix); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| struct ws_info { | ||||
| 	std::string name; | ||||
| 	weight_t weight; | ||||
|  |  | |||
|  | @ -4,8 +4,6 @@ | |||
| 
 | ||||
| // error reporting functions
 | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #ifdef __GNUC__ | ||||
| #define __printf(x, y) __attribute__((__format__(__printf__, x, y))) | ||||
| #else | ||||
|  | @ -17,6 +15,4 @@ extern int __printf(1, 2) report_error(const char *fmt, ...); | |||
| extern void __printf(1, 2) report_info(const char *fmt, ...); | ||||
| extern void set_error_cb(void(*cb)(char *));	// Callback takes ownership of passed string
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -8,8 +8,6 @@ | |||
| 
 | ||||
| #include <libdivecomputer/parser.h> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| enum event_severity { | ||||
| 	EVENT_SEVERITY_NONE = 0, | ||||
| 	EVENT_SEVERITY_INFO, | ||||
|  | @ -58,6 +56,4 @@ extern enum event_severity get_event_severity(const struct event *ev); | |||
| extern const struct event *get_next_event(const struct event *event, const char *name); | ||||
| extern struct event *get_next_event_mutable(struct event *event, const char *name); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -27,12 +27,12 @@ static bool operator==(const event_type &en1, const event_type &en2) | |||
| 	return en1.name == en2.name && en1.severity == en2.severity; | ||||
| } | ||||
| 
 | ||||
| extern "C" void clear_event_types() | ||||
| void clear_event_types() | ||||
| { | ||||
| 	event_types.clear(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void remember_event_type(const struct event *ev) | ||||
| void remember_event_type(const struct event *ev) | ||||
| { | ||||
| 	if (empty_string(ev->name)) | ||||
| 		return; | ||||
|  | @ -42,33 +42,33 @@ extern "C" void remember_event_type(const struct event *ev) | |||
| 	event_types.push_back(std::move(type)); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool is_event_type_hidden(const struct event *ev) | ||||
| bool is_event_type_hidden(const struct event *ev) | ||||
| { | ||||
| 	auto it = std::find(event_types.begin(), event_types.end(), ev); | ||||
| 	return it != event_types.end() && !it->plot; | ||||
| } | ||||
| 
 | ||||
| extern "C" void hide_event_type(const struct event *ev) | ||||
| void hide_event_type(const struct event *ev) | ||||
| { | ||||
| 	auto it = std::find(event_types.begin(), event_types.end(), ev); | ||||
| 	if (it != event_types.end()) | ||||
| 		it->plot = false; | ||||
| } | ||||
| 
 | ||||
| extern "C" void show_all_event_types() | ||||
| void show_all_event_types() | ||||
| { | ||||
| 	for (event_type &e: event_types) | ||||
| 		e.plot = true; | ||||
| } | ||||
| 
 | ||||
| extern "C" void show_event_type(int idx) | ||||
| void show_event_type(int idx) | ||||
| { | ||||
| 	if (idx < 0 || idx >= (int)event_types.size()) | ||||
| 		return; | ||||
| 	event_types[idx].plot = true; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool any_event_types_hidden() | ||||
| bool any_event_types_hidden() | ||||
| { | ||||
| 	return std::any_of(event_types.begin(), event_types.end(), | ||||
| 			   [] (const event_type &e) { return !e.plot; }); | ||||
|  |  | |||
|  | @ -6,8 +6,6 @@ | |||
| #include <vector> | ||||
| #include <QString> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern void clear_event_types(void); | ||||
| extern void remember_event_type(const struct event *ev); | ||||
| extern bool is_event_type_hidden(const struct event *ev); | ||||
|  | @ -15,11 +13,8 @@ extern void hide_event_type(const struct event *ev); | |||
| extern void show_all_event_types(); | ||||
| extern void show_event_type(int idx); | ||||
| extern bool any_event_types_hidden(); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| extern std::vector<int> hidden_event_types(); | ||||
| QString event_type_name(const event *ev); | ||||
| QString event_type_name(int idx); | ||||
| extern QString event_type_name(const event *ev); | ||||
| extern QString event_type_name(int idx); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ static void zip_read(struct zip_file *file, const char *filename, struct divelog | |||
| 	(void) parse_xml_buffer(filename, mem.data(), read, log, NULL); | ||||
| } | ||||
| 
 | ||||
| extern "C" int try_to_open_zip(const char *filename, struct divelog *log) | ||||
| int try_to_open_zip(const char *filename, struct divelog *log) | ||||
| { | ||||
| 	int success = 0; | ||||
| 	/* Grr. libzip needs to re-open the file, it can't take a buffer */ | ||||
|  | @ -268,7 +268,7 @@ bool remote_repo_uptodate(const char *filename, struct git_info *info) | |||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_file(const char *filename, struct divelog *log) | ||||
| int parse_file(const char *filename, struct divelog *log) | ||||
| { | ||||
| 	struct git_info info; | ||||
| 	const char *fmt; | ||||
|  |  | |||
|  | @ -12,7 +12,6 @@ | |||
| struct divelog; | ||||
| struct zip; | ||||
| 
 | ||||
| extern "C" { | ||||
| extern void ostctools_import(const char *file, struct divelog *log); | ||||
| 
 | ||||
| extern int parse_file(const char *filename, struct divelog *log); | ||||
|  | @ -28,11 +27,7 @@ extern int subsurface_access(const char *path, int mode); | |||
| extern int subsurface_stat(const char *path, struct stat *buf); | ||||
| extern struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp); | ||||
| extern int subsurface_zip_close(struct zip *zip); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // return data, errorcode pair.
 | ||||
| extern std::pair<std::string, int> readfile(const char *filename); | ||||
| extern std::pair<std::string, int> readfile(const char *filename); // return data, errorcode pair.
 | ||||
| extern int try_to_open_cochran(const char *filename, std::string &mem, struct divelog *log); | ||||
| extern int try_to_open_liquivision(const char *filename, std::string &mem, struct divelog *log); | ||||
| extern int datatrak_import(std::string &mem, std::string &wl_mem, struct divelog *log); | ||||
|  |  | |||
|  | @ -164,57 +164,57 @@ static enum filter_constraint_range_mode filter_constraint_range_mode_from_strin | |||
| 	return FILTER_CONSTRAINT_EQUAL; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *filter_constraint_type_to_string(enum filter_constraint_type type) | ||||
| const char *filter_constraint_type_to_string(enum filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc ? desc->token : "unknown"; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *filter_constraint_string_mode_to_string(enum filter_constraint_string_mode mode) | ||||
| const char *filter_constraint_string_mode_to_string(enum filter_constraint_string_mode mode) | ||||
| { | ||||
| 	const string_mode_description *desc = get_string_mode_description(mode); | ||||
| 	return desc ? desc->token : "unknown"; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *filter_constraint_range_mode_to_string(enum filter_constraint_range_mode mode) | ||||
| const char *filter_constraint_range_mode_to_string(enum filter_constraint_range_mode mode) | ||||
| { | ||||
| 	const range_mode_description *desc = get_range_mode_description(mode); | ||||
| 	return desc ? desc->token : "unknown"; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_constraint_type_to_index(enum filter_constraint_type type) | ||||
| int filter_constraint_type_to_index(enum filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc ? desc - type_descriptions : -1; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_constraint_string_mode_to_index(enum filter_constraint_string_mode mode) | ||||
| int filter_constraint_string_mode_to_index(enum filter_constraint_string_mode mode) | ||||
| { | ||||
| 	const string_mode_description *desc = get_string_mode_description(mode); | ||||
| 	return desc ? desc - string_mode_descriptions : -1; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_constraint_range_mode_to_index(enum filter_constraint_range_mode mode) | ||||
| int filter_constraint_range_mode_to_index(enum filter_constraint_range_mode mode) | ||||
| { | ||||
| 	const range_mode_description *desc = get_range_mode_description(mode); | ||||
| 	return desc ? desc - range_mode_descriptions : -1; | ||||
| } | ||||
| 
 | ||||
| extern "C" enum filter_constraint_type filter_constraint_type_from_index(int index) | ||||
| enum filter_constraint_type filter_constraint_type_from_index(int index) | ||||
| { | ||||
| 	if (index >= 0 && index < (int)std::size(type_descriptions)) | ||||
| 		return type_descriptions[index].type; | ||||
| 	return (enum filter_constraint_type)-1; | ||||
| } | ||||
| 
 | ||||
| extern "C" enum filter_constraint_string_mode filter_constraint_string_mode_from_index(int index) | ||||
| enum filter_constraint_string_mode filter_constraint_string_mode_from_index(int index) | ||||
| { | ||||
| 	if (index >= 0 && index < (int)std::size(string_mode_descriptions)) | ||||
| 		return string_mode_descriptions[index].mode; | ||||
| 	return (enum filter_constraint_string_mode)-1; | ||||
| } | ||||
| 
 | ||||
| extern "C" enum filter_constraint_range_mode filter_constraint_range_mode_from_index(int index) | ||||
| enum filter_constraint_range_mode filter_constraint_range_mode_from_index(int index) | ||||
| { | ||||
| 	if (index >= 0 && index < (int)std::size(range_mode_descriptions)) | ||||
| 		return range_mode_descriptions[index].mode; | ||||
|  | @ -390,7 +390,7 @@ QStringList filter_contraint_multiple_choice_translated(enum filter_constraint_t | |||
| 	return QStringList(); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_is_string(filter_constraint_type type) | ||||
| bool filter_constraint_is_string(filter_constraint_type type) | ||||
| { | ||||
| 	// Currently a constraint is filter based if and only if it has a string
 | ||||
| 	// mode (i.e. starts with, substring, exact). In the future we might also
 | ||||
|  | @ -398,7 +398,7 @@ extern "C" bool filter_constraint_is_string(filter_constraint_type type) | |||
| 	return filter_constraint_has_string_mode(type); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_is_timestamp(filter_constraint_type type) | ||||
| bool filter_constraint_is_timestamp(filter_constraint_type type) | ||||
| { | ||||
| 	return type == FILTER_CONSTRAINT_DATE || type == FILTER_CONSTRAINT_DATE_TIME; | ||||
| } | ||||
|  | @ -408,37 +408,37 @@ static bool is_numerical_constraint(filter_constraint_type type) | |||
| 	return !filter_constraint_is_string(type) && !filter_constraint_is_timestamp(type); | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_has_string_mode(enum filter_constraint_type type) | ||||
| bool filter_constraint_has_string_mode(enum filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc && desc->has_string_mode; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_has_range_mode(enum filter_constraint_type type) | ||||
| bool filter_constraint_has_range_mode(enum filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc && desc->has_range_mode; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_is_star(filter_constraint_type type) | ||||
| bool filter_constraint_is_star(filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc && desc->is_star_widget; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_has_date_widget(filter_constraint_type type) | ||||
| bool filter_constraint_has_date_widget(filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc && desc->has_date; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool filter_constraint_has_time_widget(filter_constraint_type type) | ||||
| bool filter_constraint_has_time_widget(filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc && desc->has_time; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_constraint_num_decimals(enum filter_constraint_type type) | ||||
| int filter_constraint_num_decimals(enum filter_constraint_type type) | ||||
| { | ||||
| 	const type_description *desc = get_type_description(type); | ||||
| 	return desc ? desc->decimal_places : 1; | ||||
|  | @ -446,7 +446,7 @@ extern "C" int filter_constraint_num_decimals(enum filter_constraint_type type) | |||
| 
 | ||||
| // String constraints are valid if there is at least one term.
 | ||||
| // Other constraints are always valid.
 | ||||
| extern "C" bool filter_constraint_is_valid(const struct filter_constraint *constraint) | ||||
| bool filter_constraint_is_valid(const struct filter_constraint *constraint) | ||||
| { | ||||
| 	if (!filter_constraint_is_string(constraint->type)) | ||||
| 		return true; | ||||
|  |  | |||
|  | @ -9,8 +9,6 @@ | |||
| 
 | ||||
| struct dive; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| enum filter_constraint_type { | ||||
| 	FILTER_CONSTRAINT_DATE, | ||||
| 	FILTER_CONSTRAINT_DATE_TIME, | ||||
|  | @ -111,8 +109,6 @@ extern bool filter_constraint_has_time_widget(enum filter_constraint_type); | |||
| extern int filter_constraint_num_decimals(enum filter_constraint_type); | ||||
| extern bool filter_constraint_is_valid(const struct filter_constraint *constraint); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| QString filter_constraint_type_to_string_translated(enum filter_constraint_type); | ||||
| QString filter_constraint_negate_to_string_translated(bool negate); | ||||
| QString filter_constraint_string_mode_to_string_translated(enum filter_constraint_string_mode); | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ static filter_preset_table &global_table() | |||
| 	return *divelog.filter_presets; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_presets_count(void) | ||||
| int filter_presets_count(void) | ||||
| { | ||||
| 	return (int)global_table().size(); | ||||
| } | ||||
|  | @ -19,7 +19,7 @@ extern std::string filter_preset_fulltext_query(int preset) | |||
| 	return global_table()[preset].data.fullText.originalQuery.toStdString(); | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *filter_preset_fulltext_mode(int preset) | ||||
| const char *filter_preset_fulltext_mode(int preset) | ||||
| { | ||||
| 	switch (global_table()[preset].data.fulltextStringMode) { | ||||
| 	default: | ||||
|  | @ -32,7 +32,7 @@ extern "C" const char *filter_preset_fulltext_mode(int preset) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void filter_preset_set_fulltext(struct filter_preset *preset, const char *fulltext, const char *fulltext_string_mode) | ||||
| void filter_preset_set_fulltext(struct filter_preset *preset, const char *fulltext, const char *fulltext_string_mode) | ||||
| { | ||||
| 	if (same_string(fulltext_string_mode, "substring")) | ||||
| 		preset->data.fulltextStringMode = StringFilterMode::SUBSTRING; | ||||
|  | @ -43,17 +43,17 @@ extern "C" void filter_preset_set_fulltext(struct filter_preset *preset, const c | |||
| 	preset->data.fullText = fulltext; | ||||
| } | ||||
| 
 | ||||
| extern "C" int filter_preset_constraint_count(int preset) | ||||
| int filter_preset_constraint_count(int preset) | ||||
| { | ||||
| 	return (int)global_table()[preset].data.constraints.size(); | ||||
| } | ||||
| 
 | ||||
| extern "C" const filter_constraint *filter_preset_constraint(int preset, int constraint) | ||||
| const filter_constraint *filter_preset_constraint(int preset, int constraint) | ||||
| { | ||||
| 	return &global_table()[preset].data.constraints[constraint]; | ||||
| } | ||||
| 
 | ||||
| extern "C" void filter_preset_set_name(struct filter_preset *preset, const char *name) | ||||
| void filter_preset_set_name(struct filter_preset *preset, const char *name) | ||||
| { | ||||
| 	preset->name = name; | ||||
| } | ||||
|  | @ -83,13 +83,13 @@ static std::string get_unique_preset_name(const std::string &orig, const struct | |||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_filter_preset_to_table(const struct filter_preset *preset, struct filter_preset_table *table) | ||||
| void add_filter_preset_to_table(const struct filter_preset *preset, struct filter_preset_table *table) | ||||
| { | ||||
| 	std::string name = get_unique_preset_name(preset->name, *table); | ||||
| 	filter_preset_add_to_table(name, preset->data, *table); | ||||
| } | ||||
| 
 | ||||
| extern "C" void filter_preset_add_constraint(struct filter_preset *preset, const char *type, const char *string_mode, | ||||
| void filter_preset_add_constraint(struct filter_preset *preset, const char *type, const char *string_mode, | ||||
| 					     const char *range_mode, bool negate, const char *data) | ||||
| { | ||||
| 	preset->data.constraints.emplace_back(type, string_mode, range_mode, negate, data); | ||||
|  |  | |||
|  | @ -29,8 +29,6 @@ struct filter_preset_table : public std::vector<filter_preset> | |||
| { | ||||
| }; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| // The C IO code accesses the filter presets via integer indices.
 | ||||
| extern int filter_presets_count(void); | ||||
| extern const char *filter_preset_fulltext_mode(int preset); // string mode of fulltext query. ownership is *not* passed to caller.
 | ||||
|  | @ -41,9 +39,6 @@ extern void filter_preset_set_fulltext(struct filter_preset *preset, const char | |||
| extern void add_filter_preset_to_table(const struct filter_preset *preset, struct filter_preset_table *table); | ||||
| extern void filter_preset_add_constraint(struct filter_preset *preset, const char *type, const char *string_mode, | ||||
| 					 const char *range_mode, bool negate, const char *data); // called by the parser, therefore data passed as strings.
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| int filter_preset_id(const std::string &s); // for now, we assume that names are unique. returns -1 if no preset with that name.
 | ||||
| void filter_preset_set(int preset, const FilterData &d); // this will override a preset if the name already exists.
 | ||||
| FilterData filter_preset_get(int preset); | ||||
|  |  | |||
|  | @ -35,8 +35,6 @@ static FullText self; | |||
| 
 | ||||
| // C-interface functions
 | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| void fulltext_register(struct dive *d) | ||||
| { | ||||
| 	self.registerDive(d); | ||||
|  | @ -57,8 +55,6 @@ void fulltext_populate() | |||
| 	self.populate(); | ||||
| } | ||||
| 
 | ||||
| } // extern "C"
 | ||||
| 
 | ||||
| // C++-only interface functions
 | ||||
| FullTextResult fulltext_find_dives(const FullTextQuery &q, StringFilterMode mode) | ||||
| { | ||||
|  |  | |||
|  | @ -14,9 +14,8 @@ | |||
| #ifndef FULLTEXT_H | ||||
| #define FULLTEXT_H | ||||
| 
 | ||||
| // 1) The C-accessible interface
 | ||||
| 
 | ||||
| extern "C" { | ||||
| #include <QString> | ||||
| #include <vector> | ||||
| 
 | ||||
| struct full_text_cache; | ||||
| struct dive; | ||||
|  | @ -25,13 +24,6 @@ void fulltext_unregister(struct dive *d); // Note: can be called repeatedly | |||
| void fulltext_unregister_all(); // Unregisters all dives in the dive table
 | ||||
| void fulltext_populate(); // Registers all dives in the dive table
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // 2) The C++-only interface
 | ||||
| 
 | ||||
| #include <QString> | ||||
| #include <vector> | ||||
| 
 | ||||
| enum class StringFilterMode { | ||||
| 	SUBSTRING = 0, | ||||
| 	STARTSWITH = 1, | ||||
|  |  | |||
|  | @ -5,8 +5,6 @@ | |||
| #include "divemode.h" | ||||
| #include "units.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| enum gas_component { N2, HE, O2 }; | ||||
| 
 | ||||
| // o2 == 0 && he == 0 -> air
 | ||||
|  | @ -71,6 +69,4 @@ extern enum gastype gasmix_to_type(struct gasmix mix); | |||
| extern const char *gastype_name(enum gastype type); | ||||
| extern fraction_t make_fraction(int f); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ | |||
| #ifndef MYGETTEXT_H | ||||
| #define MYGETTEXT_H | ||||
| 
 | ||||
| extern "C" const char *trGettext(const char *); | ||||
| const char *trGettext(const char *); | ||||
| static inline const char *translate(const char *, const char *arg) | ||||
| { | ||||
| 	return trGettext(arg); | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| static QHash<QByteArray, QByteArray> translationCache; | ||||
| static QMutex lock; | ||||
| 
 | ||||
| extern "C" const char *trGettext(const char *text) | ||||
| const char *trGettext(const char *text) | ||||
| { | ||||
| 	QByteArray key(text); | ||||
| 	QMutexLocker l(&lock); | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| 
 | ||||
| #include <QCoreApplication> | ||||
| 
 | ||||
| extern "C" const char *trGettext(const char *text); | ||||
| const char *trGettext(const char *text); | ||||
| 
 | ||||
| class gettextFromC { | ||||
| 	Q_DECLARE_TR_FUNCTIONS(gettextFromC) | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ static bool includes_string_caseinsensitive(const char *haystack, const char *ne | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void set_git_update_cb(int(*cb)(const char *)) | ||||
| void set_git_update_cb(int(*cb)(const char *)) | ||||
| { | ||||
| 	update_progress_cb = cb; | ||||
| } | ||||
|  | @ -69,7 +69,7 @@ extern "C" void set_git_update_cb(int(*cb)(const char *)) | |||
| // proportional - some parts are based on compute performance, some on network speed)
 | ||||
| // they also provide information where in the process we are so we can analyze the log
 | ||||
| // to understand which parts of the process take how much time.
 | ||||
| extern "C" int git_storage_update_progress(const char *text) | ||||
| int git_storage_update_progress(const char *text) | ||||
| { | ||||
| 	int ret = 0; | ||||
| 	if (update_progress_cb) | ||||
|  | @ -241,7 +241,7 @@ static bool exceeded_auth_attempts() | |||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| extern "C" int credential_ssh_cb(git_cred **out, | ||||
| int credential_ssh_cb(git_cred **out, | ||||
| 		  const char *, | ||||
| 		  const char *, | ||||
| 		  unsigned int allowed_types, | ||||
|  | @ -273,7 +273,7 @@ extern "C" int credential_ssh_cb(git_cred **out, | |||
| 	return GIT_EUSER; | ||||
| } | ||||
| 
 | ||||
| extern "C" int credential_https_cb(git_cred **out, | ||||
| int credential_https_cb(git_cred **out, | ||||
| 			const char *, | ||||
| 			const char *, | ||||
| 			unsigned int, | ||||
|  | @ -288,7 +288,7 @@ extern "C" int credential_https_cb(git_cred **out, | |||
| 	return git_cred_userpass_plaintext_new(out, username, password); | ||||
| } | ||||
| 
 | ||||
| extern "C" int certificate_check_cb(git_cert *cert, int valid, const char *host, void *) | ||||
| int certificate_check_cb(git_cert *cert, int valid, const char *host, void *) | ||||
| { | ||||
| 	if (verbose) | ||||
| 		report_info("git storage: certificate callback for host %s with validity %d\n", host, valid); | ||||
|  | @ -339,7 +339,7 @@ static int update_remote(struct git_info *info, git_remote *origin, git_referenc | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree); | ||||
| int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree); | ||||
| 
 | ||||
| static int try_to_git_merge(struct git_info *info, git_reference **local_p, git_reference *, git_oid *base, const git_oid *local_id, const git_oid *remote_id) | ||||
| { | ||||
|  |  | |||
|  | @ -11,8 +11,6 @@ struct git_oid; | |||
| struct git_repository; | ||||
| struct divelog; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #define CLOUD_HOST_US "ssrf-cloud-us.subsurface-divelog.org"  // preferred (faster/bigger) server in the US
 | ||||
| #define CLOUD_HOST_U2 "ssrf-cloud-u2.subsurface-divelog.org"  // secondary (older) server in the US
 | ||||
| #define CLOUD_HOST_EU "ssrf-cloud-eu.subsurface-divelog.org"  // preferred (faster/bigger) server in Germany
 | ||||
|  | @ -30,8 +28,6 @@ void set_git_update_cb(int(*)(const char *)); | |||
| int git_storage_update_progress(const char *text); | ||||
| int get_authorship(git_repository *repo, git_signature **authorp); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| struct git_info { | ||||
| 	std::string url; | ||||
| 	std::string branch; | ||||
|  |  | |||
|  | @ -199,7 +199,7 @@ static int cobalt_dive(void *param, int, char **data, char **) | |||
| 	return SQLITE_OK; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	struct parser_state state; | ||||
|  |  | |||
|  | @ -270,7 +270,7 @@ static int parse_dan_format(const char *filename, struct xml_params *params, str | |||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_csv_file(const char *filename, struct xml_params *params, const char *csvtemplate, struct divelog *log) | ||||
| int parse_csv_file(const char *filename, struct xml_params *params, const char *csvtemplate, struct divelog *log) | ||||
| { | ||||
| 	int ret; | ||||
| 	std::string mem; | ||||
|  |  | |||
|  | @ -21,8 +21,6 @@ enum csv_format { | |||
| 
 | ||||
| #define MAXCOLDIGITS 10 | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| int parse_csv_file(const char *filename, struct xml_params *params, const char *csvtemplate, struct divelog *log); | ||||
| int try_to_open_csv(std::string &mem, enum csv_format type, struct divelog *log); | ||||
| int parse_txt_file(const char *filename, const char *csv, struct divelog *log); | ||||
|  | @ -30,6 +28,4 @@ int parse_txt_file(const char *filename, const char *csv, struct divelog *log); | |||
| int parse_seabear_log(const char *filename, struct divelog *log); | ||||
| int parse_manual_file(const char *filename, struct xml_params *params, struct divelog *log); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // IMPORTCSV_H
 | ||||
|  |  | |||
|  | @ -384,7 +384,7 @@ static int divinglog_dive(void *param, int, char **data, char **) | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| extern "C" int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	struct parser_state state; | ||||
|  |  | |||
|  | @ -264,7 +264,7 @@ static int seac_dive(void *param, int, char **data, char **) | |||
|  * The callback function performs another SQL query on the other | ||||
|  * table, to read in the sample values. | ||||
|  */ | ||||
| extern "C" int parse_seac_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_seac_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	char *err = NULL; | ||||
|  |  | |||
|  | @ -473,7 +473,7 @@ static int shearwater_cloud_dive(void *param, int, char **data, char **) | |||
| 	return SQLITE_OK; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_shearwater_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	struct parser_state state; | ||||
|  | @ -496,7 +496,7 @@ extern "C" int parse_shearwater_buffer(sqlite3 *handle, const char *url, const c | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	struct parser_state state; | ||||
|  |  | |||
|  | @ -277,7 +277,7 @@ static int dm4_dive(void *param, int, char **data, char **) | |||
| 	return SQLITE_OK; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_dm4_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	char *err = NULL; | ||||
|  | @ -549,7 +549,7 @@ static int dm5_dive(void *param, int, char **data, char **) | |||
| 	return SQLITE_OK; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| int parse_dm5_buffer(sqlite3 *handle, const char *url, const char *, int, struct divelog *log) | ||||
| { | ||||
| 	int retval; | ||||
| 	char *err = NULL; | ||||
|  |  | |||
|  | @ -32,8 +32,6 @@ static std::string make_default_filename() | |||
| 	return system_default_path() + "/subsurface.xml"; | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| const char mac_system_divelist_default_font[] = "Arial"; | ||||
| const char *system_divelist_default_font = mac_system_divelist_default_font; | ||||
| double system_divelist_default_font_size = -1.0; | ||||
|  | @ -123,4 +121,3 @@ bool subsurface_user_is_root() | |||
| { | ||||
| 	return false; | ||||
| } | ||||
| } | ||||
|  |  | |||
|  | @ -21,8 +21,6 @@ | |||
| #define dc_usb_storage_open(stream, context, devname) (DC_STATUS_UNSUPPORTED) | ||||
| #endif | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| struct divelog; | ||||
| struct devices; | ||||
|  | @ -73,6 +71,4 @@ unsigned int get_supported_transports(device_data_t *data); | |||
| extern std::string logfile_name; | ||||
| extern std::string dumpfile_name; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // LIBDIVECOMPUTER_H
 | ||||
|  |  | |||
|  | @ -1850,12 +1850,12 @@ static int load_dives_from_tree(git_repository *repo, git_tree *tree, struct git | |||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" void clear_git_id(void) | ||||
| void clear_git_id(void) | ||||
| { | ||||
| 	saved_git_id.clear(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void set_git_id(const struct git_oid *id) | ||||
| void set_git_id(const struct git_oid *id) | ||||
| { | ||||
| 	char git_id_buffer[GIT_OID_HEXSZ + 1]; | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,8 +48,6 @@ static std::string make_default_filename() | |||
| 	return system_default_path() + "/" + user + ".xml"; | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| const char mac_system_divelist_default_font[] = "Arial"; | ||||
| const char *system_divelist_default_font = mac_system_divelist_default_font; | ||||
| double system_divelist_default_font_size = -1.0; | ||||
|  | @ -199,5 +197,3 @@ bool subsurface_user_is_root() | |||
| { | ||||
| 	return geteuid() == 0; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -52,8 +52,6 @@ struct membufferpp : public membuffer { | |||
| 	~membufferpp(); | ||||
| }; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #ifdef __GNUC__ | ||||
| #define __printf(x, y) __attribute__((__format__(__printf__, x, y))) | ||||
| #else | ||||
|  | @ -113,6 +111,4 @@ extern void put_salinity(struct membuffer *, int, const char *, const char *); | |||
| extern void put_degrees(struct membuffer *b, degrees_t value, const char *, const char *); | ||||
| extern void put_location(struct membuffer *b, const location_t *, const char *, const char *); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -528,7 +528,7 @@ static bool parseASF(QFile &f, metadata *metadata) | |||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| extern "C" mediatype_t get_metadata(const char *filename_in, metadata *data) | ||||
| mediatype_t get_metadata(const char *filename_in, metadata *data) | ||||
| { | ||||
| 	data->timestamp = 0; | ||||
| 	data->duration.seconds = 0; | ||||
|  | @ -561,7 +561,7 @@ extern "C" mediatype_t get_metadata(const char *filename_in, metadata *data) | |||
| 	return res; | ||||
| } | ||||
| 
 | ||||
| extern "C" timestamp_t picture_get_timestamp(const char *filename) | ||||
| timestamp_t picture_get_timestamp(const char *filename) | ||||
| { | ||||
| 	struct metadata data; | ||||
| 	get_metadata(filename, &data); | ||||
|  |  | |||
|  | @ -17,11 +17,7 @@ enum mediatype_t { | |||
| 	MEDIATYPE_STILL_LOADING,	// Still processing in the background
 | ||||
| }; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| enum mediatype_t get_metadata(const char *filename, struct metadata *data); | ||||
| timestamp_t picture_get_timestamp(const char *filename); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // METADATA_H
 | ||||
|  |  | |||
|  | @ -42,7 +42,7 @@ static int ostc_prepare_data(int data_model, dc_family_t dc_fam, device_data_t & | |||
|  * each file. So it's not necessary to iterate once and again on a parsing | ||||
|  * function. Actually there's only one kind of archive for every DC model. | ||||
|  */ | ||||
| extern "C" void ostctools_import(const char *file, struct divelog *log) | ||||
| void ostctools_import(const char *file, struct divelog *log) | ||||
| { | ||||
| 	FILE *archive; | ||||
| 	device_data_t devdata; | ||||
|  |  | |||
|  | @ -14,8 +14,8 @@ struct dive_trip; | |||
| struct dive_site; | ||||
| struct event; | ||||
| 
 | ||||
| extern "C" void free_dive(struct dive *); | ||||
| extern "C" void free_trip(struct dive_trip *); | ||||
| void free_dive(struct dive *); | ||||
| void free_trip(struct dive_trip *); | ||||
| 
 | ||||
| // Classes used to automatically call the appropriate free_*() function for owning pointers that go out of scope.
 | ||||
| struct DiveDeleter { | ||||
|  |  | |||
|  | @ -1186,7 +1186,7 @@ static void gps_long(const char *buffer, struct dive *dive, struct parser_state | |||
| } | ||||
| 
 | ||||
| /* We allow either spaces or a comma between the decimal degrees */ | ||||
| extern "C" void parse_location(const char *buffer, location_t *loc) | ||||
| void parse_location(const char *buffer, location_t *loc) | ||||
| { | ||||
| 	const char *end; | ||||
| 	loc->lat = parse_degrees(buffer, &end); | ||||
|  | @ -1752,7 +1752,7 @@ static const char *preprocess_divelog_de(const char *buffer) | |||
| 	return buffer; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_xml_buffer(const char *url, const char *buffer, int, struct divelog *log, | ||||
| int parse_xml_buffer(const char *url, const char *buffer, int, struct divelog *log, | ||||
| 				const struct xml_params *params) | ||||
| { | ||||
| 	xmlDoc *doc; | ||||
|  | @ -1802,7 +1802,7 @@ static timestamp_t parse_dlf_timestamp(unsigned char *buffer) | |||
| 	return offset + 946684800; | ||||
| } | ||||
| 
 | ||||
| extern "C" int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divelog *log) | ||||
| int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divelog *log) | ||||
| { | ||||
| 	using namespace std::string_literals; | ||||
| 	unsigned char *ptr = buffer; | ||||
|  | @ -2274,12 +2274,12 @@ extern "C" int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divel | |||
| } | ||||
| 
 | ||||
| 
 | ||||
| extern "C" void parse_xml_init(void) | ||||
| void parse_xml_init(void) | ||||
| { | ||||
| 	LIBXML_TEST_VERSION | ||||
| } | ||||
| 
 | ||||
| extern "C" void parse_xml_exit(void) | ||||
| void parse_xml_exit(void) | ||||
| { | ||||
| 	xmlCleanupParser(); | ||||
| } | ||||
|  |  | |||
|  | @ -42,19 +42,19 @@ struct divecomputer *get_dc(struct parser_state *state) | |||
| /*
 | ||||
|  * Add a dive into the dive_table array | ||||
|  */ | ||||
| extern "C" void record_dive_to_table(struct dive *dive, struct dive_table *table) | ||||
| void record_dive_to_table(struct dive *dive, struct dive_table *table) | ||||
| { | ||||
| 	add_to_dive_table(table, table->nr, fixup_dive(dive)); | ||||
| } | ||||
| 
 | ||||
| extern "C" void start_match(const char *type, const char *name, char *buffer) | ||||
| void start_match(const char *type, const char *name, char *buffer) | ||||
| { | ||||
| 	if (verbose > 2) | ||||
| 		printf("Matching %s '%s' (%s)\n", | ||||
| 		       type, name, buffer); | ||||
| } | ||||
| 
 | ||||
| extern "C" void nonmatch(const char *type, const char *name, char *buffer) | ||||
| void nonmatch(const char *type, const char *name, char *buffer) | ||||
| { | ||||
| 	if (verbose > 1) | ||||
| 		printf("Unable to match %s '%s' (%s)\n", | ||||
|  | @ -431,7 +431,7 @@ void userid_stop(struct parser_state *state) | |||
|  * therefore make sure to only pass in to NULL-initialized pointers or pointers | ||||
|  * to owned strings | ||||
|  */ | ||||
| extern "C" void utf8_string(const char *buffer, char **res) | ||||
| void utf8_string(const char *buffer, char **res) | ||||
| { | ||||
| 	free(*res); | ||||
| 	while (isspace(*buffer)) | ||||
|  | @ -510,7 +510,7 @@ void add_dive_site(const char *ds_name, struct dive *dive, struct parser_state * | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" int atoi_n(char *ptr, unsigned int len) | ||||
| int atoi_n(char *ptr, unsigned int len) | ||||
| { | ||||
| 	if (len < 10) { | ||||
| 		char buf[10]; | ||||
|  |  | |||
|  | @ -142,8 +142,6 @@ void utf8_string_std(const char *buffer, std::string *res); | |||
| 
 | ||||
| void add_dive_site(const char *ds_name, struct dive *dive, struct parser_state *state); | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| int trimspace(char *buffer); | ||||
| void start_match(const char *type, const char *name, char *buffer); | ||||
| void nonmatch(const char *type, const char *name, char *buffer); | ||||
|  | @ -161,7 +159,6 @@ int parse_shearwater_cloud_buffer(sqlite3 *handle, const char *url, const char * | |||
| int parse_cobalt_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct divelog *log); | ||||
| int parse_divinglog_buffer(sqlite3 *handle, const char *url, const char *buf, int size, struct divelog *log); | ||||
| int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divelog *log); | ||||
| } | ||||
| std::string trimspace(const char *buffer); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -6,8 +6,6 @@ | |||
| #include "units.h" | ||||
| #include <stddef.h> // For NULL | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| 
 | ||||
| struct picture { | ||||
|  | @ -46,6 +44,4 @@ extern void sort_picture_table(struct picture_table *); | |||
| extern struct picture *create_picture(const char *filename, timestamp_t shift_time, bool match_all, struct dive **dive); | ||||
| extern bool picture_check_valid_time(timestamp_t timestamp, timestamp_t shift_time); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // PICTURE_H
 | ||||
|  |  | |||
|  | @ -42,7 +42,7 @@ static int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 1828 | |||
| 					325120, 345440, 365760, 386080 }; | ||||
| 
 | ||||
| #if DEBUG_PLAN | ||||
| extern "C" void dump_plan(struct diveplan *diveplan) | ||||
| void dump_plan(struct diveplan *diveplan) | ||||
| { | ||||
| 	struct divedatapoint *dp; | ||||
| 	struct tm tm; | ||||
|  | @ -65,7 +65,7 @@ extern "C" void dump_plan(struct diveplan *diveplan) | |||
| } | ||||
| #endif | ||||
| 
 | ||||
| extern "C" bool diveplan_empty(struct diveplan *diveplan) | ||||
| bool diveplan_empty(struct diveplan *diveplan) | ||||
| { | ||||
| 	struct divedatapoint *dp; | ||||
| 	if (!diveplan || !diveplan->dp) | ||||
|  | @ -80,7 +80,7 @@ extern "C" bool diveplan_empty(struct diveplan *diveplan) | |||
| } | ||||
| 
 | ||||
| /* get the cylinder index at a certain time during the dive */ | ||||
| extern "C" int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time) | ||||
| int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time) | ||||
| { | ||||
| 	// we start with the first cylinder unless an event tells us otherwise
 | ||||
| 	int cylinder_idx = 0; | ||||
|  | @ -323,7 +323,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, | |||
| 	return; | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_dps(struct diveplan *diveplan) | ||||
| void free_dps(struct diveplan *diveplan) | ||||
| { | ||||
| 	if (!diveplan) | ||||
| 		return; | ||||
|  | @ -367,7 +367,7 @@ static void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoi | |||
| 		dp->time += lasttime; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode) | ||||
| struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode) | ||||
| { | ||||
| 	struct divedatapoint *dp = create_dp(duration, depth, cylinderid, divemode == CCR ? po2 : 0); | ||||
| 	dp->entered = entered; | ||||
|  | @ -501,7 +501,7 @@ static std::vector<int> sort_stops(int dstops[], size_t dnr, std::vector<gaschan | |||
| 	return stoplevels; | ||||
| } | ||||
| 
 | ||||
| extern "C" int ascent_velocity(int depth, int avg_depth, int) | ||||
| int ascent_velocity(int depth, int avg_depth, int) | ||||
| { | ||||
| 	/* We need to make this configurable */ | ||||
| 
 | ||||
|  | @ -1166,7 +1166,7 @@ static int get_permille(const char *begin, const char **end) | |||
| 	return value; | ||||
| } | ||||
| 
 | ||||
| extern "C" int validate_gas(const char *text, struct gasmix *gas) | ||||
| int validate_gas(const char *text, struct gasmix *gas) | ||||
| { | ||||
| 	int o2, he; | ||||
| 
 | ||||
|  | @ -1213,7 +1213,7 @@ extern "C" int validate_gas(const char *text, struct gasmix *gas) | |||
| 	return 1; | ||||
| } | ||||
| 
 | ||||
| extern "C" int validate_po2(const char *text, int *mbar_po2) | ||||
| int validate_po2(const char *text, int *mbar_po2) | ||||
| { | ||||
| 	int po2; | ||||
| 
 | ||||
|  |  | |||
|  | @ -34,8 +34,6 @@ struct diveplan { | |||
| 
 | ||||
| struct deco_state_cache; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern int validate_gas(const char *text, struct gasmix *gas); | ||||
| extern int validate_po2(const char *text, int *mbar_po2); | ||||
| extern int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time); | ||||
|  | @ -54,8 +52,6 @@ struct decostop { | |||
| 	int time; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| extern std::string get_planner_disclaimer_formatted(); | ||||
| extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int dcNr, int timestep, struct decostop *decostoptable, deco_state_cache &cache, bool is_planner, bool show_disclaimer); | ||||
| #endif // PLANNER_H
 | ||||
|  |  | |||
|  | @ -77,7 +77,7 @@ static std::string icd_entry(struct icd_data *icdvalues, bool printheader, int t | |||
| 	return b; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *get_planner_disclaimer() | ||||
| const char *get_planner_disclaimer() | ||||
| { | ||||
| 	return translate("gettextFromC", "DISCLAIMER / WARNING: THIS IMPLEMENTATION OF THE %s " | ||||
| 			 "ALGORITHM AND A DIVE PLANNER IMPLEMENTATION BASED ON THAT HAS " | ||||
|  | @ -93,7 +93,7 @@ extern std::string get_planner_disclaimer_formatted() | |||
| 	return format_string_std(get_planner_disclaimer(), deco); | ||||
| } | ||||
| 
 | ||||
| extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, bool error) | ||||
| void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, bool error) | ||||
| { | ||||
| 	std::string buf; | ||||
| 	std::string icdbuf; | ||||
|  |  | |||
|  | @ -124,7 +124,7 @@ struct preferences default_prefs = { | |||
| }; | ||||
| 
 | ||||
| /* copy a preferences block, including making copies of all included strings */ | ||||
| extern "C" void copy_prefs(struct preferences *src, struct preferences *dest) | ||||
| void copy_prefs(struct preferences *src, struct preferences *dest) | ||||
| { | ||||
| 	*dest = *src; | ||||
| 	dest->divelist_font = copy_string(src->divelist_font); | ||||
|  | @ -149,7 +149,7 @@ extern "C" void copy_prefs(struct preferences *src, struct preferences *dest) | |||
|  * These are not real leaks but they plug the holes found by eg. | ||||
|  * valgrind so you can find the real leaks. | ||||
|  */ | ||||
| extern "C" void free_prefs(void) | ||||
| void free_prefs(void) | ||||
| { | ||||
| 	// nop
 | ||||
| } | ||||
|  |  | |||
|  | @ -5,8 +5,6 @@ | |||
| #include "units.h" | ||||
| #include "taxonomy.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| typedef struct | ||||
| { | ||||
| 	bool po2; | ||||
|  | @ -224,6 +222,4 @@ extern void copy_prefs(struct preferences *src, struct preferences *dest); | |||
| 
 | ||||
| extern void set_informational_units(const char *units); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // PREF_H
 | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ | |||
| 
 | ||||
| #define MAX_PROFILE_DECO 7200 | ||||
| 
 | ||||
| extern "C" int ascent_velocity(int depth, int avg_depth, int bottom_time); | ||||
| int ascent_velocity(int depth, int avg_depth, int bottom_time); | ||||
| 
 | ||||
| #ifdef DEBUG_PI | ||||
| /* debugging tool - not normally used */ | ||||
|  |  | |||
|  | @ -56,8 +56,6 @@ static std::string to_str(const T &v) | |||
| 	return v.toString().toStdString(); | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| void BLEObject::serviceStateChanged(QLowEnergyService::ServiceState newState) | ||||
| { | ||||
| 	if (verbose > 2 || debugCounter < DEBUG_THRESHOLD) | ||||
|  | @ -777,5 +775,3 @@ dc_status_t qt_ble_ioctl(void *io, unsigned int request, void *data, size_t size | |||
| 		return DC_STATUS_UNSUPPORTED; | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| } /* extern "C" */ | ||||
|  |  | |||
|  | @ -67,8 +67,6 @@ private: | |||
| 	}; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| extern "C" { | ||||
| dc_status_t qt_ble_open(void **io, dc_context_t *context, const char *devaddr, device_data_t *user_device); | ||||
| dc_status_t qt_ble_set_timeout(void *io, int timeout); | ||||
| dc_status_t qt_ble_poll(void *io, int timeout); | ||||
|  | @ -76,6 +74,5 @@ dc_status_t qt_ble_read(void *io, void* data, size_t size, size_t *actual); | |||
| dc_status_t qt_ble_write(void *io, const void* data, size_t size, size_t *actual); | ||||
| dc_status_t qt_ble_ioctl(void *io, unsigned int request, void *data, size_t size); | ||||
| dc_status_t qt_ble_close(void *io); | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -310,7 +310,7 @@ static xmlDocPtr get_stylesheet_doc(const xmlChar *uri, xmlDictPtr, int, void *, | |||
| 	return doc; | ||||
| } | ||||
| 
 | ||||
| extern "C" xsltStylesheetPtr get_stylesheet(const char *name) | ||||
| xsltStylesheetPtr get_stylesheet(const char *name) | ||||
| { | ||||
| 	// this needs to be done only once, but doesn't hurt to run every time
 | ||||
| 	xsltSetLoaderFunc(get_stylesheet_doc); | ||||
|  | @ -363,7 +363,7 @@ std::string get_file_name(const char *fileName) | |||
| 	return fileInfo.fileName().toStdString(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName) | ||||
| void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName) | ||||
| { | ||||
| 	QString fileName(cfileName); | ||||
| 	QString newName(path); | ||||
|  | @ -999,7 +999,7 @@ QString get_dive_date_string(timestamp_t when) | |||
| } | ||||
| 
 | ||||
| // Get local seconds since Epoch from ISO formatted UTC date time + offset string
 | ||||
| extern "C" time_t get_dive_datetime_from_isostring(char *when) { | ||||
| time_t get_dive_datetime_from_isostring(char *when) { | ||||
| 	QDateTime divetime = QDateTime::fromString(when, Qt::ISODate); | ||||
| 	return (time_t)(divetime.toSecsSinceEpoch()); | ||||
| } | ||||
|  | @ -1068,7 +1068,7 @@ QString thumbnailFileName(const QString &filename) | |||
| 	return thumbnailDir() + hash.result().toHex(); | ||||
| } | ||||
| 
 | ||||
| extern "C" char *hashfile_name_string() | ||||
| char *hashfile_name_string() | ||||
| { | ||||
| 	return copy_qstring(hashfile_name()); | ||||
| } | ||||
|  | @ -1199,7 +1199,7 @@ QStringList videoExtensionFilters() | |||
| 	return filters; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *local_file_path(struct picture *picture) | ||||
| const char *local_file_path(struct picture *picture) | ||||
| { | ||||
| 	return copy_qstring(localFilePath(picture->filename)); | ||||
| } | ||||
|  | @ -1386,14 +1386,14 @@ std::optional<std::string> getCloudURL() | |||
| 	return filename; | ||||
| } | ||||
| 
 | ||||
| extern "C" void subsurface_mkdir(const char *dir) | ||||
| void subsurface_mkdir(const char *dir) | ||||
| { | ||||
| 	QDir directory; | ||||
| 	if (!directory.mkpath(QString(dir))) | ||||
| 		report_info("failed to create path %s", dir); | ||||
| } | ||||
| 
 | ||||
| extern "C" enum deco_mode decoMode(bool in_planner) | ||||
| enum deco_mode decoMode(bool in_planner) | ||||
| { | ||||
| 	return in_planner ? prefs.planner_deco_mode : prefs.display_deco_mode; | ||||
| } | ||||
|  | @ -1553,19 +1553,19 @@ void parse_seabear_header(const char *filename, struct xml_params *params) | |||
| 	f.close(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void print_qt_versions() | ||||
| void print_qt_versions() | ||||
| { | ||||
| 	printf("%s\n", qPrintable(QStringLiteral("built with Qt Version %1, runtime from Qt Version %2").arg(QT_VERSION_STR).arg(qVersion()))); | ||||
| } | ||||
| 
 | ||||
| QMutex planLock; | ||||
| 
 | ||||
| extern "C" void lock_planner() | ||||
| void lock_planner() | ||||
| { | ||||
| 	planLock.lock(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void unlock_planner() | ||||
| void unlock_planner() | ||||
| { | ||||
| 	planLock.unlock(); | ||||
| } | ||||
|  | @ -1626,7 +1626,7 @@ std::vector<int> get_cylinder_map_for_add(int count, int n) | |||
| 	return mapping; | ||||
| } | ||||
| 
 | ||||
| extern "C" void emit_reset_signal() | ||||
| void emit_reset_signal() | ||||
| { | ||||
| 	emit diveListNotifier.dataReset(); | ||||
| } | ||||
|  |  | |||
|  | @ -2,27 +2,23 @@ | |||
| #ifndef QTHELPER_H | ||||
| #define QTHELPER_H | ||||
| 
 | ||||
| #include "core/pref.h" | ||||
| #include "core/gettextfromc.h" | ||||
| #include "subsurface-time.h" | ||||
| #include <QString> | ||||
| #include <optional> | ||||
| #include <string> | ||||
| #include <libxslt/transform.h> | ||||
| #include <libxslt/xsltutils.h> | ||||
| #include "core/pref.h" | ||||
| #include "subsurface-time.h" | ||||
| 
 | ||||
| struct picture; | ||||
| struct dive_trip; | ||||
| struct xml_params; | ||||
| 
 | ||||
| // 1) Types
 | ||||
| struct git_info; | ||||
| class QImage; | ||||
| 
 | ||||
| enum watertypes {FRESHWATER, BRACKISHWATER, EN13319WATER, SALTWATER, DC_WATERTYPE}; | ||||
| 
 | ||||
| // 2) Functions visible only to C++ parts
 | ||||
| 
 | ||||
| #include <QString> | ||||
| #include <optional> | ||||
| #include <string> | ||||
| #include "core/gettextfromc.h" | ||||
| class QImage; | ||||
| 
 | ||||
| #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) | ||||
| #define SKIP_EMPTY Qt::SkipEmptyParts | ||||
| #else | ||||
|  | @ -111,12 +107,6 @@ std::string move_away(const std::string &path); | |||
| #define TITLE_OR_TEXT(_t, _m) _t, _m | ||||
| #endif | ||||
| 
 | ||||
| // 3) Functions visible to C and C++
 | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct git_info; | ||||
| 
 | ||||
| bool canReachCloudServer(struct git_info *); | ||||
| void updateWindowTitle(); | ||||
| void subsurface_mkdir(const char *dir); | ||||
|  | @ -137,6 +127,4 @@ volume_t string_to_volume(const char *str, pressure_t workp); | |||
| fraction_t string_to_fraction(const char *str); | ||||
| void emit_reset_signal(); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif // QTHELPER_H
 | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ static std::string to_str(const T &v) | |||
| 	return v.toString().toStdString(); | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| typedef struct qt_serial_t { | ||||
| 	/*
 | ||||
| 	 * RFCOMM socket used for Bluetooth Serial communication. | ||||
|  | @ -347,5 +346,3 @@ rfcomm_stream_open(dc_iostream_t **iostream, dc_context_t *context, const char* | |||
| 
 | ||||
| 	return dc_custom_open (iostream, context, DC_TRANSPORT_BLUETOOTH, &callbacks, io); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ sample::sample() : | |||
|  * from the previous sample, so the indices are pre-populated (but the | ||||
|  * pressures obviously are not) | ||||
|  */ | ||||
| extern "C" void add_sample_pressure(struct sample *sample, int sensor, int mbar) | ||||
| void add_sample_pressure(struct sample *sample, int sensor, int mbar) | ||||
| { | ||||
| 	int idx; | ||||
| 
 | ||||
|  |  | |||
|  | @ -4,8 +4,6 @@ | |||
| 
 | ||||
| #include "units.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #define MAX_SENSORS 2 | ||||
| #define MAX_O2_SENSORS 6 | ||||
| #define NO_SENSOR -1 | ||||
|  | @ -36,6 +34,4 @@ struct sample                         // BASE TYPE BYTES  UNITS    RANGE | |||
| 
 | ||||
| extern void add_sample_pressure(struct sample *sample, int sensor, int mbar); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1105,7 +1105,7 @@ static git_tree *get_git_tree(git_repository *repo, git_object *parent) | |||
| 	return tree; | ||||
| } | ||||
| 
 | ||||
| extern "C" int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree) | ||||
| int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree) | ||||
| { | ||||
| 	git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT; | ||||
| 
 | ||||
|  | @ -1116,7 +1116,7 @@ extern "C" int update_git_checkout(git_repository *repo, git_object *parent, git | |||
| 	return git_checkout_tree(repo, (git_object *) tree, &opts); | ||||
| } | ||||
| 
 | ||||
| extern "C" int get_authorship(git_repository *repo, git_signature **authorp) | ||||
| int get_authorship(git_repository *repo, git_signature **authorp) | ||||
| { | ||||
| 	if (git_signature_default(authorp, repo) == 0) | ||||
| 		return 0; | ||||
|  |  | |||
|  | @ -4,8 +4,6 @@ | |||
| 
 | ||||
| #include "membuffer.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| struct dive; | ||||
| 
 | ||||
| void put_HTML_date(struct membuffer *b, struct dive *dive, const char *pre, const char *post); | ||||
|  | @ -21,9 +19,6 @@ void put_HTML_volume_units(struct membuffer *b, unsigned int ml, const char *pre | |||
| 
 | ||||
| void export_HTML(const char *file_name, const char *photos_dir, const bool selected_only, const bool list_only); | ||||
| void export_list(struct membuffer *b, const char *photos_dir, bool selected_only, const bool list_only); | ||||
| 
 | ||||
| void export_translation(const char *file_name); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -2,10 +2,7 @@ | |||
| #ifndef SAVE_PROFILE_DATA_H | ||||
| #define SAVE_PROFILE_DATA_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| int save_profiledata(const char *filename, bool selected_only); | ||||
| void save_subtitles_buffer(struct membuffer *b, struct dive *dive, int offset, int length); | ||||
| 
 | ||||
| } | ||||
| #endif // SAVE_PROFILE_DATA_H
 | ||||
|  |  | |||
|  | @ -497,7 +497,7 @@ static void save_picture(struct membuffer *b, struct picture *pic) | |||
| 	put_string(b, "/>\n"); | ||||
| } | ||||
| 
 | ||||
| extern "C" void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize) | ||||
| void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool anonymize) | ||||
| { | ||||
| 	struct divecomputer *dc; | ||||
| 	pressure_t surface_pressure = un_fixup_surface_pressure(dive); | ||||
|  | @ -556,7 +556,7 @@ extern "C" void save_one_dive_to_mb(struct membuffer *b, struct dive *dive, bool | |||
| 	put_format(b, "</dive>\n"); | ||||
| } | ||||
| 
 | ||||
| extern "C" int save_dive(FILE *f, struct dive *dive, bool anonymize) | ||||
| int save_dive(FILE *f, struct dive *dive, bool anonymize) | ||||
| { | ||||
| 	struct membufferpp buf; | ||||
| 
 | ||||
|  | @ -627,7 +627,7 @@ static void save_one_fingerprint(struct membuffer *b, int i) | |||
| 		   fp_get_data(&fingerprint_table, i).c_str()); | ||||
| } | ||||
| 
 | ||||
| extern "C" int save_dives(const char *filename) | ||||
| int save_dives(const char *filename) | ||||
| { | ||||
| 	return save_dives_logic(filename, false, false); | ||||
| } | ||||
|  | @ -810,7 +810,7 @@ static void try_to_backup(const char *filename) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" int save_dives_logic(const char *filename, const bool select_only, bool anonymize) | ||||
| int save_dives_logic(const char *filename, const bool select_only, bool anonymize) | ||||
| { | ||||
| 	struct membufferpp buf; | ||||
| 	struct git_info info; | ||||
|  | @ -931,7 +931,7 @@ static void save_dive_sites_buffer(struct membuffer *b, const struct dive_site * | |||
| 	put_format(b, "</divesites>\n"); | ||||
| } | ||||
| 
 | ||||
| extern "C" int save_dive_sites_logic(const char *filename, const struct dive_site *sites[], int nr_sites, bool anonymize) | ||||
| int save_dive_sites_logic(const char *filename, const struct dive_site *sites[], int nr_sites, bool anonymize) | ||||
| { | ||||
| 	struct membufferpp buf; | ||||
| 	FILE *f; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ struct dive *current_dive = NULL; | |||
| int amount_selected; | ||||
| static int amount_trips_selected; | ||||
| 
 | ||||
| extern "C" struct dive *first_selected_dive() | ||||
| struct dive *first_selected_dive() | ||||
| { | ||||
| 	int idx; | ||||
| 	struct dive *d; | ||||
|  | @ -26,7 +26,7 @@ extern "C" struct dive *first_selected_dive() | |||
| 	return NULL; | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive *last_selected_dive() | ||||
| struct dive *last_selected_dive() | ||||
| { | ||||
| 	int idx; | ||||
| 	struct dive *d, *ret = NULL; | ||||
|  | @ -38,7 +38,7 @@ extern "C" struct dive *last_selected_dive() | |||
| 	return ret; | ||||
| } | ||||
| 
 | ||||
| extern "C" bool consecutive_selected() | ||||
| bool consecutive_selected() | ||||
| { | ||||
| 	struct dive *d; | ||||
| 	int i; | ||||
|  | @ -63,7 +63,7 @@ extern "C" bool consecutive_selected() | |||
| } | ||||
| 
 | ||||
| #if DEBUG_SELECTION_TRACKING | ||||
| extern "C" void dump_selection(void) | ||||
| void dump_selection(void) | ||||
| { | ||||
| 	int i; | ||||
| 	struct dive *dive; | ||||
|  | @ -232,7 +232,7 @@ void setTripSelection(dive_trip *trip, dive *currentDive) | |||
| 	emit diveListNotifier.tripSelected(trip, currentDive); | ||||
| } | ||||
| 
 | ||||
| extern "C" void select_single_dive(dive *d) | ||||
| void select_single_dive(dive *d) | ||||
| { | ||||
| 	if (d) | ||||
| 		setSelection(std::vector<dive *>{ d }, d, -1); | ||||
|  | @ -283,7 +283,7 @@ void updateSelection(std::vector<dive *> &selection, const std::vector<dive *> & | |||
| } | ||||
| 
 | ||||
| // Select the first dive that is visible
 | ||||
| extern "C" void select_newest_visible_dive() | ||||
| void select_newest_visible_dive() | ||||
| { | ||||
| 	for (int i = divelog.dives->nr - 1; i >= 0; --i) { | ||||
| 		dive *d = divelog.dives->dives[i]; | ||||
|  | @ -295,7 +295,7 @@ extern "C" void select_newest_visible_dive() | |||
| 	select_single_dive(nullptr); | ||||
| } | ||||
| 
 | ||||
| extern "C" void select_trip(struct dive_trip *trip) | ||||
| void select_trip(struct dive_trip *trip) | ||||
| { | ||||
| 	if (trip && !trip->selected) { | ||||
| 		trip->selected = true; | ||||
|  | @ -303,7 +303,7 @@ extern "C" void select_trip(struct dive_trip *trip) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" void deselect_trip(struct dive_trip *trip) | ||||
| void deselect_trip(struct dive_trip *trip) | ||||
| { | ||||
| 	if (trip && trip->selected) { | ||||
| 		trip->selected = false; | ||||
|  | @ -311,7 +311,7 @@ extern "C" void deselect_trip(struct dive_trip *trip) | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| extern "C" struct dive_trip *single_selected_trip() | ||||
| struct dive_trip *single_selected_trip() | ||||
| { | ||||
| 	if (amount_trips_selected != 1) | ||||
| 		return NULL; | ||||
|  |  | |||
|  | @ -4,15 +4,14 @@ | |||
| #ifndef SELECTION_H | ||||
| #define SELECTION_H | ||||
| 
 | ||||
| #include <vector> | ||||
| #include <QVector> | ||||
| 
 | ||||
| struct dive; | ||||
| 
 | ||||
| extern int amount_selected; | ||||
| extern struct dive *current_dive; | ||||
| 
 | ||||
| /*** C and C++ functions ***/ | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern struct dive *first_selected_dive(void); | ||||
| extern struct dive *last_selected_dive(void); | ||||
| extern bool consecutive_selected(void); | ||||
|  | @ -27,13 +26,6 @@ extern void clear_selection(void); | |||
| extern void dump_selection(void); | ||||
| #endif | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /*** C++-only functions ***/ | ||||
| 
 | ||||
| #include <vector> | ||||
| #include <QVector> | ||||
| 
 | ||||
| // Reset the selection to the dives of the "selection" vector and send the appropriate signals.
 | ||||
| // Set the current dive to "currentDive" and the current dive computer to "currentDc".
 | ||||
| // "currentDive" must be an element of "selection" (or null if "seletion" is empty).
 | ||||
|  |  | |||
|  | @ -2,15 +2,11 @@ | |||
| #ifndef SSRF_H | ||||
| #define SSRF_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #ifdef __clang__ | ||||
| // Clang has a bug on zero-initialization of C structs.
 | ||||
| #pragma clang diagnostic ignored "-Wmissing-field-initializers" | ||||
| #endif | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // Macro to be used for silencing unused parameters
 | ||||
| #define UNUSED(x) (void)x | ||||
| 
 | ||||
|  |  | |||
|  | @ -109,12 +109,12 @@ no_conversion: | |||
| 	return 0.0; | ||||
| } | ||||
| 
 | ||||
| extern "C" double permissive_strtod(const char *str, const char **ptr) | ||||
| double permissive_strtod(const char *str, const char **ptr) | ||||
| { | ||||
| 	return strtod_flags(str, ptr, false); | ||||
| } | ||||
| 
 | ||||
| extern "C" double ascii_strtod(const char *str, const char **ptr) | ||||
| double ascii_strtod(const char *str, const char **ptr) | ||||
| { | ||||
| 	return strtod_flags(str, ptr, true); | ||||
| } | ||||
|  |  | |||
|  | @ -9,8 +9,6 @@ | |||
| #include <string_view> | ||||
| #include <vector> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| // string handling
 | ||||
| 
 | ||||
| static inline bool same_string(const char *a, const char *b) | ||||
|  | @ -36,8 +34,6 @@ static inline char *copy_string(const char *s) | |||
| extern double permissive_strtod(const char *str, const char **ptr); | ||||
| extern double ascii_strtod(const char *str, const char **ptr); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // Sadly, starts_with only with C++20!
 | ||||
| inline bool starts_with(std::string_view s, const char *s2) | ||||
| { | ||||
|  |  | |||
|  | @ -6,8 +6,6 @@ | |||
| #include <string> | ||||
| #include <time.h> | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern timestamp_t utc_mktime(const struct tm *tm); | ||||
| extern void utc_mkdate(timestamp_t, struct tm *tm); | ||||
| extern int utc_year(timestamp_t timestamp); | ||||
|  | @ -15,11 +13,8 @@ extern int utc_weekday(timestamp_t timestamp); | |||
| 
 | ||||
| /* parse and format date times of the form YYYY-MM-DD hh:mm:ss */ | ||||
| extern timestamp_t parse_datetime(const char *s); /* returns 0 on error */ | ||||
| 
 | ||||
| extern const char *monthname(int mon); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| std::string format_datetime(timestamp_t timestamp); /* ownership of string passed to caller */ | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ std::string testqml; | |||
|  */ | ||||
| bool imported = false; | ||||
| 
 | ||||
| extern "C" void print_version() | ||||
| void print_version() | ||||
| { | ||||
| 	static bool version_printed = false; | ||||
| 	if (version_printed) | ||||
|  | @ -43,7 +43,7 @@ extern "C" void print_version() | |||
| 	version_printed = true; | ||||
| } | ||||
| 
 | ||||
| extern "C" void print_files() | ||||
| void print_files() | ||||
| { | ||||
| 	struct git_info info; | ||||
| 	std::optional<std::string> filename; | ||||
|  | @ -89,7 +89,7 @@ static void print_help() | |||
| 	printf("\n --cloud-timeout=<nr>  Set timeout for cloud connection (0 < timeout < 60)\n\n"); | ||||
| } | ||||
| 
 | ||||
| extern "C" void parse_argument(const char *arg) | ||||
| void parse_argument(const char *arg) | ||||
| { | ||||
| 	const char *p = arg + 1; | ||||
| 
 | ||||
|  | @ -191,7 +191,7 @@ extern "C" void parse_argument(const char *arg) | |||
|  * I guess Burma and Liberia should trigger this too. I'm too | ||||
|  * lazy to look up the territory names, though. | ||||
|  */ | ||||
| extern "C" void setup_system_prefs(void) | ||||
| void setup_system_prefs(void) | ||||
| { | ||||
| 	const char *env; | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ | |||
| #ifndef SUBSURFACESTARTUP_H | ||||
| #define SUBSURFACESTARTUP_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern bool imported; | ||||
| extern int quit, force_root, ignore_bt; | ||||
| 
 | ||||
|  | @ -15,8 +13,6 @@ void print_version(void); | |||
| 
 | ||||
| extern char *settings_suffix; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #ifdef SUBSURFACE_MOBILE_DESKTOP | ||||
| #include <string> | ||||
| extern std::string testqml; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| #include <QSysInfo> | ||||
| 
 | ||||
| #ifdef Q_OS_WIN | ||||
| extern "C" bool isWin7Or8() | ||||
| bool isWin7Or8() | ||||
| { | ||||
| 	return (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) >= QSysInfo::WV_WINDOWS7; | ||||
| } | ||||
|  |  | |||
|  | @ -1,11 +1,7 @@ | |||
| #ifndef SUBSURFACESYSINFO_H | ||||
| #define SUBSURFACESYSINFO_H | ||||
| 
 | ||||
| #include <QtGlobal> | ||||
| 
 | ||||
| #ifdef Q_OS_WIN | ||||
| extern "C" | ||||
| 
 | ||||
| bool isWin7Or8(); | ||||
| #endif | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										12
									
								
								core/tag.cpp
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								core/tag.cpp
									
										
									
									
									
								
							|  | @ -39,7 +39,7 @@ static bool tag_seen_before(struct tag_entry *start, struct tag_entry *before) | |||
| } | ||||
| 
 | ||||
| /* remove duplicates and empty nodes */ | ||||
| extern "C" void taglist_cleanup(struct tag_entry **tag_list) | ||||
| void taglist_cleanup(struct tag_entry **tag_list) | ||||
| { | ||||
| 	struct tag_entry **tl = tag_list; | ||||
| 	while (*tl) { | ||||
|  | @ -105,7 +105,7 @@ static const divetag *register_tag(const char *s, const char *source) | |||
| 	return it->get(); | ||||
| } | ||||
| 
 | ||||
| extern "C" void taglist_add_tag(struct tag_entry **tag_list, const char *tag) | ||||
| void taglist_add_tag(struct tag_entry **tag_list, const char *tag) | ||||
| { | ||||
| 	bool is_default_tag = std::find_if(std::begin(default_tags), std::end(default_tags), | ||||
| 			[&tag] (const char *default_tag) { return tag == default_tag; }); | ||||
|  | @ -119,12 +119,12 @@ extern "C" void taglist_add_tag(struct tag_entry **tag_list, const char *tag) | |||
| 	taglist_add_divetag(tag_list, d_tag); | ||||
| } | ||||
| 
 | ||||
| extern "C" void taglist_free(struct tag_entry *entry) | ||||
| void taglist_free(struct tag_entry *entry) | ||||
| { | ||||
| 	STRUCTURED_LIST_FREE(struct tag_entry, entry, free) | ||||
| } | ||||
| 
 | ||||
| extern "C" struct tag_entry *taglist_copy(struct tag_entry *s) | ||||
| struct tag_entry *taglist_copy(struct tag_entry *s) | ||||
| { | ||||
| 	struct tag_entry *res; | ||||
| 	STRUCTURED_LIST_COPY(struct tag_entry, s, res, copy_tl); | ||||
|  | @ -132,7 +132,7 @@ extern "C" struct tag_entry *taglist_copy(struct tag_entry *s) | |||
| } | ||||
| 
 | ||||
| /* Merge src1 and src2, write to *dst */ | ||||
| extern "C" void taglist_merge(struct tag_entry **dst, struct tag_entry *src1, struct tag_entry *src2) | ||||
| void taglist_merge(struct tag_entry **dst, struct tag_entry *src1, struct tag_entry *src2) | ||||
| { | ||||
| 	struct tag_entry *entry; | ||||
| 
 | ||||
|  | @ -142,7 +142,7 @@ extern "C" void taglist_merge(struct tag_entry **dst, struct tag_entry *src1, st | |||
| 		taglist_add_divetag(dst, entry->tag); | ||||
| } | ||||
| 
 | ||||
| extern "C" void taglist_init_global() | ||||
| void taglist_init_global() | ||||
| { | ||||
| 	for (const char *s: default_tags) | ||||
| 		register_tag(translate("gettextFromC", s), s); | ||||
|  |  | |||
|  | @ -6,8 +6,7 @@ | |||
| #include <memory> | ||||
| #include <string> | ||||
| #include <vector> | ||||
| 
 | ||||
| extern "C" { | ||||
| #include <string> | ||||
| 
 | ||||
| struct divetag { | ||||
| 	/*
 | ||||
|  | @ -54,12 +53,6 @@ extern std::vector<std::unique_ptr<divetag>> g_tag_list; | |||
|  */ | ||||
| extern std::string taglist_get_tagstring(struct tag_entry *tag_list); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // C++ only functions
 | ||||
| 
 | ||||
| #include <string> | ||||
| 
 | ||||
| /* Comma separated list of tags names or null terminated string */ | ||||
| std::string taglist_get_tagstring(struct tag_entry *tag_list); | ||||
| 
 | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ | |||
|  * are unnecessary once you're counting minutes (32-bit minutes: | ||||
|  * 8000+ years). | ||||
|  */ | ||||
| extern "C" void utc_mkdate(timestamp_t timestamp, struct tm *tm) | ||||
| void utc_mkdate(timestamp_t timestamp, struct tm *tm) | ||||
| { | ||||
| 	static const unsigned int mdays[] = { | ||||
| 		31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, | ||||
|  | @ -100,7 +100,7 @@ extern "C" void utc_mkdate(timestamp_t timestamp, struct tm *tm) | |||
| 	tm->tm_mon = m; | ||||
| } | ||||
| 
 | ||||
| extern "C" timestamp_t utc_mktime(const struct tm *tm) | ||||
| timestamp_t utc_mktime(const struct tm *tm) | ||||
| { | ||||
| 	static const int mdays[] = { | ||||
| 		0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 | ||||
|  | @ -147,7 +147,7 @@ extern "C" timestamp_t utc_mktime(const struct tm *tm) | |||
|  * out unused calculations. If it turns out to be a bottle neck | ||||
|  * we will have to cache a struct tm per dive. | ||||
|  */ | ||||
| extern "C" int utc_year(timestamp_t timestamp) | ||||
| int utc_year(timestamp_t timestamp) | ||||
| { | ||||
| 	struct tm tm; | ||||
| 	utc_mkdate(timestamp, &tm); | ||||
|  | @ -162,7 +162,7 @@ extern "C" int utc_year(timestamp_t timestamp) | |||
|  * at throwing out unused calculations, so this is more efficient | ||||
|  * than it looks. | ||||
|  */ | ||||
| extern "C" int utc_weekday(timestamp_t timestamp) | ||||
| int utc_weekday(timestamp_t timestamp) | ||||
| { | ||||
| 	struct tm tm; | ||||
| 	utc_mkdate(timestamp, &tm); | ||||
|  | @ -174,7 +174,7 @@ extern "C" int utc_weekday(timestamp_t timestamp) | |||
|  * an 64-bit decimal and return 64-bit timestamp. On failure or | ||||
|  * if passed an empty string, return 0. | ||||
|  */ | ||||
| extern "C" timestamp_t parse_datetime(const char *s) | ||||
| timestamp_t parse_datetime(const char *s) | ||||
| { | ||||
| 	int y, m, d; | ||||
| 	int hr, min, sec; | ||||
|  |  | |||
|  | @ -4,8 +4,6 @@ | |||
| 
 | ||||
| #include "divelist.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| typedef struct dive_trip | ||||
| { | ||||
| 	char *location; | ||||
|  | @ -58,8 +56,6 @@ void clear_trip_table(struct trip_table *table); | |||
| extern void dump_trip_list(void); | ||||
| #endif | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| /* Make pointers to dive_trip and trip_table "Qt metatypes" so that they can be
 | ||||
|  * passed through QVariants and through QML. See comment in dive.h. */ | ||||
| #include <QObject> | ||||
|  |  | |||
|  | @ -9,7 +9,7 @@ const struct units IMPERIAL_units = { | |||
| 	.vertical_speed_time = units::MINUTES, .duration_units = units::MIXED, .show_units_table = false | ||||
| }; | ||||
| 
 | ||||
| extern "C" int get_pressure_units(int mb, const char **units) | ||||
| int get_pressure_units(int mb, const char **units) | ||||
| { | ||||
| 	int pressure; | ||||
| 	const char *unit; | ||||
|  | @ -31,7 +31,7 @@ extern "C" int get_pressure_units(int mb, const char **units) | |||
| 	return pressure; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_temp_units(unsigned int mk, const char **units) | ||||
| double get_temp_units(unsigned int mk, const char **units) | ||||
| { | ||||
| 	double deg; | ||||
| 	const char *unit; | ||||
|  | @ -49,7 +49,7 @@ extern "C" double get_temp_units(unsigned int mk, const char **units) | |||
| 	return deg; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_volume_units(unsigned int ml, int *frac, const char **units) | ||||
| double get_volume_units(unsigned int ml, int *frac, const char **units) | ||||
| { | ||||
| 	int decimals; | ||||
| 	double vol; | ||||
|  | @ -76,7 +76,7 @@ extern "C" double get_volume_units(unsigned int ml, int *frac, const char **unit | |||
| 	return vol; | ||||
| } | ||||
| 
 | ||||
| extern "C" int units_to_sac(double volume) | ||||
| int units_to_sac(double volume) | ||||
| { | ||||
| 	if (get_units()->volume == units::CUFT) | ||||
| 		return lrint(cuft_to_l(volume) * 1000.0); | ||||
|  | @ -84,7 +84,7 @@ extern "C" int units_to_sac(double volume) | |||
| 		return lrint(volume * 1000); | ||||
| } | ||||
| 
 | ||||
| extern "C" depth_t units_to_depth(double depth) | ||||
| depth_t units_to_depth(double depth) | ||||
| { | ||||
| 	depth_t internaldepth; | ||||
| 	if (get_units()->length == units::METERS) { | ||||
|  | @ -95,7 +95,7 @@ extern "C" depth_t units_to_depth(double depth) | |||
| 	return internaldepth; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_depth_units(int mm, int *frac, const char **units) | ||||
| double get_depth_units(int mm, int *frac, const char **units) | ||||
| { | ||||
| 	int decimals; | ||||
| 	double d; | ||||
|  | @ -122,7 +122,7 @@ extern "C" double get_depth_units(int mm, int *frac, const char **units) | |||
| 	return d; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_vertical_speed_units(unsigned int mms, int *frac, const char **units) | ||||
| double get_vertical_speed_units(unsigned int mms, int *frac, const char **units) | ||||
| { | ||||
| 	double d; | ||||
| 	const char *unit; | ||||
|  | @ -153,7 +153,7 @@ extern "C" double get_vertical_speed_units(unsigned int mms, int *frac, const ch | |||
| 	return d; | ||||
| } | ||||
| 
 | ||||
| extern "C" double get_weight_units(unsigned int grams, int *frac, const char **units) | ||||
| double get_weight_units(unsigned int grams, int *frac, const char **units) | ||||
| { | ||||
| 	int decimals; | ||||
| 	double value; | ||||
|  | @ -176,7 +176,7 @@ extern "C" double get_weight_units(unsigned int grams, int *frac, const char **u | |||
| 	return value; | ||||
| } | ||||
| 
 | ||||
| extern "C" const struct units *get_units() | ||||
| const struct units *get_units() | ||||
| { | ||||
| 	return &prefs.units; | ||||
| } | ||||
|  |  | |||
|  | @ -7,8 +7,6 @@ | |||
| #define M_PI 3.14159265358979323846 | ||||
| #endif | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| #define FRACTION_TUPLE(n, x) ((unsigned)(n) / (x)), ((unsigned)(n) % (x)) | ||||
| #define SIGNED_FRAC_TRIPLET(n, x) ((n) >= 0 ? '+': '-'), ((n) >= 0 ? (unsigned)(n) / (x) : (-(n) / (x))), ((unsigned)((n) >= 0 ? (n) : -(n)) % (x)) | ||||
| 
 | ||||
|  | @ -338,6 +336,5 @@ extern double get_vertical_speed_units(unsigned int mms, int *frac, const char * | |||
| 
 | ||||
| extern depth_t units_to_depth(double depth); | ||||
| extern int units_to_sac(double volume); | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -35,8 +35,6 @@ static std::string make_default_filename() | |||
| 	return system_default_path() + "/" + user + ".xml"; | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| // the DE should provide us with a default font and font size...
 | ||||
| const char unix_system_divelist_default_font[] = "Sans"; | ||||
| const char *system_divelist_default_font = unix_system_divelist_default_font; | ||||
|  | @ -203,5 +201,3 @@ bool subsurface_user_is_root() | |||
| { | ||||
| 	return geteuid() == 0; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -2,12 +2,12 @@ | |||
| #include "ssrf-version.h" | ||||
| 
 | ||||
| // let's leave the two redundant functions in case we change our minds on git SHAs
 | ||||
| extern "C" const char *subsurface_git_version(void) | ||||
| const char *subsurface_git_version(void) | ||||
| { | ||||
| 	return CANONICAL_VERSION_STRING_4; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *subsurface_canonical_version(void) | ||||
| const char *subsurface_canonical_version(void) | ||||
| { | ||||
| 	return CANONICAL_VERSION_STRING; | ||||
| } | ||||
|  |  | |||
|  | @ -1,11 +1,7 @@ | |||
| #ifndef VERSION_H | ||||
| #define VERSION_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| const char *subsurface_git_version(void); | ||||
| const char *subsurface_canonical_version(void); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ | |||
| #ifndef WEBSERVICE_H | ||||
| #define WEBSERVICE_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| //extern void webservice_download_dialog(void);
 | ||||
| //extern bool webservice_request_user_xml(const gchar *, gchar **, unsigned int *, unsigned int *);
 | ||||
| extern int divelogde_upload(char *fn, char **error); | ||||
|  | @ -16,6 +14,4 @@ enum { | |||
| 	DD_STATUS_ERROR_PARSE, | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
| #endif // WEBSERVICE_H
 | ||||
|  |  | |||
|  | @ -100,8 +100,6 @@ static std::wstring make_default_filename() | |||
| 	return path + L"\\" + filename; | ||||
| } | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| const char non_standard_system_divelist_default_font[] = "Calibri"; | ||||
| const char current_system_divelist_default_font[] = "Segoe UI"; | ||||
| const char *system_divelist_default_font = non_standard_system_divelist_default_font; | ||||
|  | @ -427,5 +425,3 @@ bool subsurface_user_is_root() | |||
| 	/* FIXME: Detect admin rights */ | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ | |||
| 
 | ||||
| WindowTitleUpdate windowTitleUpdate; | ||||
| 
 | ||||
| extern "C" void updateWindowTitle() | ||||
| void updateWindowTitle() | ||||
| { | ||||
| 	emit windowTitleUpdate.updateTitle(); | ||||
| } | ||||
|  |  | |||
|  | @ -106,7 +106,7 @@ static void export_doit(struct membuffer *b, const bool selected_only) | |||
| 	put_string(b, "\t</head>\n<body>\n<div id=\"map-canvas\"></div>\n</body>\n</html>"); | ||||
| } | ||||
| 
 | ||||
| extern "C" void export_worldmap_HTML(const char *file_name, const bool selected_only) | ||||
| void export_worldmap_HTML(const char *file_name, const bool selected_only) | ||||
| { | ||||
| 	FILE *f; | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,10 +2,6 @@ | |||
| #ifndef WORLDMAP_SAVE_H | ||||
| #define WORLDMAP_SAVE_H | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| extern void export_worldmap_HTML(const char *file_name, bool selected_only); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -1,42 +1,42 @@ | |||
| // SPDX-License-Identifier: GPL-2.0
 | ||||
| #include "xmlparams.h" | ||||
| 
 | ||||
| extern "C" struct xml_params *alloc_xml_params() | ||||
| struct xml_params *alloc_xml_params() | ||||
| { | ||||
| 	return new xml_params; | ||||
| } | ||||
| 
 | ||||
| extern "C" void free_xml_params(struct xml_params *params) | ||||
| void free_xml_params(struct xml_params *params) | ||||
| { | ||||
| 	delete params; | ||||
| } | ||||
| 
 | ||||
| extern "C" void xml_params_resize(struct xml_params *params, int count) | ||||
| void xml_params_resize(struct xml_params *params, int count) | ||||
| { | ||||
| 	params->items.resize(count); | ||||
| } | ||||
| 
 | ||||
| extern "C" void xml_params_add(struct xml_params *params, const char *key, const char *value) | ||||
| void xml_params_add(struct xml_params *params, const char *key, const char *value) | ||||
| { | ||||
| 	params->items.push_back({ std::string(key), std::string(value) }); | ||||
| } | ||||
| 
 | ||||
| extern "C" void xml_params_add_int(struct xml_params *params, const char *key, int value) | ||||
| void xml_params_add_int(struct xml_params *params, const char *key, int value) | ||||
| { | ||||
| 	params->items.push_back({ std::string(key), std::to_string(value) }); | ||||
| } | ||||
| 
 | ||||
| extern "C" int xml_params_count(const struct xml_params *params) | ||||
| int xml_params_count(const struct xml_params *params) | ||||
| { | ||||
| 	return (int)params->items.size(); | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *xml_params_get_key(const struct xml_params *params, int idx) | ||||
| const char *xml_params_get_key(const struct xml_params *params, int idx) | ||||
| { | ||||
| 	return params->items[idx].first.c_str(); | ||||
| } | ||||
| 
 | ||||
| extern "C" const char *xml_params_get_value(const struct xml_params *params, int idx) | ||||
| const char *xml_params_get_value(const struct xml_params *params, int idx) | ||||
| { | ||||
| 	return params->items[idx].second.c_str(); | ||||
| } | ||||
|  | @ -48,7 +48,7 @@ extern void xml_params_set_value(struct xml_params *params, int idx, const char | |||
| 	params->items[idx].second = value; | ||||
| } | ||||
| 
 | ||||
| extern "C" const char **xml_params_get(const struct xml_params *params) | ||||
| const char **xml_params_get(const struct xml_params *params) | ||||
| { | ||||
| 	if (!params) | ||||
| 		return nullptr; | ||||
|  |  | |||
|  | @ -12,8 +12,6 @@ struct xml_params { | |||
| 	mutable std::vector<const char *> data; | ||||
| }; | ||||
| 
 | ||||
| extern "C" { | ||||
| 
 | ||||
| // Return values marked as "not stable" may be invalidated when calling
 | ||||
| // an xml_params_*() function that takes a non-const xml_params parameter.
 | ||||
| extern struct xml_params *alloc_xml_params(); | ||||
|  | @ -27,6 +25,4 @@ extern const char *xml_params_get_value(const struct xml_params *params, int idx | |||
| extern void xml_params_set_value(struct xml_params *params, int idx, const char *value); | ||||
| extern const char **xml_params_get(const struct xml_params *params); // not stable
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -82,7 +82,7 @@ namespace { | |||
| 	int progressCounter = 0; | ||||
| } | ||||
| 
 | ||||
| extern "C" int updateProgress(const char *text) | ||||
| int updateProgress(const char *text) | ||||
| { | ||||
| 	if (verbose) | ||||
| 		report_info("git storage: %s", text); | ||||
|  | @ -107,7 +107,7 @@ extern "C" int updateProgress(const char *text) | |||
| 
 | ||||
| MainWindow *MainWindow::m_Instance = nullptr; | ||||
| 
 | ||||
| extern "C" void showErrorFromC(char *buf) | ||||
| void showErrorFromC(char *buf) | ||||
| { | ||||
| 	QString error(buf); | ||||
| 	free(buf); | ||||
|  |  | |||
|  | @ -15,8 +15,6 @@ class ProfileWidget2; | |||
| class EmptyView; | ||||
| class QStackedWidget; | ||||
| 
 | ||||
| extern "C" void free_dive(struct dive *); | ||||
| 
 | ||||
| class ProfileWidget : public QWidget { | ||||
| 	Q_OBJECT | ||||
| public: | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue