mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-16 20:39:15 +01:00
Some fixes: Maximize constness, correct fromDump and remove
unnecessary parameters
This commit is contained in:
parent
293e53bbe8
commit
60829984c7
@ -8,7 +8,7 @@
|
||||
#define VERSION_BASE (0x1978)
|
||||
#define VERSION_MAGIC (VERSION_BASE + 0)
|
||||
|
||||
GameInfo::GameInfo(char *name, char *author, SDL_Surface *image)
|
||||
GameInfo::GameInfo(const char *name, const char *author, SDL_Surface *image)
|
||||
{
|
||||
this->name = name;
|
||||
this->author = author;
|
||||
@ -22,8 +22,8 @@ GameInfo::~GameInfo()
|
||||
|
||||
void GameInfo::resetDefaults()
|
||||
{
|
||||
free(this->name);
|
||||
free(this->author);
|
||||
free((void*)this->name);
|
||||
free((void*)this->author);
|
||||
SDL_FreeSurface(this->screenshot);
|
||||
|
||||
this->name = NULL;
|
||||
@ -31,14 +31,14 @@ void GameInfo::resetDefaults()
|
||||
this->screenshot = NULL;
|
||||
}
|
||||
|
||||
struct game_info *GameInfo::dump(size_t *out_sz)
|
||||
struct game_info *GameInfo::dump()
|
||||
{
|
||||
size_t total_sz = sizeof(struct game_info);
|
||||
size_t png_sz;
|
||||
struct game_info *out;
|
||||
void *png_data;
|
||||
|
||||
if (this->screenshot)
|
||||
if (!this->screenshot)
|
||||
return NULL;
|
||||
|
||||
/* Convert surface to PNG */
|
||||
@ -73,7 +73,7 @@ struct game_info *GameInfo::dump(size_t *out_sz)
|
||||
return out;
|
||||
}
|
||||
|
||||
void GameInfo::fromDump(struct game_info *gi, size_t sz)
|
||||
void GameInfo::fromDump(struct game_info *gi)
|
||||
{
|
||||
SDL_RWops *rw;
|
||||
|
||||
|
10
game_info.hh
10
game_info.hh
@ -16,21 +16,21 @@ struct game_info
|
||||
class GameInfo
|
||||
{
|
||||
public:
|
||||
GameInfo(char *name = NULL, char *author = NULL, SDL_Surface *image = NULL);
|
||||
GameInfo(const char *name = NULL, const char *author = NULL, SDL_Surface *image = NULL);
|
||||
|
||||
~GameInfo();
|
||||
|
||||
void resetDefaults();
|
||||
|
||||
/** Returns an allocated dump structure */
|
||||
struct game_info *dump(size_t *out_sz);
|
||||
struct game_info *dump();
|
||||
|
||||
/** Fill in this game info object from a structure */
|
||||
void fromDump(struct game_info *data, size_t sz);
|
||||
void fromDump(struct game_info *data);
|
||||
|
||||
protected:
|
||||
char *name;
|
||||
char *author;
|
||||
const char *name;
|
||||
const char *author;
|
||||
SDL_Surface *screenshot;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user