[haiku-commits] haiku: hrev47747 - in src/add-ons/translators/icns: openjpeg libicns

  • From: jerome.duval@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 26 Aug 2014 20:41:12 +0200 (CEST)

hrev47747 adds 3 changesets to branch 'master'
old head: 72a446e10b634ced1034f689581a291b6ce8d770
new head: 82e60cd5ec5cfd68e1beec5be20caccff1fe17d6
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=82e60cd+%5E72a446e

----------------------------------------------------------------------------

9cd9e56: Update jasper packages

d977c0d: BuildFeatures: add a feature for libicns

82e60cd: ICNSTranslator: use outsourced package libicns
  
  * clean up Copyrights section.
  * libicns becomes a default package

                                   [ Jérôme Duval <jerome.duval@xxxxxxxxx> ]

----------------------------------------------------------------------------

74 files changed, 40 insertions(+), 24318 deletions(-)
Jamfile                                          |    6 +-
build/jam/BuildFeatures                          |   17 +
build/jam/repositories/HaikuPorts/x86            |   10 +-
build/jam/repositories/HaikuPorts/x86_64         |    6 +-
build/jam/repositories/HaikuPorts/x86_gcc2       |   10 +-
src/add-ons/translators/icns/ConfigView.cpp      |    9 +-
src/add-ons/translators/icns/Jamfile             |   60 +-
.../translators/icns/libicns/COPYING.LGPL-2      |  481 ----
src/add-ons/translators/icns/libicns/README      |  118 -
src/add-ons/translators/icns/libicns/config.h    |   30 -
src/add-ons/translators/icns/libicns/icns.h      |  212 --
.../translators/icns/libicns/icns_colormaps.h    |  314 ---
.../translators/icns/libicns/icns_debug.c        |   61 -
.../translators/icns/libicns/icns_element.c      |  740 -----
.../translators/icns/libicns/icns_family.c       |  111 -
.../translators/icns/libicns/icns_image.c        |  794 ------
.../translators/icns/libicns/icns_internals.h    |  207 --
src/add-ons/translators/icns/libicns/icns_io.c   | 1522 ----------
src/add-ons/translators/icns/libicns/icns_jp2.c  |  961 -------
src/add-ons/translators/icns/libicns/icns_png.c  |  201 --
.../translators/icns/libicns/icns_rle24.c        |  411 ---
.../translators/icns/libicns/icns_utils.c        |  763 -----
src/add-ons/translators/icns/openjpeg/LICENSE    |   31 -
src/add-ons/translators/icns/openjpeg/README     |   25 -
src/add-ons/translators/icns/openjpeg/bio.c      |  187 --
src/add-ons/translators/icns/openjpeg/bio.h      |  125 -
.../translators/icns/openjpeg/cidx_manager.c     |  211 --
.../translators/icns/openjpeg/cidx_manager.h     |   56 -
src/add-ons/translators/icns/openjpeg/cio.c      |  191 --
src/add-ons/translators/icns/openjpeg/cio.h      |   93 -
src/add-ons/translators/icns/openjpeg/dwt.c      |  858 ------
src/add-ons/translators/icns/openjpeg/dwt.h      |  113 -
src/add-ons/translators/icns/openjpeg/event.c    |  121 -
src/add-ons/translators/icns/openjpeg/event.h    |   58 -
src/add-ons/translators/icns/openjpeg/fix.h      |   64 -
src/add-ons/translators/icns/openjpeg/image.c    |   89 -
.../translators/icns/openjpeg/indexbox_manager.h |  118 -
src/add-ons/translators/icns/openjpeg/int.h      |  119 -
src/add-ons/translators/icns/openjpeg/j2k.c      | 2616 ------------------
src/add-ons/translators/icns/openjpeg/j2k.h      |  446 ---
src/add-ons/translators/icns/openjpeg/j2k_lib.c  |   59 -
src/add-ons/translators/icns/openjpeg/j2k_lib.h  |   54 -
src/add-ons/translators/icns/openjpeg/jp2.c      | 1223 --------
src/add-ons/translators/icns/openjpeg/jp2.h      |  234 --
src/add-ons/translators/icns/openjpeg/jpt.c      |  155 --
src/add-ons/translators/icns/openjpeg/jpt.h      |   75 -
src/add-ons/translators/icns/openjpeg/mct.c      |  190 --
src/add-ons/translators/icns/openjpeg/mct.h      |   98 -
src/add-ons/translators/icns/openjpeg/mqc.c      |  592 ----
src/add-ons/translators/icns/openjpeg/mqc.h      |  200 --
src/add-ons/translators/icns/openjpeg/oj_image.h |   48 -
src/add-ons/translators/icns/openjpeg/openjpeg.c |  343 ---
src/add-ons/translators/icns/openjpeg/openjpeg.h |  914 ------
.../translators/icns/openjpeg/opj_config.h       |  117 -
.../translators/icns/openjpeg/opj_includes.h     |  140 -
.../translators/icns/openjpeg/opj_malloc.h       |  165 --
.../translators/icns/openjpeg/phix_manager.c     |  170 --
src/add-ons/translators/icns/openjpeg/pi.c       |  963 -------
src/add-ons/translators/icns/openjpeg/pi.h       |  156 --
.../translators/icns/openjpeg/ppix_manager.c     |  173 --
src/add-ons/translators/icns/openjpeg/raw.c      |   87 -
src/add-ons/translators/icns/openjpeg/raw.h      |  100 -
src/add-ons/translators/icns/openjpeg/t1.c       | 1585 -----------
src/add-ons/translators/icns/openjpeg/t1.h       |  147 -
.../translators/icns/openjpeg/t1_generate_luts.c |  275 --
src/add-ons/translators/icns/openjpeg/t1_luts.h  |  143 -
src/add-ons/translators/icns/openjpeg/t2.c       |  822 ------
src/add-ons/translators/icns/openjpeg/t2.h       |  105 -
src/add-ons/translators/icns/openjpeg/tcd.c      | 1574 -----------
src/add-ons/translators/icns/openjpeg/tcd.h      |  286 --
src/add-ons/translators/icns/openjpeg/tgt.c      |  213 --
src/add-ons/translators/icns/openjpeg/tgt.h      |  114 -
.../translators/icns/openjpeg/thix_manager.c     |  120 -
.../translators/icns/openjpeg/tpix_manager.c     |  153 -

############################################################################

Commit:      9cd9e5651bc2c0116b68e7ba4f913802cf213025
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9cd9e56
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Tue Aug 26 18:13:53 2014 UTC

Update jasper packages

----------------------------------------------------------------------------

diff --git a/build/jam/repositories/HaikuPorts/x86 
b/build/jam/repositories/HaikuPorts/x86
index 6f7b78f..9684649 100644
--- a/build/jam/repositories/HaikuPorts/x86
+++ b/build/jam/repositories/HaikuPorts/x86
@@ -77,9 +77,9 @@ RemotePackageRepository HaikuPorts
        icu-4.8.1.1-4
        icu_devel-4.8.1.1-4
        jam-2.5_2012_10_12-1
-       jasper-1.900.1-3
-       jasper_devel-1.900.1-3
-       jasper_tools-1.900.1-3
+       jasper-1.900.1-4
+       jasper_devel-1.900.1-4
+       jasper_tools-1.900.1-4
        jpeg-9-3
        jpeg_devel-9-3
        jpeg_tools-9-3
@@ -205,8 +205,8 @@ RemotePackageRepository HaikuPorts
        glu_x86_gcc2_devel-9.0.0-2
        icu_x86_gcc2-4.8.1.1-4
        icu_x86_gcc2_devel-4.8.1.1-4
-       jasper_x86_gcc2-1.900.1-3
-       jasper_x86_gcc2_devel-1.900.1-3
+       jasper_x86_gcc2-1.900.1-4
+       jasper_x86_gcc2_devel-1.900.1-4
        jpeg_x86_gcc2-9-3
        jpeg_x86_gcc2_devel-9-3
        libicns_x86_gcc2-0.8.1-1
diff --git a/build/jam/repositories/HaikuPorts/x86_64 
b/build/jam/repositories/HaikuPorts/x86_64
index bf78534..83e0ba2 100644
--- a/build/jam/repositories/HaikuPorts/x86_64
+++ b/build/jam/repositories/HaikuPorts/x86_64
@@ -74,9 +74,9 @@ RemotePackageRepository HaikuPorts
        icu-4.8.1.1-4
        icu_devel-4.8.1.1-4
        jam-2.5_2012_10_12-1
-       jasper-1.900.1-3
-       jasper_devel-1.900.1-3
-       jasper_tools-1.900.1-3
+       jasper-1.900.1-4
+       jasper_devel-1.900.1-4
+       jasper_tools-1.900.1-4
        jpeg-9-3
        jpeg_devel-9-3
        jpeg_tools-9-3
diff --git a/build/jam/repositories/HaikuPorts/x86_gcc2 
b/build/jam/repositories/HaikuPorts/x86_gcc2
index 10b14f9..0e1a89c 100644
--- a/build/jam/repositories/HaikuPorts/x86_gcc2
+++ b/build/jam/repositories/HaikuPorts/x86_gcc2
@@ -115,9 +115,9 @@ RemotePackageRepository HaikuPorts
        icu_devel-4.8.1.1-4
        intltool-0.40.6-3
        jam-2.5_2012_10_12-1
-       jasper-1.900.1-3
-       jasper_devel-1.900.1-3
-       jasper_tools-1.900.1-3
+       jasper-1.900.1-4
+       jasper_devel-1.900.1-4
+       jasper_tools-1.900.1-4
        jpeg-9-3
        jpeg_devel-9-3
        jpeg_tools-9-3
@@ -381,8 +381,8 @@ RemotePackageRepository HaikuPorts
        haikuwebkit_x86_devel-1.4.1-3
        icu_x86-4.8.1.1-4
        icu_x86_devel-4.8.1.1-4
-       jasper_x86-1.900.1-3
-       jasper_x86_devel-1.900.1-3
+       jasper_x86-1.900.1-4
+       jasper_x86_devel-1.900.1-4
        jpeg_x86-9-3
        jpeg_x86_devel-9-3
        lame_x86-3.99.5-3

############################################################################

Commit:      d977c0da56b7d7452e4bee7b0f8d910720aa43b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=d977c0d
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Tue Aug 26 18:26:31 2014 UTC

BuildFeatures: add a feature for libicns

----------------------------------------------------------------------------

diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
index a885e94..7e0be56 100644
--- a/build/jam/BuildFeatures
+++ b/build/jam/BuildFeatures
@@ -375,6 +375,23 @@ if [ IsPackageAvailable libpng_devel ] {
 }
 
 
