Browse Source

Prettifyed the code exploiting inheritance rules

added missing comma, added missing `override`

--HG--
branch : minor
Raidho 8 years ago
parent
commit
8572a33880

+ 1 - 1
src/modules/filesystem/FileData.cpp

@@ -79,7 +79,7 @@ FileData::~FileData()
 	delete [] data;
 }
 
-Data *FileData::clone() const
+FileData *FileData::clone() const
 {
 	return new FileData(*this);
 }

+ 1 - 1
src/modules/filesystem/FileData.h

@@ -45,7 +45,7 @@ public:
 	virtual ~FileData();
 
 	// Implements Data.
-	Data *clone() const;
+	FileData *clone() const;
 	void *getData() const;
 	size_t getSize() const;
 

+ 1 - 1
src/modules/filesystem/wrap_FileData.cpp

@@ -35,7 +35,7 @@ FileData *luax_checkfiledata(lua_State *L, int idx)
 int w_FileData_clone(lua_State *L)
 {
 	FileData *t = luax_checkfiledata(L, 1), *c = nullptr;
-	luax_catchexcept(L, [&](){ c = (FileData*)t->clone(); });
+	luax_catchexcept(L, [&](){ c = t->clone(); });
 	luax_pushtype(L, c);
 	c->release();
 	return 1;

+ 1 - 1
src/modules/font/GlyphData.cpp

@@ -66,7 +66,7 @@ GlyphData::~GlyphData()
 	delete[] data;
 }
 
-Data *GlyphData::clone() const
+GlyphData *GlyphData::clone() const
 {
 	return new GlyphData(*this);
 }

+ 1 - 1
src/modules/font/GlyphData.h

@@ -63,7 +63,7 @@ public:
 	virtual ~GlyphData();
 
 	// Implements Data.
-	Data *clone() const;
+	GlyphData *clone() const;
 	void *getData() const;
 	size_t getSize() const;
 

+ 1 - 1
src/modules/font/wrap_GlyphData.cpp

@@ -33,7 +33,7 @@ GlyphData *luax_checkglyphdata(lua_State *L, int idx)
 int w_GlyphData_clone(lua_State *L)
 {
 	GlyphData *t = luax_checkglyphdata(L, 1), *c = nullptr;
-	luax_catchexcept(L, [&](){ c = (GlyphData*)t->clone(); });
+	luax_catchexcept(L, [&](){ c = t->clone(); });
 	luax_pushtype(L, c);
 	c->release();
 	return 1;

+ 1 - 1
src/modules/image/CompressedImageData.h

@@ -59,7 +59,7 @@ public:
 	virtual ~CompressedImageData();
 
 	// Implements Data.
-	virtual Data *clone() const = 0;
+	virtual CompressedImageData *clone() const = 0;
 	virtual void *getData() const;
 	virtual size_t getSize() const;
 

+ 1 - 1
src/modules/image/ImageData.h

@@ -128,7 +128,7 @@ public:
 	love::thread::Mutex *getMutex() const;
 
 	// Implements Data.
-	virtual Data *clone() const = 0;
+	virtual ImageData *clone() const = 0;
 	virtual void *getData() const;
 	virtual size_t getSize() const;
 

+ 1 - 1
src/modules/image/magpie/CompressedImageData.cpp

@@ -82,7 +82,7 @@ CompressedImageData::CompressedImageData(const CompressedImageData &c)
 	}
 }
 
-Data *CompressedImageData::clone() const
+CompressedImageData *CompressedImageData::clone() const
 {
 	return new CompressedImageData(*this);
 }

+ 1 - 1
src/modules/image/magpie/CompressedImageData.h

@@ -44,7 +44,7 @@ public:
 	CompressedImageData(const CompressedImageData &c);
 	virtual ~CompressedImageData();
 
-	virtual Data *clone() const;
+	virtual CompressedImageData *clone() const;
 }; // CompressedImageData
 
 } // magpie

+ 1 - 1
src/modules/image/magpie/ImageData.cpp

@@ -103,7 +103,7 @@ ImageData::~ImageData()
 		handler->release();
 }
 
