GCC warnings fix
This commit is contained in:
parent
50aa5fdc70
commit
cc556bc19b
@ -105,7 +105,11 @@ ImageData* _png_load(const char* file){
|
|||||||
if (!(f = fopen(file, "r"))) {
|
if (!(f = fopen(file, "r"))) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
fread(header, 1, 8, f);
|
if (fread(header, 1, 8, f) < 8) {
|
||||||
|
fclose(f);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
is_png = !png_sig_cmp(header, 0, 8);
|
is_png = !png_sig_cmp(header, 0, 8);
|
||||||
if (!is_png) {
|
if (!is_png) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|||||||
@ -60,7 +60,12 @@ void BinaryWriter::putInt64(int64_t val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BinaryWriter::putFloat32(float val) {
|
void BinaryWriter::putFloat32(float val) {
|
||||||
putInt32(*((uint32_t*)&val));
|
union {
|
||||||
|
int32_t vali32;
|
||||||
|
float valfloat;
|
||||||
|
} value;
|
||||||
|
value.valfloat = val;
|
||||||
|
putInt32(value.vali32);
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryReader::BinaryReader(const ubyte* data, size_t size)
|
BinaryReader::BinaryReader(const ubyte* data, size_t size)
|
||||||
@ -122,8 +127,12 @@ int64_t BinaryReader::getInt64() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float BinaryReader::getFloat32() {
|
float BinaryReader::getFloat32() {
|
||||||
int32_t value = getInt32();
|
union {
|
||||||
return *(float*)(&value);
|
int32_t vali32;
|
||||||
|
float valfloat;
|
||||||
|
} value;
|
||||||
|
value.vali32 = getInt32();
|
||||||
|
return value.valfloat;
|
||||||
}
|
}
|
||||||
|
|
||||||
string BinaryReader::getString() {
|
string BinaryReader::getString() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user