vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Mon Jul 11 18:49:19 2011 +0300| [2e92359b381db4bd8f1fce7e6360bebc6f44d7c7] | committer: Rémi Denis-Courmont
make_URI: use vlc_getcwd() This lifts the PATH_MAX characters limit, and should fix encoding on POSIX non-UTF-8 systems. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2e92359b381db4bd8f1fce7e6360bebc6f44d7c7 --- src/text/strings.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/text/strings.c b/src/text/strings.c index 830d8c4..ca56bcc 100644 --- a/src/text/strings.c +++ b/src/text/strings.c @@ -47,6 +47,7 @@ #include <vlc_strings.h> #include <vlc_url.h> #include <vlc_charset.h> +#include <vlc_fs.h> #include <libvlc.h> #include <errno.h> @@ -1129,13 +1130,15 @@ char *make_URI (const char *path, const char *scheme) else if (path[0] != DIR_SEP_CHAR) { /* Relative path: prepend the current working directory */ - char cwd[PATH_MAX]; + char *cwd, *ret; - if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */ + if ((cwd = vlc_getcwd ()) == NULL) return NULL; - if (asprintf (&buf, "%s/%s", cwd, path) == -1) - return NULL; - char *ret = make_URI (buf, scheme); + if (asprintf (&buf, "%s"DIR_SEP"%s", cwd, path) == -1) + buf = NULL; + + free (cwd); + ret = (buf != NULL) ? make_URI (buf, scheme) : NULL; free (buf); return ret; } _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
