mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Cleanup: move file-related function declarations to file.h
A number of architecture-dependent functions were declared in dive.h. Move them to file.h so that not all file-manipulating translation units have to include dive.h. This is a small step in avoiding mass-recompilation on every change to dive.h Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5da09a21bb
commit
594d1d3514
18 changed files with 45 additions and 23 deletions
|
@ -2,6 +2,7 @@
|
|||
/* implements Android specific functions */
|
||||
#include "dive.h"
|
||||
#include "display.h"
|
||||
#include "file.h"
|
||||
#include "qthelper.h"
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -10,6 +11,7 @@
|
|||
#include <libusb.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <zip.h>
|
||||
|
||||
#include <QtAndroidExtras/QtAndroidExtras>
|
||||
#include <QtAndroidExtras/QAndroidJniObject>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <libxslt/transform.h>
|
||||
#include <QStringList>
|
||||
#include <QXmlStreamWriter>
|
||||
#include "core/dive.h" // for subsurface_fopen()
|
||||
#include "core/file.h"
|
||||
#include "core/errorhelper.h"
|
||||
#include "core/version.h"
|
||||
|
||||
|
|
|
@ -17,12 +17,13 @@
|
|||
* restore_deco_state()
|
||||
* dump_tissues()
|
||||
*/
|
||||
#include "ssrf.h"
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "ssrf.h"
|
||||
#include "dive.h"
|
||||
#include "subsurface-string.h"
|
||||
#include <assert.h>
|
||||
#include "errorhelper.h"
|
||||
#include "planner.h"
|
||||
#include "qthelper.h"
|
||||
|
|
12
core/dive.h
12
core/dive.h
|
@ -9,9 +9,8 @@
|
|||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
#include <zip.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "equipment.h"
|
||||
|
||||
|
@ -317,15 +316,6 @@ struct user_info {
|
|||
};
|
||||
|
||||
extern void subsurface_user_info(struct user_info *);
|
||||
extern int subsurface_rename(const char *path, const char *newpath);
|
||||
extern int subsurface_dir_rename(const char *path, const char *newpath);
|
||||
extern int subsurface_open(const char *path, int oflags, mode_t mode);
|
||||
extern FILE *subsurface_fopen(const char *path, const char *mode);
|
||||
extern void *subsurface_opendir(const char *path);
|
||||
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);
|
||||
extern void subsurface_console_init(void);
|
||||
extern void subsurface_console_exit(void);
|
||||
extern bool subsurface_user_is_root(void);
|
||||
|
|
17
core/file.h
17
core/file.h
|
@ -2,12 +2,17 @@
|
|||
#ifndef FILE_H
|
||||
#define FILE_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
struct memblock {
|
||||
void *buffer;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
struct trip_table;
|
||||
struct dive_site_table;
|
||||
struct dive_table;
|
||||
struct zip;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -20,6 +25,18 @@ extern void ostctools_import(const char *file, struct dive_table *table, struct
|
|||
extern int readfile(const char *filename, struct memblock *mem);
|
||||
extern int parse_file(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||
extern int try_to_open_zip(const char *filename, struct dive_table *table, struct trip_table *trips, struct dive_site_table *sites);
|
||||
|
||||
// Platform specific functions
|
||||
extern int subsurface_rename(const char *path, const char *newpath);
|
||||
extern int subsurface_dir_rename(const char *path, const char *newpath);
|
||||
extern int subsurface_open(const char *path, int oflags, mode_t mode);
|
||||
extern FILE *subsurface_fopen(const char *path, const char *mode);
|
||||
extern void *subsurface_opendir(const char *path);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "membuffer.h"
|
||||
#include "strndup.h"
|
||||
#include "qthelper.h"
|
||||
#include "dive.h" // for subsurface_stat()
|
||||
#include "file.h"
|
||||
#include "errorhelper.h"
|
||||
#include "git-access.h"
|
||||
#include "gettext.h"
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <dirent.h>
|
||||
#include <fnmatch.h>
|
||||
#include "dive.h"
|
||||
#include "file.h"
|
||||
#include "display.h"
|
||||
#include "core/qthelper.h"
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
@ -15,6 +16,7 @@
|
|||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <zip.h>
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "subsurface-string.h"
|
||||
#include "gettext.h"
|
||||
#include "divelist.h"
|
||||
#include "file.h"
|
||||
#include "libdivecomputer.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gettext.h"
|
||||
#include "divesite.h"
|
||||
#include "errorhelper.h"
|
||||
#include "file.h"
|
||||
#include "tag.h"
|
||||
#include "trip.h"
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "core/profile.h"
|
||||
#include "core/display.h"
|
||||
#include "core/errorhelper.h"
|
||||
#include "core/file.h"
|
||||
#include "core/membuffer.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/save-profiledata.h"
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
#ifndef SAVE_PROFILE_DATA_H
|
||||
#define SAVE_PROFILE_DATA_H
|
||||
|
||||
#include "dive.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "subsurface-string.h"
|
||||
#include "trip.h"
|
||||
#include "device.h"
|
||||
#include "file.h"
|
||||
#include "membuffer.h"
|
||||
#include "strndup.h"
|
||||
#include "git-access.h"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "divelist.h"
|
||||
#include "divesite.h"
|
||||
#include "errorhelper.h"
|
||||
#include "file.h"
|
||||
#include "tag.h"
|
||||
#include "core/subsurface-string.h"
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
/* implements UNIX specific functions */
|
||||
#include "ssrf.h"
|
||||
#include "dive.h"
|
||||
#include "file.h"
|
||||
#include "subsurface-string.h"
|
||||
#include "display.h"
|
||||
#include "membuffer.h"
|
||||
|
@ -14,6 +15,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
#include <zip.h>
|
||||
|
||||
// the DE should provide us with a default font and font size...
|
||||
const char unix_system_divelist_default_font[] = "Sans";
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <io.h>
|
||||
#include "dive.h"
|
||||
#include "display.h"
|
||||
#include "file.h"
|
||||
#include "errorhelper.h"
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x500
|
||||
#include <windows.h>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "membuffer.h"
|
||||
#include "divesite.h"
|
||||
#include "errorhelper.h"
|
||||
#include "file.h"
|
||||
#include "save-html.h"
|
||||
#include "worldmap-save.h"
|
||||
#include "worldmap-options.h"
|
||||
|
|
|
@ -5,20 +5,21 @@
|
|||
#include <QtConcurrent>
|
||||
#include <string.h> // Allows string comparisons and substitutions in TeX export
|
||||
|
||||
#include "desktop-widgets/divelogexportdialog.h"
|
||||
#include "core/divelogexportlogic.h"
|
||||
#include "desktop-widgets/diveshareexportdialog.h"
|
||||
#include "ui_divelogexportdialog.h"
|
||||
#include "desktop-widgets/subsurfacewebservices.h"
|
||||
#include "core/divelogexportlogic.h"
|
||||
#include "core/worldmap-save.h"
|
||||
#include "core/save-html.h"
|
||||
#include "core/settings/qPrefDisplay.h"
|
||||
#include "desktop-widgets/mainwindow.h"
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
#include "core/save-profiledata.h"
|
||||
#include "core/divesite.h"
|
||||
#include "core/errorhelper.h"
|
||||
#include "core/file.h"
|
||||
#include "core/tag.h"
|
||||
#include "desktop-widgets/mainwindow.h"
|
||||
#include "desktop-widgets/divelogexportdialog.h"
|
||||
#include "desktop-widgets/diveshareexportdialog.h"
|
||||
#include "desktop-widgets/subsurfacewebservices.h"
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
|
||||
// Retrieves the current unit settings defined in the Subsurface preferences.
|
||||
#define GET_UNIT(name, field, f, t) \
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <QShortcut>
|
||||
#include <QDebug>
|
||||
#include <errno.h>
|
||||
#include <zip.h>
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#include <unistd.h> // for dup(2)
|
||||
|
|
Loading…
Reference in a new issue