diff options
| author | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 22:52:46 +0300 | 
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@iki.fi> | 2015-10-03 22:52:46 +0300 | 
| commit | c0dffb7c577b03ff63871b5d13be15f230a010a3 (patch) | |
| tree | db297417e9189af01926d6f2a7d36a825aa2c403 | |
| parent | 935d30ce2fe76380e1b126ccd6ff439162888fb5 (diff) | |
use strings instead of char*
| -rw-r--r-- | libkms++/drmobject.cpp | 4 | ||||
| -rw-r--r-- | libkms++/drmobject.h | 2 | ||||
| -rw-r--r-- | libkms++/dumbframebuffer.cpp | 2 | ||||
| -rw-r--r-- | libkms++/dumbframebuffer.h | 2 | ||||
| -rw-r--r-- | libkms++/property.cpp | 9 | ||||
| -rw-r--r-- | libkms++/property.h | 3 | 
6 files changed, 13 insertions, 9 deletions
| diff --git a/libkms++/drmobject.cpp b/libkms++/drmobject.cpp index 69ea86e..0e43f69 100644 --- a/libkms++/drmobject.cpp +++ b/libkms++/drmobject.cpp @@ -56,11 +56,11 @@ uint64_t DrmObject::get_prop_value(uint32_t id) const  	return m_prop_values.at(id);  } -uint64_t DrmObject::get_prop_value(const char *name) const +uint64_t DrmObject::get_prop_value(const string& name) const  {  	for (auto pair : m_prop_values) {  		auto prop = card().get_prop(pair.first); -		if (strcmp(name, prop->name()) == 0) +		if (name == prop->name())  			return m_prop_values.at(prop->id());  	} diff --git a/libkms++/drmobject.h b/libkms++/drmobject.h index f179191..5e2a28c 100644 --- a/libkms++/drmobject.h +++ b/libkms++/drmobject.h @@ -25,7 +25,7 @@ public:  	void refresh_props();  	uint64_t get_prop_value(uint32_t id) const; -	uint64_t get_prop_value(const char *name) const; +	uint64_t get_prop_value(const std::string& name) const;  protected:  	DrmObject(Card& card, uint32_t object_type); diff --git a/libkms++/dumbframebuffer.cpp b/libkms++/dumbframebuffer.cpp index 285803f..0defd3a 100644 --- a/libkms++/dumbframebuffer.cpp +++ b/libkms++/dumbframebuffer.cpp @@ -17,7 +17,7 @@ using namespace std;  namespace kms  { -DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, const char* fourcc) +DumbFramebuffer::DumbFramebuffer(Card &card, uint32_t width, uint32_t height, const string& fourcc)  	:Framebuffer(card, width, height)  {  	uint32_t a, b, c, d; diff --git a/libkms++/dumbframebuffer.h b/libkms++/dumbframebuffer.h index e7cafb6..24e791a 100644 --- a/libkms++/dumbframebuffer.h +++ b/libkms++/dumbframebuffer.h @@ -7,7 +7,7 @@ namespace kms  class DumbFramebuffer : public Framebuffer  {  public: -	DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const char* fourcc); +	DumbFramebuffer(Card& card, uint32_t width, uint32_t height, const std::string& fourcc);  	virtual ~DumbFramebuffer();  	void print_short() const; diff --git a/libkms++/property.cpp b/libkms++/property.cpp index af6a0ae..e01bf60 100644 --- a/libkms++/property.cpp +++ b/libkms++/property.cpp @@ -3,6 +3,8 @@  #include "kms++.h" +using namespace std; +  namespace kms  { @@ -16,6 +18,7 @@ Property::Property(Card& card, uint32_t id)  {  	m_priv = new PropertyPriv();  	m_priv->drm_prop = drmModeGetProperty(card.fd(), id); +	m_name = m_priv->drm_prop->name;  }  Property::~Property() @@ -26,11 +29,11 @@ Property::~Property()  void Property::print_short() const  { -	printf("Property %d, %s\n", id(), name()); +	printf("Property %d, %s\n", id(), name().c_str());  } -const char *Property::name() const +const string& Property::name() const  { -	return m_priv->drm_prop->name; +	return m_name;  }  } diff --git a/libkms++/property.h b/libkms++/property.h index 24d2ae9..ffab8d0 100644 --- a/libkms++/property.h +++ b/libkms++/property.h @@ -13,12 +13,13 @@ class Property : public DrmObject  public:  	void print_short() const; -	const char *name() const; +	const std::string& name() const;  private:  	Property(Card& card, uint32_t id);  	~Property();  	PropertyPriv* m_priv; +	std::string m_name;  };  } | 
