hrev47955 adds 1 changeset to branch 'master' old head: bcec5d75184178c7962a3cf253831f0132796df1 new head: f262f1b66e32205eff6725ae88a0541bc78fc4f2 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=f262f1b+%5Ebcec5d7 ---------------------------------------------------------------------------- f262f1b: Media Preflet: Use BPathFinder::FindPaths() instead of the C method. This way we can use BStringList and get rid of the manual deallocation. [ Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47955 Commit: f262f1b66e32205eff6725ae88a0541bc78fc4f2 URL: http://cgit.haiku-os.org/haiku/commit/?id=f262f1b Author: Stefano Ceccherini <stefano.ceccherini@xxxxxxxxx> Date: Thu Oct 2 20:28:28 2014 UTC ---------------------------------------------------------------------------- 1 file changed, 9 insertions(+), 10 deletions(-) src/preferences/media/MidiSettingsView.cpp | 19 +++++++++---------- ---------------------------------------------------------------------------- diff --git a/src/preferences/media/MidiSettingsView.cpp b/src/preferences/media/MidiSettingsView.cpp index 340b2d0..2ea0143 100644 --- a/src/preferences/media/MidiSettingsView.cpp +++ b/src/preferences/media/MidiSettingsView.cpp @@ -17,10 +17,12 @@ #include <Node.h> #include <NodeInfo.h> #include <Path.h> +#include <PathFinder.h> #include <ScrollView.h> +#include <StringList.h> #include <stdio.h> -#include <stdlib.h> + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "Midi View" @@ -89,17 +91,16 @@ MidiSettingsView::MessageReceived(BMessage* message) void MidiSettingsView::_RetrieveSoftSynthList() { - char **paths = NULL; - size_t pathCount = 0; - status_t status = find_paths(B_FIND_PATH_DATA_DIRECTORY, "synth", - &paths, &pathCount); + BStringList paths; + status_t status = BPathFinder::FindPaths(B_FIND_PATH_DATA_DIRECTORY, + "synth", paths); if (status != B_OK) return; fListView->MakeEmpty(); - for (size_t i = 0; i < pathCount; i++) { - BDirectory directory(paths[i]); + for (int32 i = 0; i < paths.CountStrings(); i++) { + BDirectory directory(paths.StringAt(i).String()); BEntry entry; if (directory.InitCheck() != B_OK) continue; @@ -115,14 +116,12 @@ MidiSettingsView::_RetrieveSoftSynthList() // TODO: For some reason this doesn't work if (nodeInfo.GetType(mimeType) == B_OK /*&& !strcmp(mimeType, "audio/x-soundfont")*/) { - BPath fullPath = paths[i]; + BPath fullPath = paths.StringAt(i).String(); fullPath.Append(entry.Name()); fListView->AddItem(new BStringItem(fullPath.Path())); } } } - - free(paths); }