navit
0.5.3-trunk
|
#include "config.h"
#include "navit_lfs.h"
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <wordexp.h>
#include <glib.h>
#include <zlib.h>
#include "debug.h"
#include "cache.h"
#include "file.h"
#include "atom.h"
#include "item.h"
#include "util.h"
#include "types.h"
#include "zipfile.h"
Data Structures | |
struct | file_cache_id |
struct | file_wordexp |
Macros | |
#define | S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
#define | S_ISREG(m) (((m) & S_IFMT) == S_IFREG) |
Functions | |
static unsigned char * | file_http_header_end (unsigned char *str, int len) |
int | file_request (struct file *f, struct attr **options) |
char * | file_http_header (struct file *f, char *header) |
struct file * | file_create (char *name, struct attr **options) |
int | file_is_dir (const char *name) |
Check if a given path corresponds to a directory. More... | |
int | file_is_reg (const char *name) |
Check if a given path corresponds to a regular file. More... | |
long long | file_size (struct file *file) |
int | file_mkdir (char *name, int pflag) |
int | file_mmap (struct file *file) |
unsigned char * | file_data_read (struct file *file, long long offset, int size) |
static void | file_process_headers (struct file *file, unsigned char *headers) |
static void | file_shift_buffer (struct file *file, int amount) |
unsigned char * | file_data_read_special (struct file *file, int size, int *size_ret) |
unsigned char * | file_data_read_all (struct file *file) |
void | file_data_flush (struct file *file, long long offset, int size) |
int | file_data_write (struct file *file, long long offset, int size, const void *data) |
int | file_get_contents (char *name, unsigned char **buffer, int *size) |
static int | uncompress_int (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) |
unsigned char * | file_data_read_compressed (struct file *file, long long offset, int size, int size_uncomp) |
void | file_data_free (struct file *file, unsigned char *data) |
void | file_data_remove (struct file *file, unsigned char *data) |
int | file_exists (char const *name) |
void | file_remap_readonly (struct file *f) |
void | file_unmap (struct file *f) |
void * | file_opendir (char *dir) |
char * | file_readdir (void *hnd) |
void | file_closedir (void *hnd) |
struct file * | file_create_caseinsensitive (char *name, struct attr **options) |
void | file_fsync (struct file *f) |
void | file_destroy (struct file *f) |
struct file_wordexp * | file_wordexp_new (const char *pattern) |
int | file_wordexp_get_count (struct file_wordexp *wexp) |
char ** | file_wordexp_get_array (struct file_wordexp *wexp) |
void | file_wordexp_destroy (struct file_wordexp *wexp) |
int | file_version (struct file *file, int mode) |
void * | file_get_os_handle (struct file *file) |
int | file_set_cache_size (int cache_size) |
void | file_init (void) |
Variables | |
static struct cache * | file_cache |
struct file_cache_id | ATTRIBUTE_PACKED |
#define S_ISDIR | ( | m | ) | (((m) & S_IFMT) == S_IFDIR) |
#define S_ISREG | ( | m | ) | (((m) & S_IFMT) == S_IFREG) |
void file_closedir | ( | void * | hnd | ) |
Referenced by file_create_caseinsensitive(), and speechd_new().
References atom(), attr_search(), file::cache, dbg, dbg_assert, file::fd, file, LONGLONG_FMT, lvl_debug, file::name, name, file::name_id, attr::num, O_BINARY, O_LARGEFILE, file::size, and attr::u.
Referenced by ch_setup(), download(), file_create_caseinsensitive(), file_get_contents(), map_binfile_http_request(), map_binfile_open(), map_binfile_zip_setup(), map_rect_new_shapefile(), and vehicle_file_destroy().
References file_closedir(), file_create(), file_opendir(), file_readdir(), filename, name, and p.
Referenced by map_new_mg(), tree_search_hv(), and tree_search_init().
void file_data_flush | ( | struct file * | file, |
long long | offset, | ||
int | size | ||
) |
References file::cache, cache_flush(), dbg, file_cache, LONGLONG_FMT, lvl_debug, file::name_id, offset, and size.
Referenced by download_finish(), and file_data_write().
void file_data_free | ( | struct file * | file, |
unsigned char * | data | ||
) |
References file::begin, file::cache, cache_entry_destroy(), data, and file_cache.
Referenced by binfile_extract(), binfile_read_cd(), binfile_read_eoc(), binfile_read_eoc64(), binfile_read_lfh(), binfile_search_cd(), download_cd(), file_data_read(), map_binfile_close(), map_binfile_open(), map_binfile_zip_setup(), map_download_selection(), map_rect_destroy_binfile(), map_rect_new_shapefile(), pop_tile(), push_zipfile_tile_do(), and zipfile_to_tile().
unsigned char* file_data_read | ( | struct file * | file, |
long long | offset, | ||
int | size | ||
) |
References file::begin, file::cache, cache_insert_new(), cache_lookup(), file::fd, file_cache, file_data_free(), file::name_id, offset, size, and file::special.
Referenced by binfile_read_cd(), binfile_read_content(), binfile_read_eoc(), binfile_read_eoc64(), binfile_read_lfh(), binfile_search_cd(), ch_setup(), download_cd(), download_finish(), download_start(), file_data_read_all(), map_binfile_open(), map_rect_new_binfile(), push_zipfile_tile(), and zipfile_to_tile().
unsigned char* file_data_read_all | ( | struct file * | file | ) |
References file_data_read(), and file::size.
Referenced by file_get_contents(), and map_rect_new_shapefile().
unsigned char* file_data_read_compressed | ( | struct file * | file, |
long long | offset, | ||
int | size, | ||
int | size_uncomp | ||
) |
References file::cache, cache_insert_new(), cache_lookup(), dbg, file::fd, file_cache, lvl_error, file::name_id, offset, size, and uncompress_int().
Referenced by binfile_read_content().
unsigned char* file_data_read_special | ( | struct file * | file, |
int | size, | ||
int * | size_ret | ||
) |
References file::buffer, file::buffer_len, buffer_size, dbg, file::fd, file_http_header(), file_http_header_end(), file_process_headers(), file_shift_buffer(), lvl_debug, file::requests, size, and file::special.
Referenced by download_directory_do(), download_download(), map_binfile_download_range(), and map_binfile_download_size().
void file_data_remove | ( | struct file * | file, |
unsigned char * | data | ||
) |
References file::begin, file::cache, cache_flush_data(), data, and file_cache.
Referenced by download_finish(), and download_start().
int file_data_write | ( | struct file * | file, |
long long | offset, | ||
int | size, | ||
const void * | data | ||
) |
References data, file::fd, file_data_flush(), offset, file::size, and size.
Referenced by download_directory_do(), download_download(), download_finish(), download_initial_finish(), and vehicle_file_destroy().
void file_destroy | ( | struct file * | f | ) |
References file::f, and file_unmap().
Referenced by file_get_contents(), map_binfile_close(), map_binfile_handle_redirect(), map_binfile_http_close(), map_binfile_open(), map_destroy_mg(), map_rect_new_shapefile(), tree_search_free(), tree_search_hv(), and vehicle_file_destroy().
int file_exists | ( | char const * | name | ) |
References name.
Referenced by espeak_new(), expand_filenames(), main_init(), main_real(), navit_get_user_data_directory(), plugin_new(), vehicle_file_new_file(), and xinclude().
void file_fsync | ( | struct file * | f | ) |
References file::f.
Referenced by vehicle_file_destroy().
int file_get_contents | ( | char * | name, |
unsigned char ** | buffer, | ||
int * | size | ||
) |
References file::cache, file, file_create(), file_data_read_all(), file_destroy(), file_size(), name, and size.
Referenced by gui_internal_setup(), item_bin_sort_file(), and vehicle_file_io().
char* file_http_header | ( | struct file * | f, |
char * | header | ||
) |
References file::headers.
Referenced by file_data_read_special(), and map_binfile_handle_redirect().
|
static |
References attr::str.
Referenced by file_data_read_special().
void file_init | ( | void | ) |
References cache_new(), dbg, file_cache, and lvl_error.
Referenced by add_plugin(), and main_real().
int file_is_dir | ( | const char * | name | ) |
Check if a given path corresponds to a directory.
name | The path to the filesystem element |
name
is a directory Referenced by file_mkdir(), and xinclude().
int file_is_reg | ( | const char * | name | ) |
Check if a given path corresponds to a regular file.
name | The path to the filesystem element |
name
is a regular file Referenced by vehicle_file_open().
int file_mkdir | ( | char * | name, |
int | pflag | ||
) |
References dbg, file_is_dir(), lvl_debug, name, and next.
Referenced by binfile_extract(), log_open(), and navit_get_user_data_directory().
int file_mmap | ( | struct file * | file | ) |
References file::begin, dbg_assert, file::end, file::fd, file::mmap_end, file::name, and file::size.
Referenced by ch_setup(), map_binfile_open(), map_binfile_zip_setup(), map_new_mg(), tree_search_hv(), and tree_search_init().
void* file_opendir | ( | char * | dir | ) |
Referenced by file_create_caseinsensitive(), and speechd_new().
|
static |
References dbg, file::headers, lvl_debug, file::size, and strtolower().
Referenced by file_data_read_special().
char* file_readdir | ( | void * | hnd | ) |
Referenced by file_create_caseinsensitive(), and speechd_new().
void file_remap_readonly | ( | struct file * | f | ) |
References file::begin, file::fd, and file::size.
Referenced by map_binfile_http_request().
int file_set_cache_size | ( | int | cache_size | ) |
References cache_resize(), and file_cache.
Referenced by config_set_attr_int().
|
static |
References file::buffer, and file::buffer_len.
Referenced by file_data_read_special().
long long file_size | ( | struct file * | file | ) |
References file::size.
Referenced by ch_setup(), download_start(), file_get_contents(), map_binfile_download_size(), and map_rect_new_shapefile().
void file_unmap | ( | struct file * | f | ) |
References file::begin, and file::size.
Referenced by file_destroy().
int file_version | ( | struct file * | file, |
int | mode | ||
) |
References file::begin, file::ctime, dbg, file::end, file::fd, lvl_debug, file::mmap_end, file::mtime, file::name, file::size, size, st, and file::version.
Referenced by binfile_check_version(), and map_binfile_open().
void file_wordexp_destroy | ( | struct file_wordexp * | wexp | ) |
References file_wordexp::err, file_wordexp::pattern, and file_wordexp::we.
Referenced by graphics_icon_path(), graphics_image_new_scaled_rotated(), graphics_texture_path(), log_new(), map_new_binfile(), map_new_csv(), map_new_mg(), map_new_shapefile(), map_new_textfile(), osd_gps_status_new(), osd_nav_next_turn_new(), osd_nav_toggle_announcer_new(), osd_navigation_status_new(), osd_volume_new(), plugin_new(), and xinclude().
char** file_wordexp_get_array | ( | struct file_wordexp * | wexp | ) |
References file_wordexp::err, file_wordexp::pattern, and file_wordexp::we.
Referenced by graphics_icon_path(), graphics_image_new_scaled_rotated(), graphics_texture_path(), log_new(), map_new_binfile(), map_new_csv(), map_new_mg(), map_new_shapefile(), map_new_textfile(), osd_gps_status_new(), osd_nav_next_turn_new(), osd_nav_toggle_announcer_new(), osd_navigation_status_new(), osd_volume_new(), plugin_new(), and xinclude().
int file_wordexp_get_count | ( | struct file_wordexp * | wexp | ) |
References file_wordexp::err, and file_wordexp::we.
Referenced by graphics_icon_path(), graphics_image_new_scaled_rotated(), graphics_texture_path(), log_new(), plugin_new(), and xinclude().
struct file_wordexp* file_wordexp_new | ( | const char * | pattern | ) |
References dbg, file_wordexp::err, lvl_debug, file_wordexp::pattern, and file_wordexp::we.
Referenced by graphics_icon_path(), graphics_image_new_scaled_rotated(), graphics_texture_path(), log_new(), map_new_binfile(), map_new_csv(), map_new_mg(), map_new_shapefile(), map_new_textfile(), osd_gps_status_new(), osd_nav_next_turn_new(), osd_nav_toggle_announcer_new(), osd_navigation_status_new(), osd_volume_new(), plugin_new(), and xinclude().
|
static |
References startup::dest, and err().
Referenced by file_data_read_compressed().
struct file_cache_id ATTRIBUTE_PACKED |
|
static |
Navit, a modular navigation system. Copyright (C) 2005-2011 Navit Team
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Referenced by file_data_flush(), file_data_free(), file_data_read(), file_data_read_compressed(), file_data_remove(), file_init(), and file_set_cache_size().