RHEL/Fedora: fix digikam for GCC 4.7

pull/3/head
Francois Andriot 13 years ago
parent 0610a9a48d
commit 7379de160c

@ -0,0 +1,24 @@
--- digikam/digikam/libs/dimg/loaders/pngloader.cpp.libpng 2012-05-01 15:02:57.235666444 +0200
+++ digikam/digikam/libs/dimg/loaders/pngloader.cpp 2012-05-01 15:04:30.737122439 +0200
@@ -408,10 +408,11 @@
TQMap<int, TQByteArray>& metaData = imageMetaData();
png_charp profile_name, profile_data=NULL;
+ unsigned char* uprofile_data = reinterpret_cast<unsigned char*>(profile_data);
png_uint_32 profile_size;
int compression_type;
- png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &profile_data, &profile_size);
+ png_get_iCCP(png_ptr, info_ptr, &profile_name, &compression_type, &uprofile_data, &profile_size);
if (profile_data != NULL)
{
@@ -607,7 +608,7 @@
if (!profile_rawdata.isEmpty())
{
- png_set_iCCP(png_ptr, info_ptr, (png_charp)"icc", PNG_COMPRESSION_TYPE_BASE, profile_rawdata.data(), profile_rawdata.size());
+ png_set_iCCP(png_ptr, info_ptr, (png_charp)"icc", PNG_COMPRESSION_TYPE_BASE, (unsigned char*)profile_rawdata.data(), profile_rawdata.size());
}
// -------------------------------------------------------------------

@ -0,0 +1,54 @@
diff -ruN digikam-0.9.6.old/digikam/kioslave/digikamthumbnail.cpp digikam-0.9.6/digikam/kioslave/digikamthumbnail.cpp
--- digikam-0.9.6.old/digikam/kioslave/digikamthumbnail.cpp 2009-07-03 07:19:41.000000000 +0200
+++ digikam-0.9.6/digikam/kioslave/digikamthumbnail.cpp 2010-06-30 10:29:09.000000000 +0200
@@ -370,7 +370,7 @@
unsigned char buf[PNG_BYTES_TO_CHECK];
fread(buf, 1, PNG_BYTES_TO_CHECK, f);
- if (!png_check_sig(buf, PNG_BYTES_TO_CHECK))
+ if (png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK))
{
fclose(f);
return qimage;
@@ -465,7 +465,7 @@
{
png_set_gray_to_rgb(png_ptr);
if (png_get_bit_depth(png_ptr, info_ptr) < 8)
- png_set_gray_1_2_4_to_8(png_ptr);
+ png_set_expand_gray_1_2_4_to_8(png_ptr);
}
int sizeOfUint = sizeof(unsigned int);
diff -ruN digikam-0.9.6.old/digikam/libs/dimg/loaders/pngloader.cpp digikam-0.9.6/digikam/libs/dimg/loaders/pngloader.cpp
--- digikam-0.9.6.old/digikam/libs/dimg/loaders/pngloader.cpp 2009-07-03 07:19:41.000000000 +0200
+++ digikam-0.9.6/digikam/libs/dimg/loaders/pngloader.cpp 2010-06-30 10:28:24.000000000 +0200
@@ -88,7 +88,7 @@
unsigned char buf[PNG_BYTES_TO_CHECK];
fread(buf, 1, PNG_BYTES_TO_CHECK, f);
- if (!png_check_sig(buf, PNG_BYTES_TO_CHECK))
+ if (png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK))
{
DDebug() << k_funcinfo << "Not a PNG image file." << endl;
fclose(f);
@@ -252,7 +252,7 @@
#ifdef ENABLE_DEBUG_MESSAGES
DDebug() << "PNG in PNG_COLOR_TYPE_GRAY" << endl;
#endif
- png_set_gray_1_2_4_to_8(png_ptr);
+ png_set_expand_gray_1_2_4_to_8(png_ptr);
png_set_gray_to_rgb(png_ptr);
if (TQImage::systemByteOrder() == TQImage::LittleEndian) // Intel
diff -ruN digikam-0.9.6.old/digikam/libs/greycstoration/CImg.h digikam-0.9.6/digikam/libs/greycstoration/CImg.h
--- digikam-0.9.6.old/digikam/libs/greycstoration/CImg.h 2009-07-03 07:19:41.000000000 +0200
+++ digikam-0.9.6/digikam/libs/greycstoration/CImg.h 2010-06-30 10:28:52.000000000 +0200
@@ -29449,7 +29449,7 @@
new_bit_depth = 8;
}
if (new_color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8){
- png_set_gray_1_2_4_to_8(png_ptr);
+ png_set_expand_gray_1_2_4_to_8(png_ptr);
new_bit_depth = 8;
}
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))

