Commit ded8718c authored by Murray Cumming's avatar Murray Cumming

Script::add_search_paths(): Use std::string for filepaths.

* clutter/src/script.[hg|ccg]:
  Also avoid this g++ compiler warning:
  ISO C++ forbids variable length array 'searchPaths' [-Werror=vla]

  This shows the need for this patch in cogl to avoid a warning:
  https://bugzilla.gnome.org/show_bug.cgi?id=728022
parent f09424e5
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
*/ */
#include <clutter/clutter.h> #include <clutter/clutter.h>
#include <glibmm/vectorutils.h>
namespace Clutter namespace Clutter
{ {
...@@ -39,17 +40,10 @@ guint Script::load_from_data(const Glib::ustring& data, std::auto_ptr<Glib::Erro ...@@ -39,17 +40,10 @@ guint Script::load_from_data(const Glib::ustring& data, std::auto_ptr<Glib::Erro
return result; return result;
} }
void Script::add_search_paths(const std::vector<Glib::ustring>& paths) void Script::add_search_paths(const std::vector<std::string>& paths)
{ {
const int pathCount = paths.size(); clutter_script_add_search_paths(gobj(),
const char* searchPaths[pathCount]; Glib::ArrayHandler<std::string>::vector_to_array(paths).data(), paths.size());
for(uint i = 0; i < paths.size(); ++i)
{
searchPaths[i] = paths[i].data();
}
clutter_script_add_search_paths(gobj(), searchPaths, paths.size());
} }
std::vector<Glib::RefPtr<Glib::Object> > Script::list_objects() std::vector<Glib::RefPtr<Glib::Object> > Script::list_objects()
......
...@@ -46,8 +46,16 @@ public: ...@@ -46,8 +46,16 @@ public:
#endif #endif
_WRAP_METHOD(guint load_from_file(const std::string& filename), clutter_script_load_from_file, errthrow) _WRAP_METHOD(guint load_from_file(const std::string& filename), clutter_script_load_from_file, errthrow)
/** Adds paths to the list of search paths held by the Script .
* The search paths are used by lookup_filename(), which can be used to define
* search paths for the textures source file name or other custom, file-based
* properties.
*
* @param Search paths.
*/
void add_search_paths(const std::vector<std::string>& paths);
_IGNORE(clutter_script_add_search_paths) _IGNORE(clutter_script_add_search_paths)
void add_search_paths(const std::vector<Glib::ustring>& paths);
_WRAP_METHOD(Glib::ustring lookup_filename(const Glib::ustring& filename), clutter_script_lookup_filename) _WRAP_METHOD(Glib::ustring lookup_filename(const Glib::ustring& filename), clutter_script_lookup_filename)
/** Get a RefPtr to an object from the ClutterScript JSON file. /** Get a RefPtr to an object from the ClutterScript JSON file.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment