Skip to content

Commit

Permalink
rar: Fix caching problem with RAR index archive
Browse files Browse the repository at this point in the history
The in-memory RAR archive incorrectly thought that a fileref
to the RAR root was not the same archive as a fileref further down in
the RAR archive. This lead to performance issues when browsing RAR
archives.
  • Loading branch information
andoma committed Apr 30, 2011
1 parent 8ce6a91 commit 603cef5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/fileaccess/fa_rar.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,13 +480,17 @@ rar_archive_find(const char *url, const char **rp)
hts_mutex_lock(&rar_global_mutex);

u = mystrdupa(url);
while((s = strrchr(u, '/')) != NULL) {
*s = 0;
LIST_FOREACH(ra, &rar_archives, ra_link)

while(1) {
LIST_FOREACH(ra, &rar_archives, ra_link) {
if(!strcasecmp(ra->ra_url, u))
break;
}
if(ra != NULL)
break;
if((s = strrchr(u, '/')) == NULL)
break;
*s = 0;
}

if(ra == NULL) {
Expand Down

0 comments on commit 603cef5

Please sign in to comment.