Little code changes proposal.
Modern C++ stricter with member initialisation order. Destructor possibly throwing exception through assertions. In debug mode, pretty important memory leak with zip archives.
This commit is contained in:
parent
a5c8a59b51
commit
6ef18bd0cd
@ -26,7 +26,7 @@
|
||||
#include "IStream.h"
|
||||
|
||||
namespace spades {
|
||||
IStream::~IStream() {}
|
||||
IStream::~IStream() throw(Exception) {}
|
||||
int IStream::ReadByte() { SPUnsupported(); }
|
||||
|
||||
size_t IStream::Read(void *out, size_t bytes) {
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "Exception.h"
|
||||
|
||||
namespace spades {
|
||||
/** operation mode for data-compression streams. */
|
||||
enum CompressMode {
|
||||
@ -39,7 +41,7 @@ namespace spades {
|
||||
IStream() {}
|
||||
|
||||
public:
|
||||
virtual ~IStream();
|
||||
virtual ~IStream() throw(Exception);
|
||||
/** reads one byte and return in range [0, 255].
|
||||
* -1 if EOF reached. */
|
||||
virtual int ReadByte();
|
||||
|
@ -54,6 +54,11 @@ typedef unsigned __int32 uint32_t;
|
||||
|
||||
#define BIT(index) (1 << (index))
|
||||
|
||||
#ifdef htole16
|
||||
# undef htole16
|
||||
# undef letoh16
|
||||
#endif
|
||||
|
||||
#ifdef _BIG_ENDIAN
|
||||
# define htole16(x) ( (((x) & 0x00FF) << 8) | (((x) & 0xFF00) >> 8) )
|
||||
# define letoh16(x) htole16(x)
|
||||
|
@ -344,9 +344,6 @@ namespace spades {
|
||||
unzOpenCurrentFile(zip);
|
||||
try {
|
||||
currentStream = new ZipFileInputStream(this, zip);
|
||||
#if 0
|
||||
return currentStream;
|
||||
#else
|
||||
// load all data to allow seeking
|
||||
DynamicMemoryStream *stream;
|
||||
stream = new DynamicMemoryStream();
|
||||
@ -365,7 +362,6 @@ namespace spades {
|
||||
delete currentStream;
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
} catch (...) {
|
||||
unzCloseCurrentFile(zip);
|
||||
throw;
|
||||
|
@ -26,13 +26,13 @@ namespace spades {
|
||||
namespace draw {
|
||||
GLImage::GLImage(IGLDevice::UInteger texObj, IGLDevice *dev, float w, float h,
|
||||
bool autoDelete)
|
||||
: tex(texObj),
|
||||
device(dev),
|
||||
: device(dev),
|
||||
tex(texObj),
|
||||
width(w),
|
||||
height(h),
|
||||
autoDelete(autoDelete),
|
||||
invWidth(1.f / w),
|
||||
invHeight(1.f / h) {
|
||||
invHeight(1.f / h),
|
||||
autoDelete(autoDelete) {
|
||||
SPADES_MARK_FUNCTION();
|
||||
valid = true;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace spades {
|
||||
namespace draw {
|
||||
GLModelRenderer::GLModelRenderer(GLRenderer *r) : device(r->GetGLDevice()), renderer(r) {
|
||||
GLModelRenderer::GLModelRenderer(GLRenderer *r) : renderer(r), device(r->GetGLDevice()) {
|
||||
SPADES_MARK_FUNCTION();
|
||||
modelCount = 0;
|
||||
}
|
||||
|
@ -226,10 +226,10 @@ public:
|
||||
|
||||
Content( const _T &content, const Coord &coord, const Size &size, bool rotated )
|
||||
:
|
||||
content(content),
|
||||
rotated(rotated),
|
||||
coord(coord),
|
||||
size(size),
|
||||
rotated(rotated)
|
||||
content(content)
|
||||
{}
|
||||
|
||||
void Rotate() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user