summaryrefslogtreecommitdiff
path: root/libcore
diff options
context:
space:
mode:
authorManuel Reimer <manuel.reimer@gmx.de>2014-11-10 16:32:38 +0100
committerManuel Reimer <manuel.reimer@gmx.de>2014-11-10 16:32:38 +0100
commit529039e24cb61d038fb065f8026b2e97f79ccdf9 (patch)
treec87cebcc439a0ab373fa6354547c024c8cc06f48 /libcore
parent955da7682808d806e5f967b68e02a50e61bf876c (diff)
downloadvdr-plugin-skindesigner-529039e24cb61d038fb065f8026b2e97f79ccdf9.tar.gz
vdr-plugin-skindesigner-529039e24cb61d038fb065f8026b2e97f79ccdf9.tar.bz2
Fixed all compiler warnings for imageloader code
Diffstat (limited to 'libcore')
-rw-r--r--libcore/imageloader.c33
-rw-r--r--libcore/imageloader.h30
2 files changed, 32 insertions, 31 deletions
diff --git a/libcore/imageloader.c b/libcore/imageloader.c
index d3f02fe..4a641c0 100644
--- a/libcore/imageloader.c
+++ b/libcore/imageloader.c
@@ -108,7 +108,7 @@ void cImageLoader::DeterminateChannelLogoSize(int &width, int &height) {
if (!folder)
return;
- while (file = readdir(folder)) {
+ while ( (file = readdir(folder)) ) {
if (endswith(file->d_name, *logoExt)) {
std::stringstream filePath;
filePath << *logoPath << file->d_name;
@@ -225,6 +225,30 @@ void cImageImporterSVG::GetImageSize(int &width, int &height) {
// Image importer for JPG
//
+struct my_error_mgr {
+ struct jpeg_error_mgr pub; // "public" fields
+ jmp_buf setjmp_buffer; // for return to caller
+};
+
+METHODDEF(void)
+my_error_exit(j_common_ptr cinfo) {
+ // cinfo->err really points to a my_error_mgr struct, so coerce pointer
+ my_error_mgr *myerr = (my_error_mgr*) cinfo->err;
+
+ // Always display the message.
+ (*cinfo->err->output_message) (cinfo);
+
+ // Return control to the setjmp point
+ longjmp(myerr->setjmp_buffer, 1);
+}
+
+METHODDEF(void)
+my_output_message(j_common_ptr cinfo) {
+ char buf[JMSG_LENGTH_MAX];
+ cinfo->err->format_message(cinfo, buf);
+ dsyslog("skindesigner: libjpeg error: %s", buf);
+}
+
cImageImporterJPG::cImageImporterJPG() {
cinfo = NULL;
}
@@ -255,7 +279,8 @@ bool cImageImporterJPG::LoadImage(const char *path) {
// Allocate space for our decompress struct
cinfo = (j_decompress_ptr)malloc(sizeof(struct jpeg_decompress_struct));
- // We set up the normal JPEG error routines, then override error_exit.
+ // We set up the normal JPEG error routines, then override error_exit
+ // and output_message.
struct my_error_mgr jerr;
cinfo->err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = my_error_exit;
@@ -309,8 +334,8 @@ void cImageImporterJPG::DrawToCairo(cairo_t *cr) {
(void) jpeg_start_decompress(cinfo);
// Allocate buffer. Directly allocate the space needed for ARGB
- int width = cinfo->output_width;
- int height = cinfo->output_height;
+ unsigned int width = cinfo->output_width;
+ unsigned int height = cinfo->output_height;
bmp_buffer = (unsigned char*)malloc(width * height * 4);
// Step 6: while (scan lines remain to be read)
diff --git a/libcore/imageloader.h b/libcore/imageloader.h
index a1a11de..a06f433 100644
--- a/libcore/imageloader.h
+++ b/libcore/imageloader.h
@@ -48,35 +48,10 @@ private:
};
// Image importer for JPG
-
#if BITS_IN_JSAMPLE != 8
#error libjpeg has to be compiled with 8-bit samples!
#endif
-struct my_error_mgr {
- struct jpeg_error_mgr pub; // "public" fields
- jmp_buf setjmp_buffer; // for return to caller
-};
-
-METHODDEF(void)
-my_error_exit(j_common_ptr cinfo) {
- // cinfo->err really points to a my_error_mgr struct, so coerce pointer
- my_error_mgr *myerr = (my_error_mgr*) cinfo->err;
-
- // Always display the message.
- (*cinfo->err->output_message) (cinfo);
-
- // Return control to the setjmp point
- longjmp(myerr->setjmp_buffer, 1);
-}
-
-METHODDEF(void)
-my_output_message(j_common_ptr cinfo) {
- char buf[JMSG_LENGTH_MAX];
- cinfo->err->format_message(cinfo, buf);
- dsyslog("skindesigner: libjpeg error: %s", buf);
-}
-
class cImageImporterJPG : public cImageImporter {
public:
cImageImporterJPG();
@@ -89,8 +64,9 @@ private:
FILE *infile;
};
-
-
+//
+// Image loader class
+//
class cImageLoader {
private:
cImageImporter *importer;