[haiku-development] Re: New Diff to Media player

Fredrik Modéen <fredrik@xxxxxxxxx> wrote:
> > 3) it makes more sense to pass a BString reference to this method,
> > as
> > you'll then save an unnecessary copy.
> and perhaps to _IsMedia and _IsPlayList aswell as I only are sending
> them
> to ReturnMIMEString.

If you can keep the info around easily for both calls that would indeed
be better.

> My Question are if making a BString are better than sending an
> existing
> entry_ref? I need the path to the file and the only way I found
> getting
> that was to make a BPath() and then call Path() to get a string. Can
> change
> ReturnMIMEString,  _IsMedia and _IsPlayList to take const char*
> insted of
> a BString.

Why would those methods need a path? If you want to check for the
suffix, the name of the file is enough, you don't need the path for
that (entry_ref::name, BEntry::GetName()).
Also, converting an entry to its full path (and back) isn't a cheap
operation.

Bye,
   Axel.


Other related posts: