mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
gcc-6.2 compil fixes
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -18,6 +18,9 @@
|
||||
#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;
|
||||
|
||||
|
@@ -60,11 +60,17 @@ static inline void list_del(struct list_head *entry)
|
||||
#define list_entry(ptr, type, member) \
|
||||
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
|
||||
|
||||
#if __cplusplus < 201103
|
||||
#define list_for_each_entry(pos, head, member) \
|
||||
for (pos = list_entry((head)->next, typeof(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, typeof(*pos), member))
|
||||
|
||||
#else
|
||||
#define list_for_each_entry(pos, head, member) \
|
||||
for (pos = list_entry((head)->next, __typeof__(*pos), member); \
|
||||
&pos->member != (head); \
|
||||
pos = list_entry(pos->member.next, __typeof__(*pos), member))
|
||||
#endif
|
||||
|
||||
/* Available compressors are on this_ list */
|
||||
static LIST_HEAD(jffs2_compressor_list);
|
||||
|
@@ -44,6 +44,9 @@
|
||||
#include "common.h"
|
||||
#include "compr.h"
|
||||
|
||||
#if __cplusplus >= 201103
|
||||
#include "algorithm"
|
||||
#endif
|
||||
/* Plan: call deflate() with avail_in == *sourcelen,
|
||||
avail_out = *dstlen - 12 and flush == Z_FINISH.
|
||||
If it doesn't manage to finish, call it again with
|
||||
@@ -76,7 +79,11 @@ static int jffs2_zlib_compress(unsigned char *data_in, unsigned char *cpage_out,
|
||||
|
||||
while (strm.total_out < *dstlen - STREAM_END_SPACE && strm.total_in < *sourcelen) {
|
||||
strm.avail_out = *dstlen - (strm.total_out + STREAM_END_SPACE);
|
||||
#if __cplusplus < 201103
|
||||
strm.avail_in = min((unsigned)(*sourcelen-strm.total_in), strm.avail_out);
|
||||
#else
|
||||
strm.avail_in = std::min((unsigned)(*sourcelen-strm.total_in), strm.avail_out);
|
||||
#endif
|
||||
ret = deflate(&strm, Z_PARTIAL_FLUSH);
|
||||
if (ret != Z_OK) {
|
||||
deflateEnd(&strm);
|
||||
|
@@ -37,13 +37,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MIN /* some C lib headers define this for us */
|
||||
#if __cplusplus < 201103
|
||||
#ifndef MIN /* some C lib headers define this for us */
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#endif
|
||||
#define min(a, b) MIN(a, b) /* glue for linux kernel source */
|
||||
#endif
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
|
@@ -66,6 +66,9 @@
|
||||
#include <crc32.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if __cplusplus >= 201103
|
||||
#include <algorithm>
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#include "rbtree.h"
|
||||
@@ -755,7 +758,11 @@ void CMkfsJFFS2::pad_block_if_less_than(int req)
|
||||
void CMkfsJFFS2::padblock(void)
|
||||
{
|
||||
while (out_ofs % erase_block_size) {
|
||||
#if __cplusplus < 201103
|
||||
full_write(out_fd, ffbuf, min(sizeof(ffbuf),
|
||||
#else
|
||||
full_write(out_fd, ffbuf, std::min(sizeof(ffbuf),
|
||||
#endif
|
||||
(size_t)(erase_block_size - (out_ofs % erase_block_size))));
|
||||
}
|
||||
}
|
||||
@@ -868,7 +875,11 @@ void CMkfsJFFS2::create_target_filesystem(struct filesystem_entry *root)
|
||||
}
|
||||
} else {
|
||||
while (out_ofs < pad_fs_size) {
|
||||
#if __cplusplus < 201103
|
||||
full_write(out_fd, ffbuf, min(sizeof(ffbuf), (size_t)(pad_fs_size - out_ofs)));
|
||||
#else
|
||||
full_write(out_fd, ffbuf, std::min(sizeof(ffbuf), (size_t)(pad_fs_size - out_ofs)));
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -136,9 +136,15 @@ static inline void rb_set_color(struct rb_node *rb, int color)
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
#endif
|
||||
|
||||
#if __cplusplus < 201103
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
#else
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
|
||||
(type *)( (char *)__mptr - offsetof(type,member) );})
|
||||
#endif
|
||||
|
||||
#define rb_entry(ptr, type, member) container_of(ptr, type, member)
|
||||
|
||||
|
Reference in New Issue
Block a user