-
Notifications
You must be signed in to change notification settings - Fork 11
Integrated UDA-Plugins api listFilledPaths #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
9f311c4
a1fece2
1f557dd
31d5a79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #ifndef AL_UTILITIES_H | ||
| #define AL_UTILITIES_H | ||
|
|
||
| /** | ||
| * General-purpose utility functions for the Access Layer. | ||
| */ | ||
|
|
||
| #include <vector> | ||
| #include <string> | ||
|
|
||
| namespace utilities { | ||
|
|
||
| /** | ||
| * Convert a vector of strings into a C-style array of strings. | ||
| * | ||
| * @param paths the vector of strings to convert | ||
| * @param path_list a pointer to the C-style array to create | ||
| * @param size a pointer to an integer to store the size of the created array | ||
| */ | ||
| void copy_stringvector_to_c_list(const std::vector<std::string>& paths, char*** path_list, int* size); | ||
|
|
||
| } // namespace utilities | ||
|
|
||
| #endif // AL_UTILITIES_H | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #include "al_utilities.h" | ||
|
|
||
| #include <cstdlib> | ||
| #include <cstring> | ||
|
|
||
| namespace utilities { | ||
|
|
||
| void copy_stringvector_to_c_list(const std::vector<std::string>& paths, char*** path_list, int* size) { | ||
| *size = static_cast<int>(paths.size()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you agree with my suggestion above, this will be size_t.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @paulotex for pointing out, I will test with required change and update.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @paulotex I checked your suggestion, this int* (for size) is inherited from al_low_level and has impact on all other backends. I would suggest to implement it in separate branch.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC I agree that casting from |
||
|
|
||
| if (*size == 0) { | ||
| *path_list = nullptr; | ||
| return; | ||
| } | ||
|
|
||
| *path_list = static_cast<char**>(malloc(*size * sizeof(char*))); | ||
| for (int i = 0; i < *size; ++i) { | ||
| (*path_list)[i] = strdup(paths[i].c_str()); | ||
| } | ||
| } | ||
| } // namespace utilities | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest size of type size_t*, not int*