File png2ico-boost.patch of Package png2ico
--- png2ico/png2ico.cpp 2002-12-07 23:37:58.000000000 +0100
+++ png2ico/png2ico.cpp 2013-05-05 23:02:14.072440147 +0200
@@ -36,19 +36,15 @@
#include <vector>
#include <climits>
-#if __GNUC__ > 2
-#include <ext/hash_map>
-#else
-#include <hash_map>
-#endif
+#include <boost/unordered_map.hpp>
+#include <string.h>
#include <png.h>
#include "VERSION"
using namespace std;
-namespace __gnu_cxx{};
-using namespace __gnu_cxx;
+using namespace boost;
const int word_max=65535;
const int transparency_threshold=196;
@@ -146,7 +142,7 @@
//if an alpha channel is present, set all transparent pixels to RGBA (0,0,0,0)
//transparent pixels will already be mapped to palette entry 0, non-transparent
//pixels will not get a mapping yet (-1)
- hash_map<unsigned int,signed int> mapQuadToPalEntry;
+ unordered_map<unsigned int,signed int> mapQuadToPalEntry;
png_bytep* row_pointers=png_get_rows(img.png_ptr, img.info_ptr);
for (int y=img.height-1; y>=0; --y)
@@ -209,11 +205,11 @@
unsigned int mostDifferentQuad=0;
int mdqMinDist=-1; //smallest distance to an entry in the palette for mostDifferentQuad
int mdqDistSum=-1; //sum over all distances to palette entries for mostDifferentQuad
- hash_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
- hash_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
+ unordered_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
+ unordered_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
while(iter!=stop)
{
- hash_map<unsigned int,signed int>::value_type& mapping=*iter++;
+ unordered_map<unsigned int,signed int>::value_type& mapping=*iter++;
if (mapping.second<0)
{
unsigned int quad=mapping.first;
@@ -256,11 +252,11 @@
};
//Now map all yet unmapped colors to the most appropriate palette entry
- hash_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
- hash_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
+ unordered_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
+ unordered_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
while(iter!=stop)
{
- hash_map<unsigned int,signed int>::value_type& mapping=*iter++;
+ unordered_map<unsigned int,signed int>::value_type& mapping=*iter++;
if (mapping.second<0)
{
unsigned int quad=mapping.first;
@@ -292,11 +288,11 @@
int green=0;
int blue=0;
int numMappings=0;
- hash_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
- hash_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
+ unordered_map<unsigned int,signed int>::iterator stop=mapQuadToPalEntry.end();
+ unordered_map<unsigned int,signed int>::iterator iter=mapQuadToPalEntry.begin();
while(iter!=stop)
{
- hash_map<unsigned int,signed int>::value_type& mapping=*iter++;
+ unordered_map<unsigned int,signed int>::value_type& mapping=*iter++;
if (mapping.second==i)
{
unsigned int quad=mapping.first;
@@ -322,7 +318,7 @@
iter=mapQuadToPalEntry.begin();
while(iter!=stop)
{
- hash_map<unsigned int,signed int>::value_type& mapping=*iter++;
+ unordered_map<unsigned int,signed int>::value_type& mapping=*iter++;
unsigned int quad=mapping.first;
if ((quad>>24)!=0) //if color is not transparent
{