Commit d601e4ed authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Split file path functions out of vlc_charset.h into vlc_fs.h

parent 0ce5cde7
......@@ -2,7 +2,7 @@
* charset.h: Unicode UTF-8 wrappers function
*****************************************************************************
* Copyright (C) 2003-2005 the VideoLAN team
* Copyright © 2005-2006 Rémi Denis-Courmont
* Copyright © 2005-2010 Rémi Denis-Courmont
* $Id$
*
* Author: Rémi Denis-Courmont <rem # videolan,org>
......@@ -31,8 +31,6 @@
*/
#include <stdarg.h>
#include <sys/types.h>
#include <dirent.h>
VLC_EXPORT( void, LocaleFree, ( const char * ) );
VLC_EXPORT( char *, FromLocale, ( const char * ) LIBVLC_USED );
......@@ -40,29 +38,9 @@ VLC_EXPORT( char *, FromLocaleDup, ( const char * ) LIBVLC_USED );
VLC_EXPORT( char *, ToLocale, ( const char * ) LIBVLC_USED );
VLC_EXPORT( char *, ToLocaleDup, ( const char * ) LIBVLC_USED );
/* TODO: move all of this to "vlc_fs.h" or something like that */
VLC_EXPORT( int, utf8_open, ( const char *filename, int flags, ... ) LIBVLC_USED );
VLC_EXPORT( FILE *, utf8_fopen, ( const char *filename, const char *mode ) LIBVLC_USED );
VLC_EXPORT( DIR *, utf8_opendir, ( const char *dirname ) LIBVLC_USED );
VLC_EXPORT( char *, utf8_readdir, ( DIR *dir ) LIBVLC_USED );
VLC_EXPORT( int, utf8_loaddir, ( DIR *dir, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
VLC_EXPORT( int, utf8_scandir, ( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
VLC_EXPORT( int, utf8_mkdir, ( const char *filename, mode_t mode ) );
VLC_EXPORT( int, utf8_unlink, ( const char *filename ) );
int utf8_rename( const char *, const char * );
#if defined( WIN32 ) && !defined( UNDER_CE )
# define stat _stati64
#endif
VLC_EXPORT( int, utf8_stat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT( int, utf8_lstat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT( int, utf8_vfprintf, ( FILE *stream, const char *fmt, va_list ap ) );
VLC_EXPORT( int, utf8_fprintf, ( FILE *, const char *, ... ) LIBVLC_FORMAT( 2, 3 ) );
VLC_EXPORT( int, utf8_mkstemp, ( char * ) );
VLC_EXPORT( char *, EnsureUTF8, ( char * ) );
VLC_EXPORT( const char *, IsUTF8, ( const char * ) LIBVLC_USED );
......
/*****************************************************************************
* vlc_fs.h: File system helpers
*****************************************************************************
* Copyright © 2006-2010 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*****************************************************************************/
#ifndef VLC_FS_H
#define VLC_FS_H 1
/**
* \file
* Those functions convert file paths from UTF-8 to the system-specific
* encoding (especially UTF-16 on Windows). Also, they always mark file
* descriptor with the close-on-exec flag.
*/
#include <sys/types.h>
#include <dirent.h>
VLC_EXPORT( int, utf8_open, ( const char *filename, int flags, ... ) LIBVLC_USED );
VLC_EXPORT( FILE *, utf8_fopen, ( const char *filename, const char *mode ) LIBVLC_USED );
VLC_EXPORT( DIR *, utf8_opendir, ( const char *dirname ) LIBVLC_USED );
VLC_EXPORT( char *, utf8_readdir, ( DIR *dir ) LIBVLC_USED );
VLC_EXPORT( int, utf8_loaddir, ( DIR *dir, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
VLC_EXPORT( int, utf8_scandir, ( const char *dirname, char ***namelist, int (*select)( const char * ), int (*compar)( const char **, const char ** ) ) );
VLC_EXPORT( int, utf8_mkdir, ( const char *filename, mode_t mode ) );
VLC_EXPORT( int, utf8_unlink, ( const char *filename ) );
/* Not exported */
int utf8_rename( const char *, const char * );
#if defined( WIN32 ) && !defined( UNDER_CE )
# define stat _stati64
#endif
VLC_EXPORT( int, utf8_stat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT( int, utf8_lstat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT( int, utf8_mkstemp, ( char * ) );
#endif
......@@ -39,7 +39,7 @@
#include <vlc_input.h>
#include <vlc_access.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_bits.h>
#include <assert.h>
......
......@@ -36,7 +36,7 @@
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_picture.h>
#ifdef HAVE_FCNTL_H
......
......@@ -55,7 +55,7 @@ static inline int dirfd (DIR *dir)
}
#endif
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_url.h>
#include <vlc_strings.h>
......
......@@ -38,7 +38,7 @@
#include <time.h>
#include <unistd.h>
#include <poll.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/* DVB Card Drivers */
#include <linux/dvb/version.h>
......
......@@ -36,6 +36,7 @@
#include <vlc_access.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_dialog.h>
......
......@@ -72,7 +72,7 @@
# define PathIsNetworkPathW(wpath) (! wcsncmp(wpath, L"\\\\", 2))
#endif
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_url.h>
struct access_sys_t
......
......@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc_charset.h>
#include <dirent.h>
int Open (vlc_object_t *);
void Close (vlc_object_t *);
......
......@@ -27,7 +27,7 @@
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_input.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_dialog.h>
#include <assert.h>
......
......@@ -49,7 +49,7 @@
#include <unistd.h>
#include <poll.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include "libmtp.h"
......
......@@ -36,7 +36,7 @@
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <fcntl.h>
#include <unistd.h>
......
......@@ -32,7 +32,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <sys/types.h>
#include <fcntl.h>
......
......@@ -29,7 +29,7 @@
#endif
#include <vlc_common.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_plugin.h>
#include <vlc_access.h>
......
......@@ -38,7 +38,7 @@
#include <vlc_demux.h>
#include <vlc_access.h>
#include <vlc_picture.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
......
......@@ -41,6 +41,7 @@
#include <vlc_plugin.h>
#include <vlc_access.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_demux.h>
#include <vlc_input.h>
......
......@@ -33,6 +33,7 @@
#include <vlc_common.h>
#include <vlc_access.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
......@@ -77,7 +78,6 @@
#include "cdrom_internals.h"
#include "cdrom.h"
#include <vlc_charset.h>
#include <vlc_meta.h>
/*****************************************************************************
......
......@@ -35,7 +35,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_charset.h>
#include "vcd.h"
#include "access.h"
......
......@@ -39,7 +39,7 @@
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_strings.h>
#if defined( WIN32 ) && !defined( UNDER_CE )
......
......@@ -34,7 +34,7 @@
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_codecs.h> /* WAVEHEADER */
#include <vlc_charset.h>
#include <vlc_fs.h>
#define FRAME_SIZE 2048
#define A52_FRAME_NB 1536
......
......@@ -37,7 +37,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_aout.h>
......
......@@ -35,7 +35,6 @@
#include <vlc_image.h>
#include <vlc_filter.h>
#include <vlc_charset.h>
/*****************************************************************************
* Local prototypes
......
......@@ -28,6 +28,7 @@
#include "http.h"
#include <vlc_plugin.h>
#include <vlc_url.h>
#include <vlc_fs.h>
#include <assert.h>
......
......@@ -42,7 +42,6 @@
#include <vlc_vlm.h>
#include <vlc_network.h>
#include <vlc_acl.h>
#include <vlc_charset.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
......
......@@ -34,6 +34,7 @@
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <vlc_fs.h>
/* Utility function for scandir */
static int Filter( const char *foo )
......
......@@ -33,6 +33,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <vlc_fs.h>
/****************************************************************************
* File and directory functions
......
......@@ -32,7 +32,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/*****************************************************************************
* Module descriptor
......
......@@ -29,7 +29,7 @@
#include <vlc_common.h>
#include <vlc_md5.h>
#include "libmp4.h"
#include <vlc_charset.h>
#include <vlc_fs.h>
#ifdef WIN32
# include <io.h>
......
......@@ -39,7 +39,6 @@
#include <vlc_codecs.h>
#include <vlc_bits.h>
#include <vlc_charset.h>
#include "vorbis.h"
#include "kate_categories.h"
......
......@@ -30,7 +30,6 @@
#include <vlc_common.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include "playlist.h"
......
......@@ -31,7 +31,6 @@
#include <vlc_common.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include "playlist.h"
......
......@@ -36,7 +36,6 @@
#include <vlc_memory.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include "asademux.h"
......
......@@ -43,6 +43,7 @@
#include <vlc_iso_lang.h>
#include <vlc_network.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include "../mux/mpeg/csa.h"
......
......@@ -36,7 +36,6 @@
#include <limits.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include "ps.h"
#include "vobsub.h"
......
......@@ -21,6 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <vlc_charset.h>
static inline void vorbis_ParseComment( vlc_meta_t **pp_meta, const uint8_t *p_data, int i_data )
{
int n;
......
......@@ -31,7 +31,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <stdlib.h> /* free() */
#include <string.h> /* strerror() */
......
......@@ -32,9 +32,6 @@
#include <vlc_playlist.h>
#include "../utils/ustring.hpp"
#include <vlc_charset.h>
Playtree::Playtree( intf_thread_t *pIntf ): VarTree( pIntf )
{
// Get the VLC playlist object
......
......@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_playlist.h>
#include <vlc_art_finder.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_url.h>
#ifdef HAVE_SYS_STAT_H
......
......@@ -30,7 +30,7 @@
#include <vlc_common.h>
#include <vlc_codec.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
......
......@@ -52,6 +52,7 @@
#include <vlc_tls.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_block.h>
#include <gcrypt.h>
......
......@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <assert.h>
......
......@@ -34,7 +34,6 @@
#include <vlc_demux.h>
#include <vlc_url.h>
#include <vlc_strings.h>
#include <vlc_charset.h>
#include "vlc.h"
#include "libs.h"
......
......@@ -34,7 +34,6 @@
#include <vlc_common.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_interface.h>
#include <vlc_playlist.h>
......
......@@ -34,7 +34,6 @@
#include <vlc_common.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_playlist.h>
......
......@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_aout.h>
#include <lua.h> /* Low level lua C API */
......
......@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_aout.h>
#include <vlc_interface.h>
#include <vlc_keys.h>
......
......@@ -35,6 +35,7 @@
#include <vlc_common.h>
#include <vlc_network.h>
#include <vlc_url.h>
#include <vlc_fs.h>
#include <lua.h> /* Low level lua C API */
#include <lauxlib.h> /* Higher level C API */
......
......@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_aout.h>
#include <lua.h> /* Low level lua C API */
......
......@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_aout.h>
#include <lua.h> /* Low level lua C API */
......
......@@ -36,7 +36,6 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_aout.h>
#include <lua.h> /* Low level lua C API */
......
......@@ -42,7 +42,6 @@
#include <vlc_url.h>
#include <vlc_strings.h>
#include <vlc_stream.h>
#include <vlc_charset.h>
#include "vlc.h"
#include "libs.h"
......
......@@ -39,6 +39,7 @@
#include <vlc_plugin.h>
#include <vlc_meta.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_aout.h>
#include <vlc_services_discovery.h>
#include <sys/stat.h>
......
......@@ -35,7 +35,6 @@
#include <vlc_url.h>
#include <vlc_strings.h>
#include <vlc_stream.h>
#include <vlc_charset.h>
#include <lua.h> /* Low level lua C API */
#include <lauxlib.h> /* Higher level C API */
......
......@@ -31,7 +31,7 @@
#include <vlc_common.h>
#include <vlc_osd.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <limits.h>
......
......@@ -33,7 +33,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_inhibit.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <sys/types.h>
#include <sys/wait.h>
......
......@@ -31,7 +31,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_vout.h>
#include <vlc_osd.h>
#include <vlc_block.h>
......
......@@ -32,7 +32,7 @@
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_url.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_services_discovery.h>
#include <sys/stat.h>
......
......@@ -27,7 +27,6 @@
#include <vlc_common.h>
#include <vlc_playlist.h>
#include <vlc_plugin.h>
#include <vlc_charset.h>
#include <vlc_interface.h>
#include <vlc_services_discovery.h>
......
......@@ -34,7 +34,7 @@
#include <assert.h>
#include <vlc_stream.h>
#include <vlc_input.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/*****************************************************************************
......
......@@ -39,6 +39,7 @@
#include <vlc_network.h>
#include <vlc_strings.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_gcrypt.h>
#include <vlc_es.h>
#include <vlc_http.h>
......
......@@ -35,7 +35,7 @@
#include <vlc_plugin.h>
#include <vlc_block.h>
#include <vlc_sout.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <assert.h>
/*****************************************************************************
......
......@@ -37,7 +37,7 @@
#include <vlc_httpd.h>
#include <vlc_url.h>
#include <vlc_network.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_strings.h>
#include <vlc_rand.h>
#ifdef HAVE_SRTP
......
......@@ -39,7 +39,7 @@
#include <vlc_block.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <vlc_network.h>
#define HAVE_MMX
......
......@@ -34,7 +34,7 @@
#include <vlc_vout.h>
#include <vlc_filter.h>
#include <vlc_osd.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
#include <ctype.h>
#include <fcntl.h>
......
......@@ -41,7 +41,6 @@
#include <vlc_filter.h>
#include "filter_common.h"
#include <vlc_charset.h>
#include <vlc_image.h>
#include <vlc_input.h>
#include <vlc_playlist.h>
......
......@@ -46,7 +46,7 @@
#include <vlc_plugin.h>
#include <vlc_vout_display.h>
#include <vlc_picture_pool.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/*****************************************************************************
* Module descriptor
......
......@@ -45,7 +45,7 @@
#include <vlc_vout.h>
#include <vlc_vout_window.h>
#include <vlc_playlist.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/*****************************************************************************
* Local prototypes
......
......@@ -33,7 +33,7 @@
#include <vlc_plugin.h>
#include <vlc_vout_display.h>
#include <vlc_picture_pool.h>
#include <vlc_charset.h>
#include <vlc_fs.h>
/*****************************************************************************
* Module descriptor
......
......@@ -65,6 +65,7 @@ pluginsinclude_HEADERS = \
../include/vlc_events.h \
../include/vlc_filter.h \
../include/vlc_fourcc.h \
../include/vlc_fs.h \
../include/vlc_gcrypt.h \
../include/vlc_http.h \
../include/vlc_httpd.h \
......