Browse Source

fix casting to make gcc/linux happy

master
Odilitime 5 years ago
parent
commit
9ae889324c
  1. 8
      src/pnm.cpp

8
src/pnm.cpp

@ -73,8 +73,8 @@ RGBAPNMObject * readPPM(const char* fileName) { @@ -73,8 +73,8 @@ RGBAPNMObject * readPPM(const char* fileName) {
// read the rest of header
unsigned int width, height;
if (pamType) {
width = std::stoi(pamHeader["WIDTH"]);
height = std::stoi(pamHeader["HEIGHT"]);
width = static_cast<unsigned int>(std::stoi(pamHeader["WIDTH"]));
height = static_cast<unsigned int>(std::stoi(pamHeader["HEIGHT"]));
} else {
res = fscanf(fr, "%u\n %u\n", &width, &height);
}
@ -86,7 +86,7 @@ RGBAPNMObject * readPPM(const char* fileName) { @@ -86,7 +86,7 @@ RGBAPNMObject * readPPM(const char* fileName) {
if (bits != 1) {
unsigned int maximum;
if (pamType) {
maximum = std::stoi(pamHeader["MAXVAL"]);
maximum = static_cast<unsigned int>(std::stoi(pamHeader["MAXVAL"]));
} else {
res = fscanf(fr, "%u\n", &maximum);
}
@ -96,7 +96,7 @@ RGBAPNMObject * readPPM(const char* fileName) { @@ -96,7 +96,7 @@ RGBAPNMObject * readPPM(const char* fileName) {
if (bits != 1) {
size *= bits/8;
}
std::cout << "read " << fileName << " pnm/pam " << width << "," << height << "@" << static_cast<int>(bits) << "(" << static_cast<int>(bits/8) << ")" << "/" << data->maxColVal << std::endl;
std::cout << "read " << fileName << " pnm/pam " << width << "," << height << "@" << static_cast<int>(bits) << "(" << bits/8 << ")" << "/" << data->maxColVal << std::endl;
// allocate array for pixels
char* pixels = reinterpret_cast<char*>(tlsf_calloc(size, sizeof(char))); // used to be: new char[size];

Loading…
Cancel
Save