fixed compilation problems

git-svn-id: svn://anubis/misc/FileLoader@178 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2009-10-17 21:24:16 +00:00
parent be0c3909d1
commit 992776704d

View File

@ -13,11 +13,10 @@ class FileLoader
public: public:
std::string fullPath; std::string fullPath;
std::string shortPath; std::string shortPath;
Path() { }
Path(const std::string & full_path, Path(const std::string & full_path,
const std::string & short_path) const std::string & short_path)
: fullPath(full_path), shortPath(short_path) : fullPath(full_path), shortPath(short_path) { }
{
}
}; };
class Buffer class Buffer
@ -32,23 +31,22 @@ class FileLoader
_refcnt = new int; _refcnt = new int;
*_refcnt = 1; *_refcnt = 1;
} }
Buffer(const Buffer & other) void copy(const Buffer & other)
{ {
data = other.data; data = other.data;
_refcnt = other._refcnt; _refcnt = other._refcnt;
(*refcnt)++; (*_refcnt)++;
} }
Buffer & operator=(Buffer & me, const Buffer & other) Buffer(const Buffer & other) { copy(other); }
Buffer & operator=(const Buffer & other)
{ {
me.data = other.data; copy(other);
me._refcnt = other._refcnt; return *this;
(*me_.refcnt)++;
return me;
} }
~Buffer() ~Buffer()
{ {
(*_refcnt)--; (*_refcnt)--;
if (*refcnt < 1) if (*_refcnt < 1)
{ {
delete _refcnt; delete _refcnt;
delete data; delete data;