int wildcard_expand_string(const wcstring &wc, const wcstring &base_dir, expand_flags_t flags, std::vector<completion_t> &outputs ) { // PCA: not convinced this temporary variable is really necessary std::vector<completion_t> lst; int res = wildcard_expand(wc.c_str(), base_dir.c_str(), flags, lst); outputs.insert(outputs.end(), lst.begin(), lst.end()); return res; }
int wildcard_expand_string(const wcstring &wc, const wcstring &base_dir, expand_flags_t flags, std::vector<completion_t> &outputs ) { std::vector<completion_t> lst; int res = wildcard_expand(wc.c_str(), base_dir.c_str(), flags, lst); outputs.insert(outputs.end(), lst.begin(), lst.end()); return res; }
int wildcard_expand_string(const wcstring &wc, const wcstring &base_dir, expand_flags_t flags, std::vector<completion_t> *output) { assert(output != NULL); /* Hackish fix for 1631. We are about to call c_str(), which will produce a string truncated at any embedded nulls. We could fix this by passing around the size, etc. However embedded nulls are never allowed in a filename, so we just check for them and return 0 (no matches) if there is an embedded null. This isn't quite right, e.g. it will fail for \0?, but that is an edge case. */ if (wc.find(L'\0') != wcstring::npos) { return 0; } return wildcard_expand(wc.c_str(), base_dir.c_str(), flags, output); }
int wildcard_expand_string(const wcstring &wc, const wcstring &base_dir, expand_flags_t flags, std::vector<completion_t> &outputs) { /* Hackish fix for 1631. We are about to call c_str(), which will produce a string truncated at any embedded nulls. We could fix this by passing around the size, etc. However embedded nulls are never allowed in a filename, so we just check for them and return 0 (no matches) if there is an embedded null. This isn't quite right, e.g. it will fail for \0?, but that is an edge case. */ if (wc.find(L'\0') != wcstring::npos) { return 0; } // PCA: not convinced this temporary variable is really necessary std::vector<completion_t> lst; int res = wildcard_expand(wc.c_str(), base_dir.c_str(), flags, lst); outputs.insert(outputs.end(), lst.begin(), lst.end()); return res; }