summaryrefslogtreecommitdiff
path: root/graphics/cinepaint/patches/patch-ad
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/cinepaint/patches/patch-ad')
-rw-r--r--graphics/cinepaint/patches/patch-ad353
1 files changed, 353 insertions, 0 deletions
diff --git a/graphics/cinepaint/patches/patch-ad b/graphics/cinepaint/patches/patch-ad
new file mode 100644
index 00000000000..24a0f6dd8c6
--- /dev/null
+++ b/graphics/cinepaint/patches/patch-ad
@@ -0,0 +1,353 @@
+$NetBSD: patch-ad,v 1.1 2005/03/16 18:32:50 rillig Exp $
+
+gcc-2.95.3 cannot handle declarations intermixed with code.
+
+--- app/cms.c.orig Tue Nov 23 12:58:15 2004
++++ app/cms.c Wed Mar 16 18:11:19 2005
+@@ -202,7 +202,12 @@ erase_alpha_from_4th_color (CMSTransform
+ * called from app_procs.c:app_init()
+ */
+ void cms_init()
+-{ profile_cache = g_hash_table_new(g_str_hash, g_str_equal);
++{
++ GList *remove_settings = NULL;
++ GList *update_settings = NULL;
++ cmsHPROFILE test = NULL;
++
++ profile_cache = g_hash_table_new(g_str_hash, g_str_equal);
+ transform_cache = g_hash_table_new(g_str_hash, g_str_equal);
+ profile_info_buffer = g_new(CMSProfileInfo, 1);
+ profile_info_buffer->manufacturer = NULL;
+@@ -216,9 +221,6 @@ void cms_init()
+ /* suppress lcms errors while checking */
+ cmsErrorAction(LCMS_ERROR_IGNORE);
+
+- GList *remove_settings = NULL;
+- GList *update_settings = NULL;
+- cmsHPROFILE test = NULL;
+
+ /* 1. image profile */
+ if (cms_default_image_profile_name != NULL)
+@@ -476,11 +478,12 @@ cms_read_icc_profile_dir(gchar *path, ic
+ while ((entry = readdir (dir)))
+ { char *file_name = entry->d_name;
+ cmsHPROFILE profile;
++ GString *file_path;
+ if ((strcmp (file_name, "..") == 0) || (strcmp (file_name, ".") == 0))
+ { continue;
+ }
+
+- GString *file_path = g_string_new(NULL);
++ file_path = g_string_new(NULL);
+ g_string_sprintf (file_path, "%s/%s", path, file_name);
+
+ /* Open the file and try to read it using the lcms library
+@@ -517,6 +520,7 @@ cms_read_standard_profile_dirs(icProfile
+ const char *home = GetDirHome();
+ char *directories = g_strdup(cms_profile_path);
+ GString *file_path = g_string_new(NULL);
++ GSList *sub_list;
+
+ /* process path by path, paths are separated by : */
+ char *remaining_directories = directories;
+@@ -531,7 +535,7 @@ cms_read_standard_profile_dirs(icProfile
+ { path = strdup(token);
+ }
+
+- GSList *sub_list = cms_read_icc_profile_dir(path, class);
++ sub_list = cms_read_icc_profile_dir(path, class);
+ return_list = g_slist_concat(return_list, sub_list);
+
+ g_free(path);
+@@ -673,6 +677,7 @@ cms_load_profile_to_mem (char* filename,
+ CMSProfile *
+ cms_get_profile_from_file(char *file_name)
+ { CMSProfile *return_value;
++ ProfileCacheEntry *cache_entry;
+
+ /* get profile information */
+ cmsHPROFILE profile = cmsOpenProfileFromFile (file_name, "r");
+@@ -682,7 +687,7 @@ cms_get_profile_from_file(char *file_nam
+ }
+
+ /* check hash table for profile */
+- ProfileCacheEntry *cache_entry = g_hash_table_lookup(profile_cache,
++ cache_entry = g_hash_table_lookup(profile_cache,
+ (gpointer) cms_get_long_profile_info(profile));
+ if (cache_entry != NULL)
+ { cache_entry->ref_count ++;
+@@ -719,7 +724,8 @@ cms_get_profile_from_file(char *file_nam
+ CMSProfile *
+ cms_get_profile_from_mem(void *mem_pointer, DWORD size)
+ { CMSProfile *return_value;
+-
++ ProfileCacheEntry *cache_entry;
++
+ /* get profile information */
+ cmsHPROFILE profile = cmsOpenProfileFromMem (mem_pointer, size);
+ if (profile == NULL)
+@@ -728,7 +734,7 @@ cms_get_profile_from_mem(void *mem_point
+ }
+
+ /* check hash table for profile */
+- ProfileCacheEntry *cache_entry = g_hash_table_lookup(profile_cache,
++ cache_entry = g_hash_table_lookup(profile_cache,
+ (gpointer) cms_get_long_profile_info(profile));
+ if (cache_entry != NULL)
+ { cache_entry->ref_count ++;
+@@ -788,6 +794,7 @@ cms_get_profile_data(CMSProfile *profile
+ CMSProfile *
+ cms_get_lab_profile(LPcmsCIExyY white_point)
+ { CMSProfile *return_value;
++ ProfileCacheEntry *cache_entry;
+
+ GString *hash_key = g_string_new(NULL);
+ if (white_point)
+@@ -797,7 +804,7 @@ cms_get_lab_profile(LPcmsCIExyY white_po
+ { g_string_sprintf(hash_key, "###LAB###");
+ }
+
+- ProfileCacheEntry *cache_entry = g_hash_table_lookup(profile_cache, (gpointer) hash_key);
++ cache_entry = g_hash_table_lookup(profile_cache, (gpointer) hash_key);
+ if (cache_entry != NULL)
+ { cache_entry->ref_count ++;
+ return_value = cache_entry->profile;
+@@ -970,12 +977,13 @@ cms_return_profile(CMSProfile *profile)
+ { /* search the cache for the profile
+ * decreate ref_counter + possibly close profile
+ */
++ ProfileCacheEntry *entry;
+ if (profile == NULL)
+ { g_warning("cms_return_profile: profile is NULL");
+ return FALSE;
+ }
+
+- ProfileCacheEntry *entry = g_hash_table_lookup(profile_cache, (gpointer)profile->cache_key);
++ entry = g_hash_table_lookup(profile_cache, (gpointer)profile->cache_key);
+ if (entry == NULL)
+ { g_warning("cms_return_profile: profile not found in cache");
+ return FALSE;
+@@ -1008,7 +1016,18 @@ cms_get_transform(GSList *profiles,
+ { /* turn profiles into an array as needed by lcms +
+ check all profiles are registered with the profile cache +
+ create hash key to check transform cache */
++
++ int i;
++ GString *hash_key;
++ CMSProfile *current_profile;
++ GSList *iterator;
++ TransformCacheEntry *cache_entry;
++ cmsHTRANSFORM transform;
++ cmsHPROFILE devicelink;
++ char *file_name;
++
+ int num_profiles = g_slist_length(profiles);
++ cmsHPROFILE profile_array[num_profiles];
+ if (num_profiles == 0)
+ { g_warning("cms_get_transform: profile list is empty, cannot create transfrom");
+ return NULL;
+@@ -1028,12 +1047,9 @@ cms_get_transform(GSList *profiles,
+ return NULL;
+ }
+
+- cmsHPROFILE profile_array[num_profiles];
+- GString *hash_key = g_string_new(NULL);
++ hash_key = g_string_new(NULL);
+
+- int i;
+- CMSProfile *current_profile;
+- GSList *iterator = profiles;
++ iterator = profiles;
+ for (i=0; ((i<num_profiles) && (iterator !=NULL)); i++)
+ { current_profile = (CMSProfile *)iterator->data;
+ if (g_hash_table_lookup(profile_cache, (gpointer)current_profile->cache_key) == NULL)
+@@ -1050,7 +1066,7 @@ cms_get_transform(GSList *profiles,
+ lcms_intent, lcms_flags);
+
+ /* now check the cache */
+- TransformCacheEntry *cache_entry = g_hash_table_lookup(transform_cache, (gpointer) hash_key->str);
++ cache_entry = g_hash_table_lookup(transform_cache, (gpointer) hash_key->str);
+
+ /* if it was in the disc cache */
+ if (cache_entry != NULL)
+@@ -1079,7 +1095,6 @@ cms_get_transform(GSList *profiles,
+ }
+
+ /* if no cache hit, create transform */
+- cmsHTRANSFORM transform;
+ transform = cmsCreateMultiprofileTransform (profile_array,
+ num_profiles,
+ lcms_input_format,
+@@ -1093,8 +1108,8 @@ cms_get_transform(GSList *profiles,
+ }
+
+ /* save it to disk */
+- cmsHPROFILE devicelink = cmsTransform2DeviceLink(transform,0);
+- char *file_name = file_temp_name("icc");
++ devicelink = cmsTransform2DeviceLink(transform,0);
++ file_name = file_temp_name("icc");
+ _cmsSaveProfile(devicelink, file_name);
+ cmsCloseProfile(devicelink);
+
+@@ -1218,6 +1233,12 @@ cms_set_display_profile(CMSProfile *prof
+ void
+ cms_transform_area(CMSTransform *transform, PixelArea *src_area, PixelArea *dest_area)
+ { TransformFunc transform_func;
++ PixelRow src_row_buffer, dest_row_buffer;
++ guint h;
++ void *src_data, *dest_data;
++ guint num_pixels;
++ void *pag;
++
+ Tag src_tag = pixelarea_tag(src_area);
+ Tag dest_tag = pixelarea_tag(dest_area);
+ if (tag_precision(src_tag) != tag_precision(dest_tag))
+@@ -1245,12 +1266,6 @@ cms_transform_area(CMSTransform *transfo
+ }
+
+
+- PixelRow src_row_buffer, dest_row_buffer;
+- guint h;
+- void *src_data, *dest_data;
+- guint num_pixels;
+- void *pag;
+-
+ for (pag = pixelarea_register (1, src_area, dest_area);
+ pag != NULL;
+ pag = pixelarea_process (pag))
+@@ -1321,6 +1336,9 @@ void
+ cms_transform_float(CMSTransform *transform, void *src_data, void *dest_data, int num_pixels)
+ { /* need to convert data to double for lcms's convenience */
+ int i;
++ float *src_fbuffer, *dest_fbuffer;
++ double *dbuffer;
++
+ if (transform <= 1 || !transform->handle)
+ g_warning ("%s:%d %s() transform not allocated\n",
+ __FILE__,__LINE__,__func__);
+@@ -1328,9 +1346,9 @@ cms_transform_float(CMSTransform *transf
+ g_warning ("%s:%d %s() array not allocated\n",
+ __FILE__,__LINE__,__func__);
+
+- float *src_fbuffer = (float *)src_data;
+- float *dest_fbuffer = (float *)dest_data;
+- double *dbuffer = malloc(sizeof(double) * num_pixels * 4);
++ src_fbuffer = (float *)src_data;
++ dest_fbuffer = (float *)dest_data;
++ dbuffer = malloc(sizeof(double) * num_pixels * 4);
+ for (i=0; i < num_pixels * 4; i++)
+ { dbuffer[i]=(double)src_fbuffer[i];
+ }
+@@ -1371,10 +1389,14 @@ static GtkWidget *cms_profile_menu_new(G
+ { GtkWidget *menu;
+ GtkWidget *menuitem;
+ GtkWidget *optionmenu;
++
++ gchar *current_filename;
++ CMSProfile *current_profile;
++ CMSProfileInfo *current_profile_info;
+
+- menu = gtk_menu_new ();
+ GSList *profile_file_names = cms_read_standard_profile_dirs(CMS_ANY_PROFILECLASS);
+ GSList *iterator = profile_file_names;
++ menu = gtk_menu_new ();
+
+ if (can_select_none)
+ { menuitem = gtk_menu_item_new_with_label("[none]");
+@@ -1382,9 +1404,6 @@ static GtkWidget *cms_profile_menu_new(G
+ gtk_object_set_data(GTK_OBJECT(menuitem), "value", NULL);
+ }
+
+- gchar *current_filename;
+- CMSProfile *current_profile;
+- CMSProfileInfo *current_profile_info;
+ while (iterator != NULL)
+ { current_filename = iterator->data;
+ current_profile = cms_get_profile_from_file(current_filename);
+@@ -1414,8 +1433,8 @@ static GtkWidget *cms_intent_menu_new(Gt
+ GtkWidget *menuitem = NULL;
+ GtkWidget *optionmenu = NULL;
+
+- menu = gtk_menu_new ();
+ guint8 *value = NULL;
++ menu = gtk_menu_new ();
+
+ menuitem = gtk_menu_item_new_with_label ("Perceptual");
+ gtk_menu_append (GTK_MENU (menu), menuitem);
+@@ -1593,6 +1612,8 @@ cms_assign_dialog(GImage *image)
+ GtkWidget *label = NULL;
+ GtkWidget *vbox = NULL;
+ GtkWidget *alignment = NULL;
++ CMSProfile *current_profile;
++ GString *profile_string;
+
+ CMSAssignDialogData *data=g_new(CMSAssignDialogData,1);
+ data->image = image;
+@@ -1608,8 +1629,8 @@ cms_assign_dialog(GImage *image)
+ table = gtk_table_new(3, 1, FALSE);
+ gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
+
+- CMSProfile *current_profile = gimage_get_cms_profile(image);
+- GString *profile_string = g_string_new(NULL);
++ current_profile = gimage_get_cms_profile(image);
++ profile_string = g_string_new(NULL);
+
+ if (current_profile == NULL)
+ { g_string_sprintf (profile_string, "[The currently assigned profile is: [none]]");
+@@ -1700,6 +1721,7 @@ cms_open_assign_dialog(GImage *image)
+ GSList *radiogroup = NULL;
+ GtkWidget *vbox = NULL;
+ GtkWidget *alignment = NULL;
++ GString *profile_string;
+
+ CMSOpenAssignDialogData *data=g_new(CMSOpenAssignDialogData,1);
+ data->image = image;
+@@ -1729,7 +1751,7 @@ cms_open_assign_dialog(GImage *image)
+
+ data->profile_menu = cms_profile_menu_new(GTK_TABLE(table), 1, 0, TRUE);
+
+- GString *profile_string = g_string_new(NULL);
++ profile_string = g_string_new(NULL);
+ if (cms_default_image_profile_name == NULL)
+ { g_string_sprintf (profile_string, "The default image profile: [none]");
+ }
+@@ -1796,9 +1818,10 @@ cms_open_assign_dialog_ok_callback(GtkWi
+
+ /* update cms_open_action (global preference variable) */
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->always_default_check)))
+- { cms_open_action = CMS_ASSIGN_DEFAULT;
++ {
+ GList *update_settings = NULL;
+ GList *remove_settings = NULL;
++ cms_open_action = CMS_ASSIGN_DEFAULT;
+ update_settings = g_list_append(update_settings, "cms-open-action");
+ save_gimprc(&update_settings, &remove_settings);
+ g_list_free(update_settings);
+@@ -1847,6 +1870,7 @@ cms_convert_on_open_prompt(GImage *image
+ GtkWidget *table;
+ GtkWidget *vbox;
+ GtkWidget *alignment;
++ gboolean return_value;
+
+ CMSConvertOnOpenPromptData *data = g_new(CMSConvertOnOpenPromptData, 1);
+
+@@ -1918,7 +1942,7 @@ cms_convert_on_open_prompt(GImage *image
+ data->event_loop = g_main_new(FALSE);
+ g_main_run(data->event_loop);
+
+- gboolean return_value = data->return_value;
++ return_value = data->return_value;
+ g_main_destroy(data->event_loop);
+ g_free(data);
+
+@@ -1931,9 +1955,9 @@ cms_convert_on_open_prompt_yes_callback
+ { data->return_value = TRUE;
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->auto_convert_check)))
+ { /* cms_auto_convert is global preference variable */
+- cms_mismatch_action = CMS_MISMATCH_AUTO_CONVERT;
+ GList *update_settings = NULL;
+ GList *remove_settings = NULL;
++ cms_mismatch_action = CMS_MISMATCH_AUTO_CONVERT;
+ update_settings = g_list_append(update_settings, "cms-mismatch-action");
+ save_gimprc(&update_settings, &remove_settings);
+ g_list_free(update_settings);