-Data *ImageData::clone() const
+ImageData *ImageData::clone() const
 {
 	return new ImageData(*this);
 }

+ 1 - 1
src/modules/image/magpie/ImageData.h

@@ -45,7 +45,7 @@ public:
 	ImageData(const ImageData &c);
 	virtual ~ImageData();
 
-	virtual Data *clone() const;
+	virtual ImageData *clone() const;
 	// Implements image::ImageData.
 	virtual love::filesystem::FileData *encode(EncodedFormat encodedFormat, const char *filename);
 

+ 1 - 1
src/modules/image/wrap_CompressedImageData.cpp

@@ -34,7 +34,7 @@ CompressedImageData *luax_checkcompressedimagedata(lua_State *L, int idx)
 int w_CompressedImageData_clone(lua_State *L)
 {
 	CompressedImageData *t = luax_checkcompressedimagedata(L, 1), *c = nullptr;
-	luax_catchexcept(L, [&](){ c = (CompressedImageData *)t->clone(); }); 
+	luax_catchexcept(L, [&](){ c = t->clone(); }); 
 	luax_pushtype(L, c);
 	c->release();
 	return 1;

+ 1 - 1
src/modules/image/wrap_ImageData.cpp

@@ -46,7 +46,7 @@ ImageData *luax_checkimagedata(lua_State *L, int idx)
 int w_ImageData_clone(lua_State *L)
 {
 	ImageData *t = luax_checkimagedata(L, 1), *c = nullptr;
-	luax_catchexcept(L, [&](){ c = (ImageData*)t->clone(); });
+	luax_catchexcept(L, [&](){ c = t->clone(); });
 	luax_pushtype(L, c);
 	c->release();
 	return 1;

+ 1 - 1
src/modules/math/CompressedData.cpp

@@ -74,7 +74,7 @@ CompressedData::~CompressedData()
 	delete[] data;
 }
 
-Data *CompressedData::clone() const
+CompressedData *CompressedData::clone() const
 {
 	return new CompressedData(*this);
 }

+ 1 - 1
src/modules/math/CompressedData.h

@@ -58,7 +58,7 @@ public:
 	size_t getDecompressedSize() const;
 
 	// Implements Data.
-	Data *clone() const;
+	CompressedData *clone() const override;
 	void *getData() const override;
 	size_t getSize() const override;
 

+ 1 - 1
src/modules/math/wrap_CompressedData.cpp

@@ -35,7 +35,7 @@ CompressedData *luax_checkcompresseddata(lua_State *L, int idx)
 int w_CompressedData_clone(lua_State *L)
 {
 	CompressedData *t = luax_checkcompresseddata(L, 1), *c = nullptr;
-	luax_catchexcept(L, [&](){ c = (CompressedData *)t->clone(); });
+	luax_catchexcept(L, [&](){ c = t->clone(); });
 	luax_pushtype(L, c);
 	c->release();
 	return 1;

+ 1 - 1
src/modules/sound/SoundData.cpp

@@ -124,7 +124,7 @@ SoundData::~SoundData()
 		free(data);
 }
 
-Data *SoundData::clone() const
+SoundData *SoundData::clone() const
 {
 	return new SoundData(*this);
 }

+ 1 - 1
src/modules/sound/SoundData.h

@@ -45,7 +45,7 @@ public:
 	virtual ~SoundData();
 
 	// Implements Data.
-	Data *clone() const;
+	SoundData *clone() const;
 	void *getData() const;
 	size_t getSize() const;
 

+ 2 - 2
src/modules/sound/wrap_SoundData.cpp

@@ -44,8 +44,8 @@ SoundData *luax_checksounddata(lua_State *L, int idx)
 
 int w_SoundData_clone(lua_State *L)
 {
-	SoundData *t = luax_checksounddata(L, 1)*c = nullptr;
-	luax_catchexcept(L, [&](){ c = (SoundData*)t->clone(); });
+	SoundData *t = luax_checksounddata(L, 1), *c = nullptr;
+	luax_catchexcept(L, [&](){ c = t->clone(); });
 	luax_pushtype(L, c);
 	c->release();
 	return 1;