#include <stdlib.h>
#include <stdbool.h>
-#ifdef HAVE_SETLOCALE
-# include <locale.h>
-#endif
-
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
{ NULL, no_argument, NULL, '\0'}
};
-#ifdef HAVE_SETLOCALE
- setlocale (LC_CTYPE, ""); /* needed by FromLocale() */
-#endif
-
int c;
bool force = false;
#include <libgnomevfs/gnome-vfs.h>
-
-#include <vlc_charset.h>
#include <vlc_url.h>
/*****************************************************************************
access_t *p_access = (access_t*)p_this;
access_sys_t *p_sys = NULL;
char *psz_name = NULL;
- char *psz = NULL;
char *psz_uri = NULL;
char *psz_unescaped = NULL;
char *psz_expand_tilde = NULL;
{
psz_name = strdup( p_access->psz_location );
}
- psz = ToLocale( psz_name );
- psz_expand_tilde = gnome_vfs_expand_initial_tilde( psz );
- LocaleFree( psz );
+ psz_expand_tilde = gnome_vfs_expand_initial_tilde( psz_name );
psz_unescaped = gnome_vfs_make_uri_from_shell_arg( psz_expand_tilde );
#include <vlc_plugin.h>
#include <vlc_demux.h> /* demux_meta_t */
#include <vlc_strings.h> /* vlc_b64_decode_binary */
-#include <vlc_charset.h> /* ToLocale, LocaleFree */
#include <vlc_input.h> /* for attachment_new */
#ifdef WIN32
f = FileRef( wpath );
free( wpath );
#else
- const char* local_name = ToLocale( psz_path );
- if( !local_name )
- {
- free( psz_path );
- return VLC_EGENERIC;
- }
- f = FileRef( local_name );
- LocaleFree( local_name );
+ f = FileRef( psz_path );
#endif
free( psz_path );
f = FileRef( wpath );
free( wpath );
#else
- const char* local_name = ToLocale( p_export->psz_file );
- if( !local_name )
- return VLC_EGENERIC;
- f = FileRef( local_name );
- LocaleFree( local_name );
+ f = FileRef( p_export->psz_file );
#endif
if( f.isNull() || !f.tag() || f.file()->readOnly() )
#endif
#include <vlc_common.h>
-#include <vlc_charset.h>
#include <stddef.h> /* size_t */
#include <string.h> /* strlen(), memcpy(), memset(), strchr() */
}
int ret;
- node = ToLocale (node);
#ifdef WIN32
/*
* Winsock tries to resolve numerical IPv4 addresses as AAAA
#if defined(AI_IDN) || defined(WIN32)
out:
#endif
- LocaleFree (node);
return ret;
}
#include <vlc_common.h>
#include "../libvlc.h"
-#include <vlc_charset.h>
#include <vlc_configuration.h>
#include "config/configuration.h"
if (home == NULL)
home = "/tmp";
- return FromLocaleDup (home);
+ return strdup (home);
}
static char *getAppDependentDir(vlc_userdir_t type)
#include <vlc_common.h>
#include "../libvlc.h"
-#include <vlc_charset.h>
#include "config/configuration.h"
#include <unistd.h>
if (!home)
return NULL;
- return FromLocaleDup (home);
+ return strdup (home);
}
static char *config_GetAppDir (const char *xdg_name, const char *xdg_default)
/* XDG Base Directory Specification - Version 0.6 */
snprintf (var, sizeof (var), "XDG_%s_HOME", xdg_name);
- char *psz_home = FromLocale (getenv (var));
- if( psz_home )
+ const char *home = getenv (var);
+ if (home != NULL)
{
- if( asprintf( &psz_dir, "%s/vlc", psz_home ) == -1 )
+ if (asprintf (&psz_dir, "%s/vlc", home) == -1)
psz_dir = NULL;
- LocaleFree (psz_home);
return psz_dir;
}
- psz_home = config_GetHomeDir ();
+ char *psz_home = config_GetHomeDir ();
if( psz_home == NULL
|| asprintf( &psz_dir, "%s/%s/vlc", psz_home, xdg_default ) == -1 )
psz_dir = NULL;
path = strdup (home);
}
- char *ret = FromLocaleDup (path);
- free (path);
- return ret;
+ return path;
}
#include <sys/socket.h>
#include <vlc_common.h>
-#include <vlc_charset.h>
#include <vlc_fs.h>
#include "libvlc.h" /* vlc_mkdir */
flags |= O_CLOEXEC;
#endif
- const char *local_name = ToLocale (filename);
-
- if (local_name == NULL)
- {
- errno = ENOENT;
- return -1;
- }
-
- int fd = open (local_name, flags, mode);
+ int fd = open (filename, flags, mode);
if (fd != -1)
fcntl (fd, F_SETFD, FD_CLOEXEC);
-
- LocaleFree (local_name);
return fd;
}
flags |= O_CLOEXEC;
#endif
- const char *local_name = ToLocale (filename);
- if (local_name == NULL)
- {
- errno = ENOENT;
- return -1;
- }
-
#ifdef HAVE_OPENAT
- int fd = openat (dir, local_name, flags, mode);
+ int fd = openat (dir, filename, flags, mode);
if (fd != -1)
fcntl (fd, F_SETFD, FD_CLOEXEC);
#else
errno = ENOSYS;
(void) mode;
#endif
-
- LocaleFree (local_name);
return fd;
}
*/
int vlc_mkdir (const char *dirname, mode_t mode)
{
- char *locname = ToLocale (dirname);
- if (unlikely(locname == NULL))
- {
- errno = ENOENT;
- return -1;
- }
-
- int res = mkdir (locname, mode);
- LocaleFree (locname);
- return res;
+ return mkdir (dirname, mode);
}
/**
if (val != 0)
errno = val;
else if (ent != NULL)
-#ifndef __APPLE__
- path = FromLocaleDup (ent->d_name);
-#else
- path = FromCharset ("UTF-8-MAC", ent->d_name, strlen (ent->d_name));
-#endif
+ path = strdup (ent->d_name);
free (buf);
return path;
}
-static int vlc_statEx (const char *filename, struct stat *buf, bool deref)
-{
- const char *local_name = ToLocale (filename);
- if (unlikely(local_name == NULL))
- {
- errno = ENOENT;
- return -1;
- }
-
- int res = deref ? stat (local_name, buf)
- : lstat (local_name, buf);
- LocaleFree (local_name);
- return res;
-}
-
/**
* Finds file/inode information, as stat().
* Consider using fstat() instead, if possible.
*/
int vlc_stat (const char *filename, struct stat *buf)
{
- return vlc_statEx (filename, buf, true);
+ return stat (filename, buf);
}
/**
*/
int vlc_lstat (const char *filename, struct stat *buf)
{
- return vlc_statEx (filename, buf, false);
+ return lstat (filename, buf);
}
/**
*/
int vlc_unlink (const char *filename)
{
- const char *local_name = ToLocale (filename);
- if (unlikely(local_name == NULL))
- {
- errno = ENOENT;
- return -1;
- }
-
- int ret = unlink (local_name);
- LocaleFree (local_name);
- return ret;
+ return unlink (filename);
}
/**
*/
int vlc_rename (const char *oldpath, const char *newpath)
{
- const char *lo = ToLocale (oldpath);
- if (lo == NULL)
- goto error;
-
- const char *ln = ToLocale (newpath);
- if (ln == NULL)
- {
- LocaleFree (lo);
-error:
- errno = ENOENT;
- return -1;
- }
-
- int ret = rename (lo, ln);
- LocaleFree (lo);
- LocaleFree (ln);
- return ret;
+ return rename (oldpath, newpath);
}
/**
/* Make sure $PWD is correct */
if (stat (pwd, &s1) == 0 && stat (".", &s2) == 0
&& s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino)
- return ToLocaleDup (pwd);
+ return strdup (pwd);
}
/* Otherwise iterate getcwd() until the buffer is big enough */
break;
if (getcwd (buf, size) != NULL)
-#ifdef ASSUME_UTF8
return buf;
-#else
- {
- char *ret = ToLocaleDup (buf);
- free (buf);
- return ret; /* success */
- }
-#endif
free (buf);
if (errno != ERANGE)
#endif
#include <vlc_common.h>
-#include <vlc_charset.h>
#include "modules/modules.h"
#include <sys/types.h>
* Load a dynamically linked library using a system dependent method.
*
* \param p_this vlc object
- * \param psz_file library file
+ * \param path library file
* \param p_handle the module handle returned
* \return 0 on success as well as the module handle.
*/
-int module_Load( vlc_object_t *p_this, const char *psz_file,
- module_handle_t *p_handle, bool lazy )
+int module_Load (vlc_object_t *p_this, const char *path,
+ module_handle_t *p_handle, bool lazy)
{
#if defined (RTLD_NOW)
const int flags = lazy ? RTLD_LAZY : RTLD_NOW;
#else
const int flags = 0;
#endif
- char *path = ToLocale( psz_file );
- module_handle_t handle = dlopen( path, flags );
+ module_handle_t handle = dlopen (path, flags);
if( handle == NULL )
{
msg_Warn( p_this, "cannot load module `%s' (%s)", path, dlerror() );
- LocaleFree( path );
return -1;
}
- LocaleFree( path );
*p_handle = handle;
return 0;
}