X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faccess%2Fdirectory.c;h=8ca478176ad08fe3522f67ebe2d865b2746782ff;hb=eb9b54c8eeba73cff04e44af8d3dd8d4ad05e3db;hp=dd04b6a65f8b34b3b9b112f8710e33de38917df7;hpb=a1c9010bb45c5a0e4a8888e495b6055115391dbd;p=vlc diff --git a/modules/access/directory.c b/modules/access/directory.c index dd04b6a65f..8ca478176a 100644 --- a/modules/access/directory.c +++ b/modules/access/directory.c @@ -221,27 +221,6 @@ static void Close( vlc_object_t * p_this ) free (p_sys); } -/** - * URI-encodes a file path. The only reserved characters is slash. - */ -static char *encode_path (const char *path) -{ - static const char sep[]= "%2F"; - char *enc = encode_URI_component (path), *ptr = enc; - - if (enc == NULL) - return NULL; - - /* Replace '%2F' with '/'. TODO: extend encode_URI*() */ - /* (On Windows, both ':' and '\\' will be encoded) */ - while ((ptr = strstr (ptr, sep)) != NULL) - { - *ptr++ = '/'; - memmove (ptr, ptr + 2, strlen (ptr) - 1); - } - return enc; -} - /* Detect directories that recurse into themselves. */ static bool has_inode_loop (const directory_t *dir) { @@ -287,7 +266,7 @@ static block_t *Block (access_t *p_access) current->parent = NULL; current->handle = p_sys->handle; strcpy (current->path, p_access->psz_path); - current->uri = encode_path (current->path); + current->uri = make_URI (current->path); if ((current->uri == NULL) || fstat (dirfd (current->handle), ¤t->st)) { @@ -446,7 +425,7 @@ static block_t *Block (access_t *p_access) if (encoded == NULL) goto fatal; int len = asprintf (&entry, - " file://%s/%s\n" \ + " %s/%s\n" \ " \n" \ " %d\n" \ " \n" \ @@ -488,28 +467,22 @@ fatal: *****************************************************************************/ static int Control( access_t *p_access, int i_query, va_list args ) { - bool *pb_bool; - int64_t *pi_64; - switch( i_query ) { /* */ case ACCESS_CAN_SEEK: case ACCESS_CAN_FASTSEEK: - pb_bool = (bool*)va_arg( args, bool* ); - *pb_bool = false; + *va_arg( args, bool* ) = false; break; case ACCESS_CAN_PAUSE: case ACCESS_CAN_CONTROL_PACE: - pb_bool = (bool*)va_arg( args, bool* ); - *pb_bool = true; + *va_arg( args, bool* ) = true; break; /* */ case ACCESS_GET_PTS_DELAY: - pi_64 = (int64_t*)va_arg( args, int64_t * ); - *pi_64 = DEFAULT_PTS_DELAY * 1000; + *va_arg( args, int64_t * ) = DEFAULT_PTS_DELAY * 1000; break; /* */