@ -0,0 +1,40 @@
--- digikam/digikam/libs/dimg/loaders/pngloader.cpp.ORI 2012-05-01 14:49:41.357985513 +0200
+++ digikam/digikam/libs/dimg/loaders/pngloader.cpp 2012-05-01 14:53:47.459349483 +0200
@@ -120,7 +120,11 @@
// PNG error handling. If an error occurs during reading, libpng
// will jump here
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+ if (setjmp(png_jmpbuf(png_ptr)))
+#else
if (setjmp(png_ptr->jmpbuf))
+#endif
{
DDebug() << k_funcinfo << "Internal libPNG error during reading file. Process aborted!" << endl;
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
@@ -526,7 +531,11 @@
// PNG error handling. If an error occurs during writing, libpng
// will jump here
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+ if (setjmp(png_jmpbuf(png_ptr)))
+#else
if (setjmp(png_ptr->jmpbuf))
+#endif
{
DDebug() << k_funcinfo << "Internal libPNG error during writing file. Process aborted!" << endl;
fclose(f);
--- digikam/digikam/kioslave/digikamthumbnail.cpp.ORI 2012-05-01 15:44:40.237089691 +0200
+++ digikam/digikam/kioslave/digikamthumbnail.cpp 2012-05-01 15:45:22.939534916 +0200
@@ -392,7 +392,11 @@
return qimage;
}
+#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
+ if (setjmp(png_jmpbuf(png_ptr)))
+#else
if (setjmp(png_ptr->jmpbuf))
+#endif
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(f);

@ -0,0 +1,47 @@
diff -uNrb digikam.orig/digikam/digikam/albummanager.cpp digikam/digikam/digikam/albummanager.cpp
--- digikam.orig/digikam/digikam/albummanager.cpp 2012-02-21 18:52:03.000000000 -0600
+++ digikam/digikam/digikam/albummanager.cpp 2012-04-19 16:42:29.951033101 -0500
@@ -1579,16 +1579,16 @@
// Check if Year Album already exist.
DAlbum *yAlbum = 0;
- AlbumIterator it(d->rootDAlbum);
- while (it.current())
+ AlbumIterator it2(d->rootDAlbum);
+ while (it2.current())
{
- DAlbum* a = (DAlbum*)(*it);
+ DAlbum* a = (DAlbum*)(*it2);
if (a->date() == TQDate(year, 1, 1) && a->range() == DAlbum::Year)
{
yAlbum = a;
break;
}
- ++it;
+ ++it2;
}
// If no, create Year album.
diff -uNrb digikam.orig/digikam/kioslave/digikamthumbnail.cpp digikam/digikam/kioslave/digikamthumbnail.cpp
--- digikam.orig/digikam/kioslave/digikamthumbnail.cpp 2012-04-19 07:02:43.000000000 -0500
+++ digikam/digikam/kioslave/digikamthumbnail.cpp 2012-04-19 16:44:10.307517462 -0500
@@ -413,16 +413,16 @@
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr);
- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
+ if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
has_alpha = 1;
- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
has_alpha = 1;
has_grey = 1;
}
- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)
+ if (color_type == PNG_COLOR_TYPE_GRAY)
has_grey = 1;
unsigned char **lines;

