mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-16 16:50:06 +02:00
155 lines
5.0 KiB
Plaintext
155 lines
5.0 KiB
Plaintext
From 3a6d8929a6b6bd735c21738df62dfd87dbb7ac2e Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Tue, 26 Aug 2014 15:58:58 +0000
|
|
Subject: gcc2 patch
|
|
|
|
|
|
diff --git a/icnsutils/icns2png.c b/icnsutils/icns2png.c
|
|
index cd53545..a4d7c91 100644
|
|
--- a/icnsutils/icns2png.c
|
|
+++ b/icnsutils/icns2png.c
|
|
@@ -316,7 +316,7 @@ int ExtractAndDescribeIconFamilyFile(char *filepath)
|
|
filenamelength = filepathlength-filenamestart;
|
|
memcpy(&filename[0],&filepath[filenamestart],filenamelength);
|
|
filename[filenamelength] = 0;
|
|
-
|
|
+{
|
|
// Set up the output filepath...
|
|
unsigned int outputpathlength = 0;
|
|
unsigned int filepathstart = filepathlength;
|
|
@@ -379,7 +379,7 @@ int ExtractAndDescribeIconFamilyFile(char *filepath)
|
|
outfileprefixlength += (filepathend - filepathstart);
|
|
outfileprefix[outfileprefixlength] = 0;
|
|
}
|
|
-
|
|
+}
|
|
printf("----------------------------------------------------\n");
|
|
printf("Reading icns family from %s...\n",filepath);
|
|
|
|
diff --git a/icnsutils/icontainer2icns.c b/icnsutils/icontainer2icns.c
|
|
index 70c12dc..2facef7 100644
|
|
--- a/icnsutils/icontainer2icns.c
|
|
+++ b/icnsutils/icontainer2icns.c
|
|
@@ -38,6 +38,15 @@ static inline int isChar(char c) {
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
+ char buffer[118];
|
|
+ FILE *icontainer = NULL;
|
|
+ FILE *icns = NULL;
|
|
+ short i = 0;
|
|
+
|
|
+ //int iconCounter = 0;
|
|
+ int c;
|
|
+ char name[256];
|
|
+
|
|
printf("icontainer2icns, (C) 2005/2007 by Thomas Lübking\n\n");
|
|
if (argc < 2) {
|
|
printf("\nusage: icontainer2icns foo.icontainer\n\n");
|
|
@@ -47,14 +56,6 @@ int main(int argc, char **argv)
|
|
printf("\nusage: icontainer2icns foo.icontainer\nif your icontainer file contains spaces etc.,\nuse a system valid form (i.e. use \"my foo.icontainer\" or my\\ foo.icontainer)\n\n");
|
|
return -1;
|
|
}
|
|
- char buffer[118];
|
|
- FILE *icontainer = NULL;
|
|
- FILE *icns = NULL;
|
|
- short i = 0;
|
|
-
|
|
- //int iconCounter = 0;
|
|
- int c;
|
|
- char name[256];
|
|
|
|
if( (icontainer = fopen(argv[1], "r")) == NULL ) {
|
|
printf("error while opening file %s\n",argv[1]);
|
|
@@ -74,13 +75,13 @@ int main(int argc, char **argv)
|
|
if ((c = getc(icontainer)) == 'c') {
|
|
if ((c = getc(icontainer)) == 'n') {
|
|
if ((c = getc(icontainer)) == 's') { // yupp!
|
|
+ short j;
|
|
+ short k = 0;
|
|
if (icns) fclose(icns); // buffer only contains new icns info
|
|
// generate the name
|
|
// i - 7 .. i - 2 is the icontainer id
|
|
// could be 56-4, so no memcpy please!
|
|
// printf("%s\n",buffer);
|
|
- short j;
|
|
- short k = 0;
|
|
if (buffer[clamp(i-1)] == ']') {
|
|
j = clamp(i-7);
|
|
for (k = 0; k < 6; j = clamp(++j)) {
|
|
diff --git a/src/icns_element.c b/src/icns_element.c
|
|
index 1b08668..fc4d44b 100644
|
|
--- a/src/icns_element.c
|
|
+++ b/src/icns_element.c
|
|
@@ -330,6 +330,9 @@ int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t icon
|
|
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)
|
|
{
|
|
@@ -374,10 +377,6 @@ int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t icon
|
|
return ICNS_STATUS_DATA_NOT_FOUND;
|
|
}
|
|
|
|
- icns_size_t newIconFamilySize = 0;
|
|
- icns_family_t *newIconFamily = NULL;
|
|
- icns_uint32_t newDataOffset = 0;
|
|
-
|
|
newIconFamilySize = iconFamilySize - elementSize;
|
|
newIconFamily = malloc(newIconFamilySize);
|
|
|
|
@@ -485,6 +484,12 @@ int icns_update_element_with_image_or_mask(icns_image_t *imageIn,icns_bool_t isM
|
|
int error = ICNS_STATUS_OK;
|
|
icns_type_t iconType;
|
|
icns_icon_info_t iconInfo;
|
|
+ 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)
|
|
{
|
|
@@ -555,12 +560,6 @@ int icns_update_element_with_image_or_mask(icns_image_t *imageIn,icns_bool_t isM
|
|
}
|
|
|
|
// 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;
|
|
|
|
switch(iconType)
|
|
{
|
|
diff --git a/src/icns_png.c b/src/icns_png.c
|
|
index a5b26e3..2100438 100644
|
|
--- a/src/icns_png.c
|
|
+++ b/src/icns_png.c
|
|
@@ -52,7 +52,7 @@ int icns_png_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image_t *
|
|
int32_t color_type;
|
|
int row;
|
|
int rowsize;
|
|
-
|
|
+ icns_png_io_ref io_data = { dataPtr, dataSize, 0 };
|
|
|
|
if(dataPtr == NULL)
|
|
{
|
|
@@ -96,7 +96,6 @@ int icns_png_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image_t *
|
|
}
|
|
|
|
// set libpng to read from memory
|
|
- icns_png_io_ref io_data = { dataPtr, dataSize, 0 };
|
|
png_set_read_fn(png_ptr, (void *)&io_data, &icns_png_read_memory);
|
|
|
|
png_read_info(png_ptr, info_ptr);
|
|
--
|
|
1.8.3.4
|
|
|