gcc-6.2 compil fixes

This commit is contained in:
GetAway
2017-01-21 13:55:25 +01:00
committed by Jacek Jendrzej
parent f4e334fa09
commit b5138018b5
7 changed files with 60 additions and 4 deletions

View File

@@ -9,6 +9,9 @@
#include <fcntl.h>
#include <unistd.h>
#if __cplusplus >= 201103
#include <cmath>
#endif
#include <setjmp.h>
#include "pictureviewer.h"
@@ -193,12 +196,21 @@ int fh_crw_load(const char *filename,unsigned char **buffer,int* xp,int* /*yp*/)
ciptr->out_color_space=JCS_RGB;
if(x==(int)ciptr->image_width)
ciptr->scale_denom=1;
#if __cplusplus < 201103
else if(abs(x*2 - ciptr->image_width) < 2)
ciptr->scale_denom=2;
else if(abs(x*4 - ciptr->image_width) < 4)
ciptr->scale_denom=4;
else if(abs(x*8 - ciptr->image_width) < 8)
ciptr->scale_denom=8;
#else
else if(std::abs(x*2 - ciptr->image_width) < 2)
ciptr->scale_denom=2;
else if(std::abs(x*4 - ciptr->image_width) < 4)
ciptr->scale_denom=4;
else if(std::abs(x*8 - ciptr->image_width) < 8)
ciptr->scale_denom=8;
#endif
else
ciptr->scale_denom=1;

View File

@@ -4,7 +4,7 @@
#include <config.h>
#include "pv_config.h"
#ifdef FBV_SUPPORT_JPEG
#include <cstdio>
#include <cstdlib>
#include <cstring>
@@ -17,7 +17,10 @@
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#if __cplusplus >= 201103
#include <cmath>
#endif
#include <setjmp.h>
#include <global.h>
@@ -94,12 +97,21 @@ int fh_jpeg_load(const char *filename,unsigned char **buffer,int* x,int* y)
ciptr->dct_method=JDCT_FASTEST;
if(*x==(int)ciptr->image_width)
ciptr->scale_denom=1;
#if __cplusplus < 201103
else if(abs(*x*2 - ciptr->image_width) < 2)
ciptr->scale_denom=2;
else if(abs(*x*4 - ciptr->image_width) < 4)
ciptr->scale_denom=4;
else if(abs(*x*8 - ciptr->image_width) < 8)
ciptr->scale_denom=8;
#else
else if(std::abs(*x*2 - ciptr->image_width) < 2)
ciptr->scale_denom=2;
else if(std::abs(*x*4 - ciptr->image_width) < 4)
ciptr->scale_denom=4;
else if(std::abs(*x*8 - ciptr->image_width) < 8)
ciptr->scale_denom=8;
#endif
else
ciptr->scale_denom=1;