+# libicns
+if [ IsPackageAvailable libicns_devel ] {
+       ExtractBuildFeatureArchives libicns :
+               file: base libicns
+                       runtime: lib
+               file: devel libicns_devel
+                       depends: base
+                       library: $(developLibDir)/libicns.so.1
+                       headers: $(developHeadersDir)
+               ;
+
+       EnableBuildFeatures libicns ;
+} else {
+       Echo "libicns support not available on $(TARGET_PACKAGING_ARCH)" ;
+}
+
+
 # Jasper
 if [ IsPackageAvailable jasper_devel ] {
        ExtractBuildFeatureArchives jasper :

############################################################################

Revision:    hrev47747
Commit:      82e60cd5ec5cfd68e1beec5be20caccff1fe17d6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=82e60cd
Author:      Jérôme Duval <jerome.duval@xxxxxxxxx>
Date:        Tue Aug 26 18:39:10 2014 UTC

ICNSTranslator: use outsourced package libicns

* clean up Copyrights section.
* libicns becomes a default package

----------------------------------------------------------------------------

diff --git a/Jamfile b/Jamfile
index 0c03896..52b0adc 100644
--- a/Jamfile
+++ b/Jamfile
@@ -27,8 +27,8 @@ AddHaikuImagePackages [ FFilterByBuildFeatures
 
        regular_image @{
                bzip2 ctags ffmpeg findutils gawk glu grep gutenprint jasper 
jpeg less
-               libpng libwebp mesa mesa_devel mesa_swrast sed sharutils tar 
tiff wget
-               which
+               libicns libpng libwebp mesa mesa_devel mesa_swrast sed 
sharutils tar
+               tiff wget which
        }@
 ] ;
 if $(HAIKU_PACKAGING_ARCHS[1]) != x86_gcc2 {
@@ -45,7 +45,7 @@ if $(HAIKU_PACKAGING_ARCHS[2]) {
                                curl freetype icu libsolv zlib
 
                                regular_image @{
-                                       ffmpeg glu jasper jpeg libpng libwebp 
mesa
+                                       ffmpeg glu jasper jpeg libicns libpng 
libwebp mesa
                                }@
                        ] ;
                        if $(TARGET_PACKAGING_ARCH) != x86_gcc2 {
diff --git a/src/add-ons/translators/icns/ConfigView.cpp 
b/src/add-ons/translators/icns/ConfigView.cpp
index 289d2d8..ccafe4f 100644
--- a/src/add-ons/translators/icns/ConfigView.cpp
+++ b/src/add-ons/translators/icns/ConfigView.cpp
@@ -16,10 +16,6 @@
 #undef B_TRANSLATION_CONTEXT
 #define B_TRANSLATION_CONTEXT "ICNSConfig"
 
-extern "C" {
-#include <openjpeg.h>
-};
-
 
 ConfigView::ConfigView(TranslatorSettings *settings)
        : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0)
@@ -71,10 +67,7 @@ ConfigView::ConfigView(TranslatorSettings *settings)
 
        BString copyrightText;
        copyrightText << "libicns v0.8.1\n"
-               << B_UTF8_COPYRIGHT "2001-2012 Mathew Eis 
<mathew@xxxxxxxxxx>\n\n"
-               << "OpenJPEG " << opj_version() << "\n"
-               << B_UTF8_COPYRIGHT "2002-2012, Communications and Remote 
Sensing "
-               << "Laboratory, Universite catholique de Louvain (UCL), 
Belgium";
+               << B_UTF8_COPYRIGHT "2001-2012 Mathew Eis <mathew@xxxxxxxxxx>";
        
        fCopyrightView = new BTextView("CopyrightLibs");
        fCopyrightView->SetExplicitAlignment(leftAlignment);
diff --git a/src/add-ons/translators/icns/Jamfile 
b/src/add-ons/translators/icns/Jamfile
index 8af6945..0018534 100644
--- a/src/add-ons/translators/icns/Jamfile
+++ b/src/add-ons/translators/icns/Jamfile
@@ -2,68 +2,19 @@ SubDir HAIKU_TOP src add-ons translators icns ;
 
 SetSubDirSupportedPlatformsBeOSCompatible ;
 
-SubDirSysHdrs [ FDirName $(SUBDIR) openjpeg ] ;
-SubDirSysHdrs [ FDirName $(SUBDIR) libicns ] ;
-
 SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
        #for BaseTranslator.h and friends
        
 SubDirC++Flags [ FDefines BEOS_R5_COMPATIBLE ] ;
 
-local openjpeg_files = 
-       bio.c
-       cio.c
-       dwt.c
-       event.c
-       image.c
-       j2k.c
-       j2k_lib.c
-       jp2.c
-       jpt.c
-       mct.c
-       mqc.c
-       openjpeg.c
-       pi.c
-       raw.c
-       t1.c
-       t2.c
-       tcd.c
-       tgt.c
-       cidx_manager.c
-       phix_manager.c
-       ppix_manager.c
-       thix_manager.c
-       tpix_manager.c
-       ;
-
-ObjectCcFlags [ FGristFiles $(openjpeg_files:S=$(SUFOBJ)) ] : -w ;
-
-local libicns_files = 
-       icns_debug.c
-       icns_element.c
-       icns_family.c
-       icns_image.c
-       icns_io.c
-       icns_jp2.c
-       icns_png.c
-       icns_rle24.c
-       icns_utils.c
-       ;
-
-ObjectCcFlags [ FGristFiles $(libicns_files:S=$(SUFOBJ)) ] : -w ;
 
 AddResources ICNSTranslator : ICNSTranslator.rdef ;
 
 local architectureObject ;
 for architectureObject in [ MultiArchSubDirSetup ] {
        on $(architectureObject) {
-               # Let Jam know where to find some of our source files
-               SEARCH_SOURCE += [ FDirName $(SUBDIR) openjpeg ] ;
-               SEARCH_SOURCE += [ FDirName $(SUBDIR) libicns ] ;
+               UseBuildFeatureHeaders libicns ;
 
-               UseBuildFeatureHeaders libpng ;
-               Includes [ FGristFiles icns_png.c ]
-                       : [ BuildFeatureAttribute libpng : headers ] ;
                Translator [ MultiArchDefaultGristFiles ICNSTranslator ] :
 
                        # ICNSTranslator
@@ -72,17 +23,18 @@ for architectureObject in [ MultiArchSubDirSetup ] {
                        ConfigView.cpp
                        main.cpp
 
-                       $(openjpeg_files)
-                       
-                       $(libicns_files)
-
                        : be translation 
                        [ MultiArchDefaultGristFiles libtranslatorsutils.a ]
                        [ TargetLibsupc++ ]
+                       [ BuildFeatureAttribute libicns : library ]
+                       [ BuildFeatureAttribute jasper : library ]
                        [ BuildFeatureAttribute libpng : library ]
                        localestub
                        : true
                ;
+
+               Includes [ FGristFiles ICNSTranslator.cpp ICNSLoader.cpp ]
+                       : [ BuildFeatureAttribute libicns : headers ] ;
        }
 }
 
diff --git a/src/add-ons/translators/icns/libicns/COPYING.LGPL-2 
b/src/add-ons/translators/icns/libicns/COPYING.LGPL-2
deleted file mode 100644
index 5bc8fb2..0000000
--- a/src/add-ons/translators/icns/libicns/COPYING.LGPL-2
+++ /dev/null
@@ -1,481 +0,0 @@
-                  GNU LIBRARY GENERAL PUBLIC LICENSE
-                       Version 2, June 1991
-
- Copyright (C) 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the library GPL.  It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
-
-                            Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it.  You can use it for
-your libraries, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library.  If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software.  To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-  Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs.  This
-license, the GNU Library General Public License, applies to certain
-designated libraries.  This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
-  The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it.  Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program.  However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
-  Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries.  We
-concluded that weaker conditions might promote sharing better.
-
-  However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves.  This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them.  (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.)  The hope is that this
-will lead to faster development of free libraries.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, while the latter only
-works together with the library.
-
-  Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
-
-                  GNU LIBRARY GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License").  Each licensee is
-addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also compile or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    c) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    d) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                            NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
diff --git a/src/add-ons/translators/icns/libicns/README 
b/src/add-ons/translators/icns/libicns/README
deleted file mode 100644
index 40d3394..0000000
--- a/src/add-ons/translators/icns/libicns/README
+++ /dev/null
@@ -1,118 +0,0 @@
-===============================================================================
-README for libicns 0.8.1 - June 14, 2012
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-
-Other individuals have supported the development of libicns; they are credited
-in the source files where their respective contibutions have been made.
-
-===============================================================================
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.
-
-===============================================================================
-This package include the following libraries and utilities:
-1) libicns - A library for the translation of the icns format
-2) icns2png - A utility for converting icns files into png images
-3) icontainer2icns - A utility for extracting icns files from icontainer packs
-
-You should be able to get the latest version at http://sf.net/projects/icns
-
-===============================================================================
-libicns is a library for manipulation of the Mac OS icns resource format, also
-known as the IconFamily resource type. It can read and write files from the
-Mac OS X icns format, as well as read from Mac OS resource files and macbinary
-encoded Mac OS resource forks.
-
-As of release 0.5.9, it can fully manipulate any 128x128 and smaller 32-bit
-icons, and has partial support for manipulating 8-bit, 4-bit, and 1-bit icons.
-
-When linked with Jasper, it also has full support for 256x256 and 512x512
-icon sizes within the icon family.
-
-As of release 0.8.0, it can read the PNG format introduced with OS X Lion 10.7
-
-
-Please see DEVNOTES for more information on how to use libicns
-
-===============================================================================
-Using icns2png
-
-icns2png -x OmniWeb.icns
-Converting OmniWeb.icns to OmniWeb_128x128x32.png...
-
-This will result in a file OmniWeb_128x128x32.png with a 128x128 icon from 
OmniWeb.icns.
-
-Run icns2png --help for more detailed information.
-
-===============================================================================
-Using icontainer2icns
-
-icontainer2icns foo.icontainer
-
-This will end up with a couple of icns files identified by the iContainer ID
-and the iContainer name in a (new) folder carrying the icontainer name
-(without any suffix)
-
-===============================================================================
-NOTICE: icontainer2icns is NOT related to www.iconfactory.com - though it
-decodes this library type. They are NOT involved, please don't bother them
-with bug reports.
-
-For bug/wishes regarding icontainer2icns mailto: baghira-style@xxxxxxx
-
-===============================================================================
-Understanding the Mac OS X Icons
-
-Mac OS X Icon files come in two formats - icns files, and icns resources
-embedded with rsrc files. They may also be stored in a macbinary encoded
-rsrc files, or applesingle/appledouble encoded rsrc files
-
-libicns (and icns2png) can decode all five storage formats
-
-The .icns files are much easier to deal with, since they are in a format that
-can be easily accesed from Linux/UNIX/Windows.
-
-You can however access the icons from the resource files. OS X Icons like
-those from http://interfacelift.com/icons-mac/ are compressed in .sit files.
-These files can be uncompressed using Aladdin Stuffit Expander for Linux,
-which can be obtained from http://www.stuffit.com/unix/index.html
-
-When unstuffing, be sure to use a command similar to the following:
-
-unstuff --text=auto --macbinary=auto --eol=unix icons.hqx.sit
-
-This will help ensure that the resource forks are uncompressed into
-MacBinary files, so that icns2png can read them.
-
-If there are resource forks in the files, when stuffit decompresses them,
-it will create two files from the one mac file. For example, if the mac
-file was named "Gnu", the resulting decomressed files will be
-"Gnu", and "Gnu_1". The "Snowflake_1" file is the resource
-fork. This is the file you will want to extract the icon from. The file
-"Gnu" does not contain any icon data. If, however, there is no
-"Gnu_1", then the file may be in the .icns format, and you will
-extract the icon from "Gnu" - resulting in a file "Gnu.png"
-
-It is really fairly simple, once you get the hang of it - you will also
-notice that if the icon was in the resource fork, then the other main
-file will be etremely small, sometimes even 0k.
-
-The underlying data in both of the files is similar - they both hold the
-following icon data (Although most icons to not have a complete set):
-16x12 pixels - 1 bit mask - 1, 4, or 8 bit icon
-16x16 pixels - 1 or 8 bit mask - 1, 4, 8 or 24 bit icon
-32x32 pixels - 1 or 8 bit mask - 1, 4, 8, or 24 bit icon
-64x64 pixels - 1 or 8 bit mask - 1, 4, 8, or 24 bit icon
-128x128 pixels - 8 bit mask - 24 bit icon
diff --git a/src/add-ons/translators/icns/libicns/config.h 
b/src/add-ons/translators/icns/libicns/config.h
deleted file mode 100644
index ad438a4..0000000
--- a/src/add-ons/translators/icns/libicns/config.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#define HAVE_DLFCN_H 1
-#define HAVE_FORK 1
-#define HAVE_GETOPT_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_PNG_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_STRING_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_UNALIGNED_MEMCPY 1
-#define HAVE_UNISTD_H 1
-#define HAVE_VFORK 1
-#define HAVE_WORKING_FORK 1
-#define HAVE_WORKING_VFORK 1
-#define ICNS_OPENJPEG 1
-#define STDC_HEADERS 1
-#define VERSION "0.8.1"
-
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-#  define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-/* #  undef WORDS_BIGENDIAN */
-# endif
-#endif
diff --git a/src/add-ons/translators/icns/libicns/icns.h 
b/src/add-ons/translators/icns/libicns/icns.h
deleted file mode 100644
index f834497..0000000
--- a/src/add-ons/translators/icns/libicns/icns.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
-File:       icns.h
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-Copyright (C) 2002 Chenxiao Zhao <chenxiao.zhao@xxxxxxxxx>
-
-With the exception of the limited portions mentiond, this library
-is free software; you can redistribute it and/or modify it under
-the terms of the GNU Lesser General Public License as published
-by the Free Software Foundation; either version 2.1 of the License,
-or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#ifndef _ICNS_H_
-#define        _ICNS_H_
-
-/* basic data types */
-typedef uint8_t         icns_bool_t;
-
-typedef uint8_t         icns_uint8_t;
-typedef int8_t          icns_sint8_t;
-typedef uint16_t        icns_uint16_t;
-typedef int16_t         icns_sint16_t;
-typedef uint32_t        icns_uint32_t;
-typedef int32_t         icns_sint32_t;
-typedef uint64_t        icns_uint64_t;
-typedef int64_t         icns_sint64_t;
-
-typedef uint8_t         icns_byte_t;
-
-
-/* data header types */
-typedef uint32_t        icns_type_t;
-typedef int32_t         icns_size_t;
-
-/* icon family and element types */
-typedef struct icns_element_t {
-  icns_type_t           elementType;    /* 'ICN#', 'icl8', etc... */
-  icns_size_t           elementSize;    /* Total size of element  */
-  icns_byte_t           elementData[1]; /* icon image data */
-} icns_element_t;
-
-typedef struct icns_family_t {
-  icns_type_t           resourceType;  /* Always should be 'icns' */
-  icns_size_t           resourceSize;  /* Total size of resource  */
-  icns_element_t        elements[1];    /* icon elements */
-} icns_family_t;
-
-/* icon image data structure */
-typedef struct icns_image_t
-{
-  icns_uint32_t         imageWidth;     // width of image in pixels
-  icns_uint32_t         imageHeight;    // height of image in pixels
-  icns_uint8_t          imageChannels;  // number of channels in data
-  icns_uint16_t         imagePixelDepth;// number of bits-per-pixel
-  icns_uint64_t         imageDataSize;  // bytes = width * height * depth / 
bits-per-pixel
-  icns_byte_t           *imageData;     // pointer to base address of 
uncompressed raw image data
-} icns_image_t;
-
-/* used for getting information about various types */
-/* not part of the actual icns data format */
-typedef struct icns_icon_info_t
-{
-  icns_type_t           iconType;         // type of icon (or mask)
-  icns_bool_t           isImage;          // is this type an image
-  icns_bool_t           isMask;           // is this type a mask
-  icns_uint32_t         iconWidth;        // width of icon in pixels
-  icns_uint32_t         iconHeight;       // height of icon in pixels
-  icns_uint8_t          iconChannels;     // number of channels in data
-  icns_uint16_t         iconPixelDepth;   // number of bits-per-pixel
-  icns_uint16_t         iconBitDepth;     // overall bit depth = 
iconPixelDepth * iconChannels
-  icns_uint64_t         iconRawDataSize;  // uncompressed bytes = width * 
height * depth / bits-per-pixel
-} icns_icon_info_t;
-
-/*  icns element type constants */
-
-#define ICNS_TABLE_OF_CONTENTS        0x544F4320  // "TOC "
-
-#define ICNS_ICON_VERSION             0x69636E56  // "icnV"
-
-#define ICNS_1024x1024_32BIT_ARGB_DATA 0x69633130 // "ic10"
-
-#define ICNS_512x512_32BIT_ARGB_DATA  0x69633039  // "ic09"
-#define ICNS_256x256_32BIT_ARGB_DATA  0x69633038  // "ic08"
-
-#define ICNS_128X128_32BIT_DATA       0x69743332  // "it32"
-#define ICNS_128X128_8BIT_MASK        0x74386D6B  // "t8mk"
-
-#define ICNS_48x48_1BIT_DATA          0x69636823  // "ich#"
-#define ICNS_48x48_4BIT_DATA          0x69636834  // "ich4"
-#define ICNS_48x48_8BIT_DATA          0x69636838  // "ich8"
-#define ICNS_48x48_32BIT_DATA         0x69683332  // "ih32"
-#define ICNS_48x48_1BIT_MASK          0x69636823  // "ich#"
-#define ICNS_48x48_8BIT_MASK          0x68386D6B  // "h8mk"
-
-#define ICNS_32x32_1BIT_DATA          0x49434E23  // "ICN#"
-#define ICNS_32x32_4BIT_DATA          0x69636C34  // "icl4"
-#define ICNS_32x32_8BIT_DATA          0x69636C38  // "icl8"
-#define ICNS_32x32_32BIT_DATA         0x696C3332  // "il32"
-#define ICNS_32x32_1BIT_MASK          0x49434E23  // "ICN#"
-#define ICNS_32x32_8BIT_MASK          0x6C386D6B  // "l8mk"
-
-#define ICNS_16x16_1BIT_DATA          0x69637323  // "ics#"
-#define ICNS_16x16_4BIT_DATA          0x69637334  // "ics4"
-#define ICNS_16x16_8BIT_DATA          0x69637338  // "ics8"
-#define ICNS_16x16_32BIT_DATA         0x69733332  // "is32"
-#define ICNS_16x16_1BIT_MASK          0x69637323  // "ics#"
-#define ICNS_16x16_8BIT_MASK          0x73386D6B  // "s8mk"
-
-#define ICNS_16x12_1BIT_DATA          0x69636D23  // "icm#"
-#define ICNS_16x12_4BIT_DATA          0x69636D34  // "icm4"
-#define ICNS_16x12_1BIT_MASK          0x69636D23  // "icm#"
-#define ICNS_16x12_8BIT_DATA          0x69636D38  // "icm8"
-
-#define ICNS_32x32_1BIT_ICON          0x49434F4E  // "ICON"
-
-#define ICNS_TILE_VARIANT             0x74696C65  // "tile"
-#define ICNS_ROLLOVER_VARIANT         0x6F766572  // "over"
-#define ICNS_DROP_VARIANT             0x64726F70  // "drop"
-#define ICNS_OPEN_VARIANT             0x6F70656E  // "open"
-#define ICNS_OPEN_DROP_VARIANT        0x6F647270  // "odrp"
-
-#define ICNS_NULL_DATA                0x00000000 
-#define ICNS_NULL_MASK                0x00000000 
-
-/* icns file / resource type constants */
-
-#define ICNS_FAMILY_TYPE              0x69636E73  // "icns"
-
-#define ICNS_MACBINARY_TYPE           0x6D42494E  // "mBIN"
-
-#define ICNS_NULL_TYPE                0x00000000 
-
-/* icns error return values */
-
-#define        ICNS_STATUS_OK                0
-
-#define        ICNS_STATUS_NULL_PARAM        -1
-#define        ICNS_STATUS_NO_MEMORY         -2
-#define        ICNS_STATUS_INVALID_DATA      -3
-
-#define        ICNS_STATUS_IO_READ_ERR       1
-#define        ICNS_STATUS_IO_WRITE_ERR      2
-#define        ICNS_STATUS_DATA_NOT_FOUND    3
-#define        ICNS_STATUS_UNSUPPORTED       4
-
-/* icns function prototypes */
-/* NOTE: internal functions are found in icns_internals.h */
-
-// icns_io.c
-int icns_write_family_to_file(FILE *dataFile,icns_family_t *iconFamilyIn);
-int icns_read_family_from_file(FILE *dataFile,icns_family_t **iconFamilyOut);
-int icns_read_family_from_rsrc(FILE *rsrcFile,icns_family_t **iconFamilyOut);
-int icns_export_family_data(icns_family_t *iconFamily,icns_size_t 
*dataSizeOut,icns_byte_t **dataPtrOut);
-int icns_import_family_data(icns_size_t dataSize,icns_byte_t 
*data,icns_family_t **iconFamilyOut);
-
-// icns_family.c
-int icns_create_family(icns_family_t **iconFamilyOut);
-int icns_count_elements_in_family(icns_family_t *iconFamily, icns_sint32_t 
*elementTotal);
-
-// icns_element.c
-int icns_get_element_from_family(icns_family_t *iconFamily,icns_type_t 
iconType,icns_element_t **iconElementOut);
-int icns_set_element_in_family(icns_family_t **iconFamilyRef,icns_element_t 
*newIconElement);
-int icns_add_element_in_family(icns_family_t **iconFamilyRef,icns_element_t 
*newIconElement);
-int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t 
iconType);
-int icns_new_element_from_image(icns_image_t *imageIn,icns_type_t 
iconType,icns_element_t **iconElementOut);
-int icns_new_element_from_mask(icns_image_t *imageIn,icns_type_t 
iconType,icns_element_t **iconElementOut);
-int icns_update_element_with_image(icns_image_t *imageIn,icns_element_t 
**iconElement);
-int icns_update_element_with_mask(icns_image_t *imageIn,icns_element_t 
**iconElement);
-
-// icns_image.c
-int icns_get_image32_with_mask_from_family(icns_family_t 
*iconFamily,icns_type_t sourceType,icns_image_t *imageOut);
-int icns_get_image_from_element(icns_element_t *iconElement,icns_image_t 
*imageOut);
-int icns_get_mask_from_element(icns_element_t *iconElement,icns_image_t 
*imageOut);
-int icns_init_image_for_type(icns_type_t iconType,icns_image_t *imageOut);
-int icns_init_image(icns_uint32_t iconWidth,icns_uint32_t 
iconHeight,icns_uint32_t iconChannels,icns_uint32_t iconPixelDepth,icns_image_t 
*imageOut);
-int icns_free_image(icns_image_t *imageIn);
-
-// icns_rle24.c
-int icns_decode_rle24_data(icns_size_t rawDataSize, icns_byte_t 
*rawDataPtr,icns_size_t expectedPixelCount, icns_size_t *dataSizeOut, 
icns_byte_t **dataPtrOut);
-int icns_encode_rle24_data(icns_size_t dataSizeIn, icns_byte_t 
*dataPtrIn,icns_size_t *dataSizeOut, icns_byte_t **dataPtrOut);
-
-// icns_jp2.c
-int icns_jp2_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image_t 
*imageOut);
-int icns_image_to_jp2(icns_image_t *image, icns_size_t *dataSizeOut, 
icns_byte_t **dataPtrOut);
-
-// icns_utils.c
-icns_icon_info_t icns_get_image_info_for_type(icns_type_t iconType);
-icns_type_t icns_get_mask_type_for_icon_type(icns_type_t);
-icns_type_t icns_get_type_from_image_info(icns_icon_info_t iconInfo);
-icns_type_t icns_get_type_from_image(icns_image_t iconImage);
-icns_type_t icns_get_type_from_mask(icns_image_t iconImage);
-icns_bool_t icns_types_equal(icns_type_t typeA,icns_type_t typeB);
-icns_bool_t icns_types_not_equal(icns_type_t typeA,icns_type_t typeB);
-const char * icns_type_str(icns_type_t type, char *strbuf);
-void icns_set_print_errors(icns_bool_t shouldPrint);
-
-#endif
diff --git a/src/add-ons/translators/icns/libicns/icns_colormaps.h 
b/src/add-ons/translators/icns/libicns/icns_colormaps.h
deleted file mode 100644
index 74b9b81..0000000
--- a/src/add-ons/translators/icns/libicns/icns_colormaps.h
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
-File:       icns_colormaps.h
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-Copyright (C) 2004 Brion Vibber <brion@xxxxxxxxx>
-Copyright (C) 2007 Lyonel Vincent <lyonel@xxxxxxxx>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#ifndef _COLORMAPS_H_
-#define        _COLORMAPS_H_   1
-
-typedef struct icns_colormap_rgb_t
-{
-  icns_byte_t r;
-  icns_byte_t g;
-  icns_byte_t b;
-} icns_colormap_rgb_t;
-
-
-static const icns_colormap_rgb_t icns_colormap_4[] =
-{
-   {0xFF, 0xFF, 0xFF},
-   {0xFC, 0xF3, 0x05},
-   {0xFF, 0x64, 0x02},
-   {0xDD, 0x08, 0x06},
-   {0xF2, 0x08, 0x84},
-   {0x46, 0x00, 0xA5},
-   {0x00, 0x00, 0xD4},
-   {0x02, 0xAB, 0xEA},
-   {0x1F, 0xB7, 0x14},
-   {0x00, 0x64, 0x11},
-   {0x56, 0x2C, 0x05},
-   {0x90, 0x71, 0x3A},
-   {0xC0, 0xC0, 0xC0},
-   {0x80, 0x80, 0x80},
-   {0x40, 0x40, 0x40},
-   {0x00, 0x00, 0x00}
-};
-
-static const icns_colormap_rgb_t icns_colormap_8[] =
-{
-   {0xFF, 0xFF, 0xFF},
-   {0xFF, 0xFF, 0xCC},
-   {0xFF, 0xFF, 0x99},
-   {0xFF, 0xFF, 0x66},
-   {0xFF, 0xFF, 0x33},
-   {0xFF, 0xFF, 0x00},
-   {0xFF, 0xCC, 0xFF},
-   {0xFF, 0xCC, 0xCC},
-   {0xFF, 0xCC, 0x99},
-   {0xFF, 0xCC, 0x66},
-   {0xFF, 0xCC, 0x33},
-   {0xFF, 0xCC, 0x00},
-   {0xFF, 0x99, 0xFF},
-   {0xFF, 0x99, 0xCC},
-   {0xFF, 0x99, 0x99},
-   {0xFF, 0x99, 0x66},
-   {0xFF, 0x99, 0x33},
-   {0xFF, 0x99, 0x00},
-   {0xFF, 0x66, 0xFF},
-   {0xFF, 0x66, 0xCC},
-   {0xFF, 0x66, 0x99},
-   {0xFF, 0x66, 0x66},
-   {0xFF, 0x66, 0x33},
-   {0xFF, 0x66, 0x00},
-   {0xFF, 0x33, 0xFF},
-   {0xFF, 0x33, 0xCC},
-   {0xFF, 0x33, 0x99},
-   {0xFF, 0x33, 0x66},
-   {0xFF, 0x33, 0x33},
-   {0xFF, 0x33, 0x00},
-   {0xFF, 0x00, 0xFF},
-   {0xFF, 0x00, 0xCC},
-   {0xFF, 0x00, 0x99},
-   {0xFF, 0x00, 0x66},
-   {0xFF, 0x00, 0x33},
-   {0xFF, 0x00, 0x00},
-   {0xCC, 0xFF, 0xFF},
-   {0xCC, 0xFF, 0xCC},
-   {0xCC, 0xFF, 0x99},
-   {0xCC, 0xFF, 0x66},
-   {0xCC, 0xFF, 0x33},
-   {0xCC, 0xFF, 0x00},
-   {0xCC, 0xCC, 0xFF},
-   {0xCC, 0xCC, 0xCC},
-   {0xCC, 0xCC, 0x99},
-   {0xCC, 0xCC, 0x66},
-   {0xCC, 0xCC, 0x33},
-   {0xCC, 0xCC, 0x00},
-   {0xCC, 0x99, 0xFF},
-   {0xCC, 0x99, 0xCC},
-   {0xCC, 0x99, 0x99},
-   {0xCC, 0x99, 0x66},
-   {0xCC, 0x99, 0x33},
-   {0xCC, 0x99, 0x00},
-   {0xCC, 0x66, 0xFF},
-   {0xCC, 0x66, 0xCC},
-   {0xCC, 0x66, 0x99},
-   {0xCC, 0x66, 0x66},
-   {0xCC, 0x66, 0x33},
-   {0xCC, 0x66, 0x00},
-   {0xCC, 0x33, 0xFF},
-   {0xCC, 0x33, 0xCC},
-   {0xCC, 0x33, 0x99},
-   {0xCC, 0x33, 0x66},
-   {0xCC, 0x33, 0x33},
-   {0xCC, 0x33, 0x00},
-   {0xCC, 0x00, 0xFF},
-   {0xCC, 0x00, 0xCC},
-   {0xCC, 0x00, 0x99},
-   {0xCC, 0x00, 0x66},
-   {0xCC, 0x00, 0x33},
-   {0xCC, 0x00, 0x00},
-   {0x99, 0xFF, 0xFF},
-   {0x99, 0xFF, 0xCC},
-   {0x99, 0xFF, 0x99},
-   {0x99, 0xFF, 0x66},
-   {0x99, 0xFF, 0x33},
-   {0x99, 0xFF, 0x00},
-   {0x99, 0xCC, 0xFF},
-   {0x99, 0xCC, 0xCC},
-   {0x99, 0xCC, 0x99},
-   {0x99, 0xCC, 0x66},
-   {0x99, 0xCC, 0x33},
-   {0x99, 0xCC, 0x00},
-   {0x99, 0x99, 0xFF},
-   {0x99, 0x99, 0xCC},
-   {0x99, 0x99, 0x99},
-   {0x99, 0x99, 0x66},
-   {0x99, 0x99, 0x33},
-   {0x99, 0x99, 0x00},
-   {0x99, 0x66, 0xFF},
-   {0x99, 0x66, 0xCC},
-   {0x99, 0x66, 0x99},
-   {0x99, 0x66, 0x66},
-   {0x99, 0x66, 0x33},
-   {0x99, 0x66, 0x00},
-   {0x99, 0x33, 0xFF},
-   {0x99, 0x33, 0xCC},
-   {0x99, 0x33, 0x99},
-   {0x99, 0x33, 0x66},
-   {0x99, 0x33, 0x33},
-   {0x99, 0x33, 0x00},
-   {0x99, 0x00, 0xFF},
-   {0x99, 0x00, 0xCC},
-   {0x99, 0x00, 0x99},
-   {0x99, 0x00, 0x66},
-   {0x99, 0x00, 0x33},
-   {0x99, 0x00, 0x00},
-   {0x66, 0xFF, 0xFF},
-   {0x66, 0xFF, 0xCC},
-   {0x66, 0xFF, 0x99},
-   {0x66, 0xFF, 0x66},
-   {0x66, 0xFF, 0x33},
-   {0x66, 0xFF, 0x00},
-   {0x66, 0xCC, 0xFF},
-   {0x66, 0xCC, 0xCC},
-   {0x66, 0xCC, 0x99},
-   {0x66, 0xCC, 0x66},
-   {0x66, 0xCC, 0x33},
-   {0x66, 0xCC, 0x00},
-   {0x66, 0x99, 0xFF},
-   {0x66, 0x99, 0xCC},
-   {0x66, 0x99, 0x99},
-   {0x66, 0x99, 0x66},
-   {0x66, 0x99, 0x33},
-   {0x66, 0x99, 0x00},
-   {0x66, 0x66, 0xFF},
-   {0x66, 0x66, 0xCC},
-   {0x66, 0x66, 0x99},
-   {0x66, 0x66, 0x66},
-   {0x66, 0x66, 0x33},
-   {0x66, 0x66, 0x00},
-   {0x66, 0x33, 0xFF},
-   {0x66, 0x33, 0xCC},
-   {0x66, 0x33, 0x99},
-   {0x66, 0x33, 0x66},
-   {0x66, 0x33, 0x33},
-   {0x66, 0x33, 0x00},
-   {0x66, 0x00, 0xFF},
-   {0x66, 0x00, 0xCC},
-   {0x66, 0x00, 0x99},
-   {0x66, 0x00, 0x66},
-   {0x66, 0x00, 0x33},
-   {0x66, 0x00, 0x00},
-   {0x33, 0xFF, 0xFF},
-   {0x33, 0xFF, 0xCC},
-   {0x33, 0xFF, 0x99},
-   {0x33, 0xFF, 0x66},
-   {0x33, 0xFF, 0x33},
-   {0x33, 0xFF, 0x00},
-   {0x33, 0xCC, 0xFF},
-   {0x33, 0xCC, 0xCC},
-   {0x33, 0xCC, 0x99},
-   {0x33, 0xCC, 0x66},
-   {0x33, 0xCC, 0x33},
-   {0x33, 0xCC, 0x00},
-   {0x33, 0x99, 0xFF},
-   {0x33, 0x99, 0xCC},
-   {0x33, 0x99, 0x99},
-   {0x33, 0x99, 0x66},
-   {0x33, 0x99, 0x33},
-   {0x33, 0x99, 0x00},
-   {0x33, 0x66, 0xFF},
-   {0x33, 0x66, 0xCC},
-   {0x33, 0x66, 0x99},
-   {0x33, 0x66, 0x66},
-   {0x33, 0x66, 0x33},
-   {0x33, 0x66, 0x00},
-   {0x33, 0x33, 0xFF},
-   {0x33, 0x33, 0xCC},
-   {0x33, 0x33, 0x99},
-   {0x33, 0x33, 0x66},
-   {0x33, 0x33, 0x33},
-   {0x33, 0x33, 0x00},
-   {0x33, 0x00, 0xFF},
-   {0x33, 0x00, 0xCC},
-   {0x33, 0x00, 0x99},
-   {0x33, 0x00, 0x66},
-   {0x33, 0x00, 0x33},
-   {0x33, 0x00, 0x00},
-   {0x00, 0xFF, 0xFF},
-   {0x00, 0xFF, 0xCC},
-   {0x00, 0xFF, 0x99},
-   {0x00, 0xFF, 0x66},
-   {0x00, 0xFF, 0x33},
-   {0x00, 0xFF, 0x00},
-   {0x00, 0xCC, 0xFF},
-   {0x00, 0xCC, 0xCC},
-   {0x00, 0xCC, 0x99},
-   {0x00, 0xCC, 0x66},
-   {0x00, 0xCC, 0x33},
-   {0x00, 0xCC, 0x00},
-   {0x00, 0x99, 0xFF},
-   {0x00, 0x99, 0xCC},
-   {0x00, 0x99, 0x99},
-   {0x00, 0x99, 0x66},
-   {0x00, 0x99, 0x33},
-   {0x00, 0x99, 0x00},
-   {0x00, 0x66, 0xFF},
-   {0x00, 0x66, 0xCC},
-   {0x00, 0x66, 0x99},
-   {0x00, 0x66, 0x66},
-   {0x00, 0x66, 0x33},
-   {0x00, 0x66, 0x00},
-   {0x00, 0x33, 0xFF},
-   {0x00, 0x33, 0xCC},
-   {0x00, 0x33, 0x99},
-   {0x00, 0x33, 0x66},
-   {0x00, 0x33, 0x33},
-   {0x00, 0x33, 0x00},
-   {0x00, 0x00, 0xFF},
-   {0x00, 0x00, 0xCC},
-   {0x00, 0x00, 0x99},
-   {0x00, 0x00, 0x66},
-   {0x00, 0x00, 0x33},
-   {0xEE, 0x00, 0x00},
-   {0xDD, 0x00, 0x00},
-   {0xBB, 0x00, 0x00},
-   {0xAA, 0x00, 0x00},
-   {0x88, 0x00, 0x00},
-   {0x77, 0x00, 0x00},
-   {0x55, 0x00, 0x00},
-   {0x44, 0x00, 0x00},
-   {0x22, 0x00, 0x00},
-   {0x11, 0x00, 0x00},
-   {0x00, 0xEE, 0x00},
-   {0x00, 0xDD, 0x00},
-   {0x00, 0xBB, 0x00},
-   {0x00, 0xAA, 0x00},
-   {0x00, 0x88, 0x00},
-   {0x00, 0x77, 0x00},
-   {0x00, 0x55, 0x00},
-   {0x00, 0x44, 0x00},
-   {0x00, 0x22, 0x00},
-   {0x00, 0x11, 0x00},
-   {0x00, 0x00, 0xEE},
-   {0x00, 0x00, 0xDD},
-   {0x00, 0x00, 0xBB},
-   {0x00, 0x00, 0xAA},
-   {0x00, 0x00, 0x88},
-   {0x00, 0x00, 0x77},
-   {0x00, 0x00, 0x55},
-   {0x00, 0x00, 0x44},
-   {0x00, 0x00, 0x22},
-   {0x00, 0x00, 0x11},
-   {0xEE, 0xEE, 0xEE},
-   {0xDD, 0xDD, 0xDD},
-   {0xBB, 0xBB, 0xBB},
-   {0xAA, 0xAA, 0xAA},
-   {0x88, 0x88, 0x88},
-   {0x77, 0x77, 0x77},
-   {0x55, 0x55, 0x55},
-   {0x44, 0x44, 0x44},
-   {0x22, 0x22, 0x22},
-   {0x11, 0x11, 0x11},
-   {0x00, 0x00, 0x00}
-};
-
-#endif /*_COLORMAPS_H_ */
diff --git a/src/add-ons/translators/icns/libicns/icns_debug.c 
b/src/add-ons/translators/icns/libicns/icns_debug.c
deleted file mode 100644
index a3dd075..0000000
--- a/src/add-ons/translators/icns/libicns/icns_debug.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-File:       icns_debug.c
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "icns.h"
-#include "icns_internals.h"
-#ifdef ICNS_DEBUG
-void bin_print_byte(int x)
-{
-   int n;
-   for(n=0; n<8; n++)
-   {
-       if((x & 0x80) !=0)
-       {
-       printf("1");
-       }
-       else
-       {
-       printf("0");
-       }
-       if(n==3)
-       {
-       printf(" "); /* insert a space between nybbles */
-       }
-       x = x<<1;
-   }
-}
-
-void bin_print_int(int x)
-{
-   int hi, lo;
-   hi=(x>>8) & 0xff;
-   lo=x&0xff;
-   bin_print_byte(hi);
-   printf(" ");
-   bin_print_byte(lo);
-}
-#endif /* ifdef ICNS_DEBUG */
-
-
diff --git a/src/add-ons/translators/icns/libicns/icns_element.c 
b/src/add-ons/translators/icns/libicns/icns_element.c
deleted file mode 100644
index afc7521..0000000
--- a/src/add-ons/translators/icns/libicns/icns_element.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/*
-File:       icns_element.c
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-              2007 Thomas Lübking <thomas.luebking@xxxxxx>
-              2002 Chenxiao Zhao <chenxiao.zhao@xxxxxxxxx>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "icns.h"
-#include "icns_internals.h"
-
-
-//***************************** icns_get_element_from_family 
**************************//
-// Parses requested data from an icon family - puts it into a icon element
-
-int icns_get_element_from_family(icns_family_t *iconFamily,icns_type_t 
iconType,icns_element_t **iconElementOut)
-{
-       int             error = ICNS_STATUS_OK;
-       int             foundData = 0;
-       icns_type_t     iconFamilyType = ICNS_NULL_TYPE;
-       icns_size_t     iconFamilySize = 0;
-       icns_element_t  *iconElement = NULL;
-       icns_type_t     elementType = ICNS_NULL_TYPE;
-       icns_size_t     elementSize = 0;
-       icns_uint32_t   dataOffset = 0;
-       
-       if(iconFamily == NULL)
-       {
-               icns_print_err("icns_get_element_from_family: icns family is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(iconElementOut == NULL)
-       {
-               icns_print_err("icns_get_element_in_family: icns element out is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       else
-       {
-               *iconElementOut = NULL;
-       }
-       
-       if(iconFamily->resourceType != ICNS_FAMILY_TYPE)
-       {
-               icns_print_err("icns_get_element_from_family: Invalid icns 
family!\n");
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       ICNS_READ_UNALIGNED(iconFamilyType, &(iconFamily->resourceType),sizeof( 
icns_type_t));
-       ICNS_READ_UNALIGNED(iconFamilySize, &(iconFamily->resourceSize),sizeof( 
icns_size_t));
-       
-       #ifdef ICNS_DEBUG
-       {
-               char typeStr[5];
-               printf("Looking for icon element of type: 
'%s'\n",icns_type_str(iconType,typeStr));
-               printf("  icon family type check: 
'%s'\n",icns_type_str(iconFamilyType,typeStr));
-               printf("  icon family size check: %d\n",iconFamilySize);
-       }
-       #endif
-       
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       while ( (foundData == 0) && (dataOffset < iconFamilySize) )
-       {
-               iconElement = 
((icns_element_t*)(((icns_byte_t*)iconFamily)+dataOffset));
-               
-               if( iconFamilySize < 
(dataOffset+sizeof(icns_type_t)+sizeof(icns_size_t)) )
-               {
-                       icns_print_err("icns_get_element_from_family: Corrupted 
icns family!\n");
-                       return ICNS_STATUS_INVALID_DATA;                
-               }
-               
-               ICNS_READ_UNALIGNED(elementType, 
&(iconElement->elementType),sizeof( icns_type_t));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               
-               #ifdef ICNS_DEBUG
-               {
-                       char typeStr[5];
-                       printf("element data...\n");
-                       printf("  type: 
'%s'%s\n",icns_type_str(elementType,typeStr),(elementType == iconType) ? " - 
match!" : " ");
-                       printf("  size: %d\n",(int)elementSize);
-               }
-               #endif
-               
-               if( (elementSize < 8) || ((dataOffset+elementSize) > 
iconFamilySize) )
-               {
-                       icns_print_err("icns_get_element_from_family: Invalid 
element size! (%d)\n",elementSize);
-                       return ICNS_STATUS_INVALID_DATA;
-               }
-               
-               if(elementType == iconType)
-                       foundData = 1;
-               else
-                       dataOffset += elementSize;
-       }
-       
-       if(foundData)
-       {
-               *iconElementOut = malloc(elementSize);
-               if(*iconElementOut == NULL)
-               {
-                       icns_print_err("icns_get_element_from_family: Unable to 
allocate memory block of size: %d!\n",elementSize);
-                       return ICNS_STATUS_NO_MEMORY;
-               }
-               memcpy( *iconElementOut, iconElement, elementSize);
-       }
-       else
-       {
-               icns_print_err("icns_get_element_from_family: Unable to find 
requested icon data!\n");
-               error = ICNS_STATUS_DATA_NOT_FOUND;
-       }
-       
-       return error;
-}
-
-//***************************** icns_set_element_in_family 
**************************//
-// Adds/updates the icns element of it's type in the icon family
-
-int icns_set_element_in_family(icns_family_t **iconFamilyRef,icns_element_t 
*newIconElement)
-{
-       int             error = ICNS_STATUS_OK;
-       int             foundData = 0;
-       int             copiedData = 0;
-       icns_family_t   *iconFamily = NULL;
-       icns_type_t     iconFamilyType = ICNS_NULL_TYPE;
-       icns_size_t     iconFamilySize = 0;
-       icns_element_t  *iconElement = NULL;
-       icns_type_t     newElementType = ICNS_NULL_TYPE;
-       icns_size_t     newElementSize = 0;
-       icns_type_t     elementType = ICNS_NULL_TYPE;
-       icns_size_t     elementSize = 0;
-       icns_uint32_t   dataOffset = 0;
-       icns_size_t     newIconFamilySize = 0;
-       icns_family_t   *newIconFamily = NULL;
-       icns_uint32_t   newDataOffset = 0;
-       icns_uint32_t   elementOrder = 0;
-       icns_uint32_t   newElementOrder = 0;
-
-       
-       if(iconFamilyRef == NULL)
-       {
-               icns_print_err("icns_set_element_in_family: icns family 
reference is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       iconFamily = *iconFamilyRef;
-       
-       if(iconFamily == NULL)
-       {
-               icns_print_err("icns_set_element_in_family: icns family is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       #ifdef ICNS_DEBUG
-       printf("Setting element in icon family...\n");
-       #endif
-       
-       if(iconFamily->resourceType != ICNS_FAMILY_TYPE)
-       {
-               icns_print_err("icns_set_element_in_family: Invalid icns 
family!\n");
-               error = ICNS_STATUS_INVALID_DATA;
-       }
-       
-       ICNS_READ_UNALIGNED(iconFamilyType, &(iconFamily->resourceType),sizeof( 
icns_type_t));
-       ICNS_READ_UNALIGNED(iconFamilySize, &(iconFamily->resourceSize),sizeof( 
icns_size_t));
-       
-       #ifdef ICNS_DEBUG
-       {
-               char typeStr[5];
-               printf("  family type 
'%s'\n",icns_type_str(iconFamilyType,typeStr));
-               printf("  family size: %d 
(0x%08X)\n",(int)iconFamilySize,iconFamilySize);
-       }
-       #endif
-       
-       if(newIconElement == NULL)
-       {
-               icns_print_err("icns_set_element_in_family: icns element is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       // Retrieve first, then swap. May help with problems on some arch       
-       ICNS_READ_UNALIGNED(newElementType, 
&(newIconElement->elementType),sizeof( icns_type_t));
-       ICNS_READ_UNALIGNED(newElementSize, 
&(newIconElement->elementSize),sizeof( icns_size_t));
-       
-       #ifdef ICNS_DEBUG
-       {
-               char typeStr[5];
-               printf("  element type 
'%s'\n",icns_type_str(newElementType,typeStr));
-               printf("  element size: %d 
(0x%08X)\n",(int)newElementSize,newElementSize);
-       }
-       #endif
-       
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       while ( (foundData == 0) && (dataOffset < iconFamilySize) )
-       {
-               iconElement = 
((icns_element_t*)(((char*)iconFamily)+dataOffset));
-               ICNS_READ_UNALIGNED(elementType, 
&(iconElement->elementType),sizeof( icns_type_t));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               
-               if(elementType == newElementType)
-                       foundData = 1;
-               else
-                       dataOffset += elementSize;
-       }
-       
-       if(foundData)
-               newIconFamilySize = iconFamilySize - elementSize + 
newElementSize;
-       else
-               newIconFamilySize = iconFamilySize + newElementSize;
-       
-       #ifdef ICNS_DEBUG
-       printf("  new family type 'icns'\n");
-       printf("  new family size: %d 
(0x%08X)\n",(int)newIconFamilySize,newIconFamilySize);
-       #endif
-       
-       newIconFamily = malloc(newIconFamilySize);
-       
-       if(newIconFamily == NULL)
-       {
-               icns_print_err("icns_set_element_in_family: Unable to allocate 
memory block of size: %d!\n",newIconFamilySize);
-               return ICNS_STATUS_NO_MEMORY;
-       }
-       
-       newIconFamily->resourceType = ICNS_FAMILY_TYPE;
-       newIconFamily->resourceSize = newIconFamilySize;
-       
-       newDataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       copiedData = 0;
-       
-       newElementOrder = icns_get_element_order(newElementType);
-       
-       while ( dataOffset < iconFamilySize )
-       {
-               iconElement = 
((icns_element_t*)(((char*)iconFamily)+dataOffset));
-               ICNS_READ_UNALIGNED(elementType, 
&(iconElement->elementType),sizeof( icns_type_t));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               elementOrder = icns_get_element_order(elementType);
-               
-               if(!copiedData && (elementType == newElementType))
-               {
-                       memcpy( ((char *)(newIconFamily))+newDataOffset , (char 
*)newIconElement, newElementSize);
-                       newDataOffset += newElementSize;
-                       copiedData = 1;
-               }
-               else if(!copiedData && !foundData && newElementOrder < 
elementOrder)
-               {
-                       memcpy( ((char *)(newIconFamily))+newDataOffset , (char 
*)newIconElement, newElementSize);
-                       newDataOffset += newElementSize;
-                       copiedData = 1;
-                       
-                       memcpy( ((char *)(newIconFamily))+newDataOffset , 
((char *)(iconFamily))+dataOffset, elementSize);
-                       newDataOffset += elementSize;
-               }
-               else
-               {
-                       memcpy( ((char *)(newIconFamily))+newDataOffset , 
((char *)(iconFamily))+dataOffset, elementSize);
-                       newDataOffset += elementSize;
-               }
-               
-               dataOffset += elementSize;
-       }
-       
-       if(!copiedData)
-       {
-               memcpy( ((char *)(newIconFamily))+newDataOffset , (char 
*)newIconElement, newElementSize);
-               newDataOffset += newElementSize;
-       }
-       
-       *iconFamilyRef = newIconFamily;
-       
-       free(iconFamily);
-       
-       return error;
-}
-
-//***************************** icns_add_element_in_family 
**************************//
-// Adds/updates the icns element of it's type in the icon family
-// A convenience alias to icns_set_element_in_family
-
-int icns_add_element_in_family(icns_family_t **iconFamilyRef,icns_element_t 
*newIconElement)
-{
-       if(iconFamilyRef == NULL)
-       {
-               icns_print_err("icns_add_element_in_family: icns family 
reference is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(newIconElement == NULL)
-       {
-               icns_print_err("icns_add_element_in_family: icon element is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       return icns_set_element_in_family(iconFamilyRef,newIconElement);
-}
-
-//***************************** icns_remove_element_in_family 
**************************//
-// Parses requested data from an icon family - puts it into a "raw" image 
format
-
-int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t 
iconElementType)
-{
-       int             error = ICNS_STATUS_OK;
-       int             foundData = 0;
-       icns_family_t   *iconFamily = NULL;
-       icns_type_t     iconFamilyType = ICNS_NULL_TYPE;
-       icns_size_t     iconFamilySize = 0;
-       icns_element_t  *iconElement = NULL;
-       icns_type_t     elementType = ICNS_NULL_TYPE;
-       icns_size_t     elementSize = 0;
-       icns_uint32_t   dataOffset = 0;
-
-       icns_size_t     newIconFamilySize = 0;
-       icns_family_t   *newIconFamily = NULL;
-       icns_uint32_t   newDataOffset = 0;      
-       
-       if(iconFamilyRef == NULL)
-       {
-               icns_print_err("icns_remove_element_in_family: icon family 
reference is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       iconFamily = *iconFamilyRef;
-       
-       if(iconFamily == NULL)
-       {
-               icns_print_err("icns_remove_element_in_family: icon family is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(iconFamily->resourceType != ICNS_FAMILY_TYPE)
-       {
-               icns_print_err("icns_remove_element_in_family: Invalid icon 
family!\n");
-               error = ICNS_STATUS_INVALID_DATA;
-       }
-       
-       ICNS_READ_UNALIGNED(iconFamilyType, &(iconFamily->resourceType),sizeof( 
icns_type_t));
-       ICNS_READ_UNALIGNED(iconFamilySize, &(iconFamily->resourceSize),sizeof( 
icns_size_t));
-       
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       while ( (foundData == 0) && (dataOffset < iconFamilySize) )
-       {
-               iconElement = 
((icns_element_t*)(((char*)iconFamily)+dataOffset));
-               ICNS_READ_UNALIGNED(elementType, 
&(iconElement->elementType),sizeof( icns_type_t));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               
-               if(elementType == iconElementType)
-                       foundData = 1;
-               else
-                       dataOffset += elementSize;
-       }
-       
-       if(!foundData)
-       {
-               icns_print_err("icns_remove_element_in_family: Unable to find 
requested icon data for removal!\n");
-               return ICNS_STATUS_DATA_NOT_FOUND;
-       }
-
-       
-       newIconFamilySize = iconFamilySize - elementSize;
-       newIconFamily = malloc(newIconFamilySize);
-       
-       if(newIconFamily == NULL)
-       {
-               icns_print_err("icns_remove_element_in_family: Unable to 
allocate memory block of size: %d!\n",newIconFamilySize);
-               return ICNS_STATUS_NO_MEMORY;
-       }
-       
-       newIconFamily->resourceType = ICNS_FAMILY_TYPE;
-       newIconFamily->resourceSize = newIconFamilySize;
-       
-       newDataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       while ( dataOffset < iconFamilySize )
-       {
-               iconElement = 
((icns_element_t*)(((char*)iconFamily)+dataOffset));
-               ICNS_READ_UNALIGNED(elementType, 
&(iconElement->elementType),sizeof( icns_type_t));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               
-               if(elementType != iconElementType)
-               {
-                       memcpy( ((char *)(newIconFamily))+newDataOffset , 
((char *)(iconFamily))+dataOffset, elementSize);
-                       newDataOffset += elementSize;
-               }
-               
-               dataOffset += elementSize;
-       }
-       
-       *iconFamilyRef = newIconFamily;
-
-       free(iconFamily);
-       
-       return error;
-}
-
-
-
-//***************************** icns_new_element_from_image 
**************************//
-// Creates a new icon element from an image
-int icns_new_element_from_image(icns_image_t *imageIn,icns_type_t 
iconType,icns_element_t **iconElementOut)
-{
-       return 
icns_new_element_from_image_or_mask(imageIn,iconType,0,iconElementOut);
-}
-
-//***************************** icns_new_element_from_mask 
**************************//
-// Creates a new icon element from an image
-int icns_new_element_from_mask(icns_image_t *imageIn,icns_type_t 
iconType,icns_element_t **iconElementOut)
-{
-       return 
icns_new_element_from_image_or_mask(imageIn,iconType,1,iconElementOut);
-}
-
-
-//***************************** icns_new_element_from_image_or_mask 
**************************//
-// Creates a new icon element from an image
-int icns_new_element_from_image_or_mask(icns_image_t *imageIn,icns_type_t 
iconType,icns_bool_t isMask,icns_element_t **iconElementOut)
-{
-       icns_element_t  *newElement = NULL;
-       icns_size_t     newElementSize = 0;
-       
-       if(iconElementOut == NULL)
-       {
-               icns_print_err("icns_new_element_with_image_or_mask: Icon 
element reference is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       else
-       {
-               *iconElementOut = NULL;
-       }
-       
-       newElementSize = sizeof(icns_type_t) + sizeof(icns_size_t);
-       newElement = (icns_element_t *)malloc(newElementSize);
-       if(newElement == NULL)
-       {
-               icns_print_err("icns_new_element_with_image_or_mask: Unable to 
allocate memory block of size: %d!\n",(int)newElementSize);
-               return ICNS_STATUS_NO_MEMORY;
-       }
-       
-       newElement->elementType = iconType;
-       newElement->elementSize = newElementSize;
-       *iconElementOut = newElement;
-       
-       return 
icns_update_element_with_image_or_mask(imageIn,isMask,iconElementOut);
-}
-
-//***************************** icns_update_element_from_image 
**************************//
-// Updates an icon element with the given image
-int icns_update_element_with_image(icns_image_t *imageIn,icns_element_t 
**iconElement)
-{
-       return icns_update_element_with_image_or_mask(imageIn,0,iconElement);
-}
-
-//***************************** icns_update_element_from_mask 
**************************//
-// Updates an icon element with the given mask
-int icns_update_element_with_mask(icns_image_t *imageIn,icns_element_t 
**iconElement)
-{
-       return icns_update_element_with_image_or_mask(imageIn,1,iconElement);
-}
-
-//***************************** icns_update_element_with_image_or_mask 
**************************//
-// Updates an icon element with the given image or mask
-int icns_update_element_with_image_or_mask(icns_image_t *imageIn,icns_bool_t 
isMask,icns_element_t **iconElement)
-{
-       int                     error = ICNS_STATUS_OK;
-       icns_type_t             iconType;
-       icns_icon_info_t        iconInfo;
-
-       // Finally, done with all the preliminary checks
-       icns_size_t     imageDataSize = 0;
-       icns_byte_t     *imageDataPtr = NULL;
-       
-       // For use to easily track deallocation if we use rle24, or jp2
-       icns_size_t     newDataSize = 0;
-       icns_byte_t     *newDataPtr = NULL;
-       
-       
-       if(imageIn == NULL)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Icon 
image is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(iconElement == NULL)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Icon 
element reference is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(*iconElement == NULL)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Icon 
element is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       iconType = (*iconElement)->elementType;
-       
-       if(iconType == ICNS_NULL_DATA) {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
icon type!\n");
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       // Determine what the height and width ought to be, to check the 
incoming image
-       iconInfo = icns_get_image_info_for_type(iconType);
-       
-       // Check the image width, height, and pixel depth
-       
-       if(imageIn->imageWidth != iconInfo.iconWidth)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
input image width: %d\n",imageIn->imageWidth);
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       if(imageIn->imageWidth != iconInfo.iconWidth)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
input image width: %d\n",imageIn->imageWidth);
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       if(imageIn->imageHeight != iconInfo.iconHeight)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
input image height: %d\n",imageIn->imageHeight);
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       if(imageIn->imagePixelDepth != 
(iconInfo.iconBitDepth/iconInfo.iconChannels))
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: libicns 
does't support bit depth conversion yet.\n");
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       // Check the image data size and data pointer
-       
-       if(imageIn->imageDataSize == 0)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
input image data size: %d\n",(int)imageIn->imageDataSize);
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       if(imageIn->imageData == NULL)
-       {
-               icns_print_err("icns_update_element_with_image_or_mask: Invalid 
input image data\n");
-               return ICNS_STATUS_INVALID_DATA;
-       }
-               
-       switch(iconType)
-       {
-       case ICNS_1024x1024_32BIT_ARGB_DATA:
-       case ICNS_256x256_32BIT_ARGB_DATA:
-       case ICNS_512x512_32BIT_ARGB_DATA:
-               error = icns_image_to_jp2(imageIn,&newDataSize,&newDataPtr);
-               imageDataSize = newDataSize;
-               imageDataPtr = newDataPtr;
-               break;
-       case ICNS_128X128_32BIT_DATA:
-       case ICNS_48x48_32BIT_DATA:
-       case ICNS_32x32_32BIT_DATA:
-       case ICNS_16x16_32BIT_DATA:
-               newDataSize = imageIn->imageDataSize;
-               
-               // Note: icns_encode_rle24_data allocates memory that must be 
freed later
-               if( (error = 
icns_encode_rle24_data(imageIn->imageDataSize,imageIn->imageData,&newDataSize,&newDataPtr))
 )
-               {
-                       icns_print_err("icns_update_element_with_image_or_mask: 
Error rle encoding image data.\n");
-                       error = ICNS_STATUS_INVALID_DATA;
-               }
-               
-               imageDataSize = newDataSize;
-               imageDataPtr = newDataPtr;
-               break;
-       // Note that ICNS_NNxNN_1BIT_DATA == ICNS_NNxNN_1BIT_MASK
-       // so we do not need to put them here twice
-       case ICNS_48x48_1BIT_DATA:
-       case ICNS_32x32_1BIT_DATA:
-       case ICNS_16x16_1BIT_DATA:
-       case ICNS_16x12_1BIT_DATA:
-               {
-                       icns_byte_t     *existingData = NULL;
-                       icns_size_t     existingDataSize = 0;
-                       icns_size_t     existingDataOffset = 0;
-                       
-                       if(imageIn->imageDataSize != iconInfo.iconRawDataSize)
-                       {
-                               
icns_print_err("icns_update_element_with_image_or_mask: Invalid input image 
data size: %d!\n",imageIn->imageDataSize);
-                               return ICNS_STATUS_INVALID_DATA;
-                       }
-                       
-                       newDataSize = iconInfo.iconRawDataSize * 2;
-                       newDataPtr = (icns_byte_t *)malloc(newDataSize);
-                       if(newDataPtr == NULL)
-                       {
-                               
icns_print_err("icns_update_element_with_image_or_mask: Unable to allocate 
memory block of size: %d!\n",newDataSize);
-                               error = ICNS_STATUS_NO_MEMORY;
-                               goto exception;
-                       }
-                       
-                       memset (newDataPtr,0,newDataSize);
-                       
-                       existingData = (icns_byte_t*)(*iconElement);
-                       existingDataOffset = sizeof(icns_type_t) + 
sizeof(icns_size_t);
-                       existingDataSize = (*iconElement)->elementSize - 
existingDataOffset;
-                       
-                       // No icon data
-                       if(existingDataSize == 0)
-                       {
-                               if(isMask == 0) {
-                                       
memcpy(newDataPtr,imageIn->imageData,imageIn->imageDataSize);
-                               } else {
-                                       memcpy(newDataPtr,imageIn->imageData + 
iconInfo.iconRawDataSize,imageIn->imageDataSize);
-                               }
-                       }
-                       // Only image data
-                       else if(existingDataSize == iconInfo.iconRawDataSize)
-                       {
-                               if(isMask == 0) {
-                                       
memcpy(newDataPtr,imageIn->imageData,imageIn->imageDataSize);
-                               } else {
-                                       
memcpy(newDataPtr,existingData+existingDataOffset,iconInfo.iconRawDataSize);
-                                       memcpy(newDataPtr,imageIn->imageData + 
iconInfo.iconRawDataSize,imageIn->imageDataSize);
-                               }
-                       }
-                       // Image + Mask data
-                       else if(existingDataSize == newDataSize)
-                       {
-                               if(isMask == 0) {
-                                       
memcpy(newDataPtr,imageIn->imageData,imageIn->imageDataSize);
-                                       
memcpy(newDataPtr,existingData+existingDataOffset+iconInfo.iconRawDataSize,iconInfo.iconRawDataSize);
-                               } else {
-                                       
memcpy(newDataPtr,existingData+existingDataOffset,iconInfo.iconRawDataSize);
-                                       memcpy(newDataPtr,imageIn->imageData + 
iconInfo.iconRawDataSize,imageIn->imageDataSize);
-                               }
-                       }
-                       else
-                       {
-                               
icns_print_err("icns_update_element_with_image_or_mask: Unexpected element data 
size: %d!\n",existingDataSize);
-                               error = ICNS_STATUS_INVALID_DATA;
-                               goto exception;
-                       }
-                       
-                       imageDataSize = newDataSize;
-                       imageDataPtr = newDataPtr;
-               }
-               break;
-       default:
-               imageDataSize = imageIn->imageDataSize;
-               imageDataPtr = imageIn->imageData;
-               break;
-       }
-       
-       if(error == ICNS_STATUS_OK)
-       {
-               icns_element_t  *newElement = NULL;
-               icns_size_t     newElementSize = 0;
-               icns_type_t     newElementType = ICNS_NULL_DATA;
-               icns_size_t     newElementHeaderSize = 0;
-               
-               if(imageDataSize == 0)
-               {
-                       icns_print_err("icns_update_element_with_image_or_mask: 
Image data size should not be 0!\n");
-                       error = ICNS_STATUS_INVALID_DATA;
-                       goto exception;
-               }
-               
-               if(imageDataPtr == NULL)
-               {
-                       icns_print_err("icns_update_element_with_image_or_mask: 
Image data should not be NULL!\n");
-                       error = ICNS_STATUS_INVALID_DATA;
-                       goto exception;
-               }
-
-               // Set up and create the new element
-               newElementHeaderSize = sizeof(icns_type_t) + 
sizeof(icns_size_t);
-               newElementSize = newElementHeaderSize + imageDataSize;
-               newElementType = iconType;
-               
-               newElement = (icns_element_t *)malloc(newElementSize);
-               
-               if(newElement == NULL)
-               {
-                       icns_print_err("icns_update_element_with_image_or_mask: 
Unable to allocate memory block of size: %d!\n",(int)newElementSize);
-                       error = ICNS_STATUS_NO_MEMORY;
-                       goto exception;
-               }
-               
-               // Set up the element info
-               newElement->elementType = newElementType;
-               newElement->elementSize = newElementSize;
-               
-               #ifdef ICNS_DEBUG
-               {
-                       char typeStr[5];
-                       printf(" updated element data...\n");
-                       printf("  type: 
'%s'\n",icns_type_str(newElementType,typeStr));
-                       printf("  size: %d\n",(int)newElementSize);
-               }
-               #endif          
-               
-               // Copy in the image data
-               memcpy(newElement->elementData,imageDataPtr,imageDataSize);
-               
-               // Free the old element...
-               if(*iconElement != NULL)
-                       free(*iconElement);
-               
-               // and move the pointer to the new element
-               *iconElement = newElement;
-       }
-       
-exception:
-       
-       // We might have allocated new memory earlier...
-       if(newDataPtr != NULL)
-       {
-               free(newDataPtr);
-               newDataPtr = NULL;
-       }
-       
-       return error;
-}
diff --git a/src/add-ons/translators/icns/libicns/icns_family.c 
b/src/add-ons/translators/icns/libicns/icns_family.c
deleted file mode 100644
index bcc4d70..0000000
--- a/src/add-ons/translators/icns/libicns/icns_family.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-File:       icns_family.c
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-              2007 Thomas Lübking <thomas.luebking@xxxxxx>
-              2002 Chenxiao Zhao <chenxiao.zhao@xxxxxxxxx>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "icns.h"
-#include "icns_internals.h"
-
-/***************************** icns_create_family **************************/
-
-int icns_create_family(icns_family_t **iconFamilyOut)
-{
-       icns_family_t   *newIconFamily = NULL;
-       icns_type_t             iconFamilyType = ICNS_NULL_TYPE;
-       icns_size_t             iconFamilySize = 0;
-
-       if(iconFamilyOut == NULL)
-       {
-               icns_print_err("icns_create_family: icon family reference is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       *iconFamilyOut = NULL;
-       
-       iconFamilyType = ICNS_FAMILY_TYPE;
-       iconFamilySize = sizeof(icns_type_t) + sizeof(icns_size_t);
-
-       newIconFamily = malloc(iconFamilySize);
-               
-       if(newIconFamily == NULL)
-       {
-               icns_print_err("icns_create_family: Unable to allocate memory 
block of size: %d!\n",iconFamilySize);
-               return ICNS_STATUS_NO_MEMORY;
-       }
-       
-       ICNS_WRITE_UNALIGNED(&(newIconFamily->resourceType), iconFamilyType, 
sizeof(icns_type_t));
-       ICNS_WRITE_UNALIGNED(&(newIconFamily->resourceSize), iconFamilySize, 
sizeof(icns_size_t));
-
-       *iconFamilyOut = newIconFamily;
-       
-       return ICNS_STATUS_OK;
-}
-
-
-/***************************** icns_count_elements_in_family 
**************************/
-
-int icns_count_elements_in_family(icns_family_t *iconFamily, icns_sint32_t 
*elementTotal)
-{
-       icns_type_t            iconFamilyType = ICNS_NULL_TYPE;
-       icns_size_t            iconFamilySize = 0;
-       icns_uint32_t          dataOffset = 0;
-       icns_uint32_t          elementCount = 0;
-
-       if(iconFamily == NULL)
-       {
-               icns_print_err("icns_count_elements_in_family: icns family is 
NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-
-       if(elementTotal == NULL)
-       {
-               icns_print_err("icns_count_elements_in_family: element count 
ref is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-
-       ICNS_READ_UNALIGNED(iconFamilyType, &(iconFamily->resourceType),sizeof( 
icns_type_t));
-       ICNS_READ_UNALIGNED(iconFamilySize, &(iconFamily->resourceSize),sizeof( 
icns_size_t));
-       
-       dataOffset = sizeof(icns_type_t) + sizeof(icns_size_t);
-       
-       while( dataOffset < iconFamilySize )
-       {
-               icns_element_t         *iconElement = NULL;
-               icns_size_t            elementSize = 0;
-
-               iconElement = 
((icns_element_t*)(((char*)iconFamily)+dataOffset));
-               ICNS_READ_UNALIGNED(elementSize, 
&(iconElement->elementSize),sizeof( icns_size_t));
-               
-               elementCount++;
-
-               dataOffset += elementSize;
-       }
-
-       *elementTotal = elementCount;
-
-       return ICNS_STATUS_OK;
-}
-
-
diff --git a/src/add-ons/translators/icns/libicns/icns_image.c 
b/src/add-ons/translators/icns/libicns/icns_image.c
deleted file mode 100644
index 5b596b5..0000000
--- a/src/add-ons/translators/icns/libicns/icns_image.c
+++ /dev/null
@@ -1,794 +0,0 @@
-/*
-File:       icns_image.c
-Copyright (C) 2001-2012 Mathew Eis <mathew@xxxxxxxxxx>
-              2007 Thomas Lübking <thomas.luebking@xxxxxx>
-              2002 Chenxiao Zhao <chenxiao.zhao@xxxxxxxxx>
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Lesser General Public
-License as published by the Free Software Foundation; either
-version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public
-License along with this library; if not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
-Boston, MA 02110-1301, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "icns.h"
-#include "icns_internals.h"
-#include "icns_colormaps.h"
-
-
-int icns_get_image32_with_mask_from_family(icns_family_t 
*iconFamily,icns_type_t iconType,icns_image_t *imageOut)
-{
-       int             error = ICNS_STATUS_OK;
-       icns_type_t     maskType = ICNS_NULL_TYPE;
-       icns_element_t  *iconElement = NULL;
-       icns_element_t  *maskElement = NULL;
-       icns_image_t    iconImage;
-       icns_image_t    maskImage;
-       unsigned long   dataCount = 0;
-       icns_byte_t     dataValue = 0;
-       unsigned long   pixelCount = 0;
-       unsigned long   pixelID = 0;
-       icns_byte_t     colorIndex = 0; 
-       
-       memset ( &iconImage, 0, sizeof(icns_image_t) );
-       memset ( &maskImage, 0, sizeof(icns_image_t) );
-       
-       if(iconFamily == NULL)
-       {
-               icns_print_err("icns_get_image32_with_mask_from_family: Icon 
family is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       
-       if(imageOut == NULL)
-       {
-               icns_print_err("icns_get_image32_with_mask_from_family: Icon 
image is NULL!\n");
-               return ICNS_STATUS_NULL_PARAM;
-       }
-       else
-       {
-               icns_free_image(imageOut);
-       }
-       
-       #ifdef ICNS_DEBUG
-       {
-               char typeStr[5];
-               printf("Making 32-bit image...\n");
-               printf("  using icon type 
'%s'\n",icns_type_str(iconType,typeStr));
-       }
-       #endif
-       
-       
-       if((iconType == ICNS_128X128_8BIT_MASK) || \
-       (iconType == ICNS_48x48_8BIT_MASK) || \
-       (iconType == ICNS_32x32_8BIT_MASK) || \
-       (iconType == ICNS_16x16_8BIT_MASK) )
-       {
-               icns_print_err("icns_get_image32_with_mask_from_family: Can't 
make an image with mask from a mask\n");
-               return ICNS_STATUS_INVALID_DATA;
-       }
-       
-       // Preliminaries checked - carry on with the icon/mask merge
-       
-       // Load icon element then image
-       error = icns_get_element_from_family(iconFamily,iconType,&iconElement);
-       
-       if(error) {
-               icns_print_err("icns_get_image32_with_mask_from_family: Unable 
to load icon element from icon family!\n");
-               goto cleanup;
-       }
-       
-       error = icns_get_image_from_element(iconElement,&iconImage);
-       
-       if(error) {
-               icns_print_err("icns_get_image32_with_mask_from_family: Unable 
to load icon image data from icon element!\n");
-               goto cleanup;
-       }
-       
-       // We used the jp2 processor for these two, so we're done!
-       if( (iconType == ICNS_256x256_32BIT_ARGB_DATA) || (iconType == 
ICNS_512x512_32BIT_ARGB_DATA) || (iconType == ICNS_1024x1024_32BIT_ARGB_DATA) ) 
{
-               memcpy(imageOut,&iconImage,sizeof(icns_image_t));
-               if(iconElement != NULL) {
-               free(iconElement);
-               iconElement = NULL;
-               }
-               return error;
-       }
-       
-       maskType = icns_get_mask_type_for_icon_type(iconType);
-       
-       #ifdef ICNS_DEBUG
-       {
-               char typeStr[5];
-               printf("  using mask type 
'%s'\n",icns_type_str(maskType,typeStr));
-       }
-       #endif
-       
-       if( (maskType == ICNS_NULL_DATA) )
-       {
-               char typeStr[5];
-               icns_print_err("icns_get_image32_with_mask_from_family: Can't 
find mask for type '%s'\n",icns_type_str(iconType,typeStr));
-               return ICNS_STATUS_DATA_NOT_FOUND;
-       }
-       
-       // Load mask element then image...
-       error = icns_get_element_from_family(iconFamily,maskType,&maskElement);
-       
-       // Note that we could arguably recover from not having a mask

[ *** diff truncated: 22391 lines dropped *** ]



Other related posts:

  • » [haiku-commits] haiku: hrev47747 - in src/add-ons/translators/icns: openjpeg libicns - jerome . duval