@ -34,8 +34,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source0: %{kdecomp}-3.5.13.tar.gz
# TDE 3.5.13 on RHEL/Fedora specific patches
Patch0: digikam-3.5.13-jpegint-ftbfs.patch
Patch1: digikam-3.5.13-jpegint-ftbfs.patch
# [digikam] Add support for libpng 1.4 [Bug #595]
Patch2: digikam-3.5.13-fix_libpng_1.4.patch
# [digikam] gcc 4.7 + libpng 1.5 patch for digikam (consolidated) [Bug #958]
Patch3: digikam-3.5.13-libpng15+gcc47_1.patch
# [digikam] Fix libpng support (again !!!)
Patch4: digikam-3.5.13-fix_libpng_support.patch
# [digikam] Fix compilation with GCC 4.7
Patch5: digikam-3.5.13-fix_gcc47_compilation.patch
BuildRequires: tqtinterface-devel
BuildRequires: trinity-arts-devel
@ -46,7 +53,11 @@ BuildRequires: gettext
BuildRequires: trinity-libkexiv2-devel
BuildRequires: trinity-libkdcraw-devel
BuildRequires: trinity-libkipi-devel
%if 0%{?rhel} == 5
BuildRequires: gphoto2-devel
%else
BuildRequires: libgphoto2-devel
%endif
BuildRequires: libtiff-devel
BuildRequires: jasper-devel
@ -83,15 +94,22 @@ Requires: %{name} = %{version}
%prep
%setup -q -n applications/%{kdecomp}
%patch0 -p5
%patch1 -p5
%patch2 -p1
%patch3 -p1
%patch4 -p1 -b .libpng
%if 0%{?fedora} >= 17
%patch5 -p1 -b .gcc47
%endif
# Ugly hack to modify TQT include directory inside autoconf files.
# If TQT detection fails, it fallbacks to TQT4 instead of TQT3 !
sed -i admin/acinclude.m4.in \
-e "s,/usr/include/tqt,%{_includedir}/tqt,g"
%__sed -i admin/acinclude.m4.in \
-e "s|/usr/include/tqt|%{_includedir}/tqt|g" \
-e "s|kde_htmldir='.*'|kde_htmldir='%{tde_docdir}/HTML'|g"
%__cp -f "/usr/share/aclocal/libtool.m4" "admin/libtool.m4.in"
%__cp -f "/usr/share/libtool/config/ltmain.sh" "admin/ltmain.sh"
%__cp -f "/usr/share/libtool/config/ltmain.sh" "admin/ltmain.sh" || %__cp -f "/usr/share/libtool/ltmain.sh" "admin/ltmain.sh"
%__make -f "admin/Makefile.common"
@ -139,8 +157,8 @@ gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
%{_datadir}/services/*.protocol
%{_datadir}/servicetypes/digikamimageplugin.desktop
%{_datadir}/apps/*/
%{_docdir}/HTML/en/*/
%{_datadir}/icons/*/*/*/*
%{tde_docdir}/HTML/en/*/
%{_datadir}/icons/hicolor/*/*/*
%{_mandir}/man*/*
@ -154,6 +172,9 @@ gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
%Changelog
* Sun Nov 06 2011 Francois Andriot <francois.andriot@free.fr> - 0.9.6-0
* Tue May 01 2012 Francois Andriot <francois.andriot@free.fr> - 0.9.6-2
- gcc 4.7 + libpng 1.5 patch for digikam (consolidated) [Bug #958]
* Sun Nov 06 2011 Francois Andriot <francois.andriot@free.fr> - 0.9.6-1
- Initial release for RHEL 6, RHEL 5 and Fedora 15

Loading…
Cancel
Save