[gimp/gimp-2-10] Allow compilation on MacOS 10.5 leopard: issues #2923, #2924 and #2925



commit 8f3da0e8c4959ec0d1b82890cef23cccf5aa44cd
Author: Alex Samorukov <samm net-art cz>
Date:   Sat Mar 23 23:33:07 2019 +0000

    Allow compilation on MacOS 10.5 leopard: issues #2923, #2924 and #2925

 app/core/gimpimage-convert-indexed.c   | 32 ++++++++++++++++----------------
 app/widgets/gimpcriticaldialog.c       |  3 ++-
 app/widgets/gimpselectiondata.c        | 14 +++++++-------
 libgimpwidgets/gimppickbutton-quartz.c |  5 +++++
 plug-ins/common/web-browser.c          |  3 ++-
 5 files changed, 32 insertions(+), 25 deletions(-)
---
diff --git a/app/core/gimpimage-convert-indexed.c b/app/core/gimpimage-convert-indexed.c
index 9d5bbcb338..4c9c4a0c63 100644
--- a/app/core/gimpimage-convert-indexed.c
+++ b/app/core/gimpimage-convert-indexed.c
@@ -3594,7 +3594,7 @@ init_error_limit (const int error_freedom)
 /* Allocate and fill in the error_limiter table */
 {
   gint *table;
-  gint  in, out;
+  gint  inp, out;
 
   /* #define STEPSIZE 16 */
   /* #define STEPSIZE 200 */
@@ -3608,16 +3608,16 @@ init_error_limit (const int error_freedom)
 
       const gint STEPSIZE = 190;
 
-      for (in = 0; in < STEPSIZE; in++)
+      for (inp = 0; inp < STEPSIZE; inp++)
         {
-          table[in] = in;
-          table[-in] = -in;
+          table[inp] = inp;
+          table[-inp] = -inp;
         }
 
-      for (; in <= 255; in++)
+      for (; inp <= 255; inp++)
         {
-          table[in] = STEPSIZE;
-          table[-in] = -STEPSIZE;
+          table[inp] = STEPSIZE;
+          table[-inp] = -STEPSIZE;
         }
 
       return (table);
@@ -3630,24 +3630,24 @@ init_error_limit (const int error_freedom)
 
       /* Map errors 1:1 up to +- STEPSIZE */
       out = 0;
-      for (in = 0; in < STEPSIZE; in++, out++)
+      for (inp = 0; inp < STEPSIZE; inp++, out++)
         {
-          table[in] = out;
-          table[-in] = -out;
+          table[inp] = out;
+          table[-inp] = -out;
         }
 
       /* Map errors 1:2 up to +- 3*STEPSIZE */
-      for (; in < STEPSIZE*3; in++, out += (in&1) ? 0 : 1)
+      for (; inp < STEPSIZE*3; inp++, out += (inp&1) ? 0 : 1)
         {
-          table[in] = out;
-          table[-in] = -out;
+          table[inp] = out;
+          table[-inp] = -out;
         }
 
       /* Clamp the rest to final out value (which is STEPSIZE*2) */
-      for (; in <= 255; in++)
+      for (; inp <= 255; inp++)
         {
-          table[in] = out;
-          table[-in] = -out;
+          table[inp] = out;
+          table[-inp] = -out;
         }
 
       return table;
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index b3201bbd47..158a3f953c 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -279,11 +279,12 @@ browser_open_url (const gchar  *url,
   NSURL    *ns_url;
   gboolean  retval;
 
-  @autoreleasepool
+  NSAutoreleasePool *arp = [NSAutoreleasePool new];
     {
       ns_url = [NSURL URLWithString: [NSString stringWithUTF8String: url]];
       retval = [[NSWorkspace sharedWorkspace] openURL: ns_url];
     }
+  [arp release];
 
   return retval;
 
diff --git a/app/widgets/gimpselectiondata.c b/app/widgets/gimpselectiondata.c
index 0a9da2d54c..16e2e4af3d 100644
--- a/app/widgets/gimpselectiondata.c
+++ b/app/widgets/gimpselectiondata.c
@@ -867,7 +867,7 @@ gimp_unescape_uri_string (const char *escaped,
                           const char *illegal_escaped_characters,
                           gboolean    ascii_must_not_be_escaped)
 {
-  const gchar *in, *in_end;
+  const gchar *inp, *in_end;
   gchar *out, *result;
   int c;
 
@@ -880,17 +880,17 @@ gimp_unescape_uri_string (const char *escaped,
   result = g_malloc (len + 1);
 
   out = result;
-  for (in = escaped, in_end = escaped + len; in < in_end; in++)
+  for (inp = escaped, in_end = escaped + len; inp < in_end; inp++)
     {
-      c = *in;
+      c = *inp;
 
       if (c == '%')
         {
           /* catch partial escape sequences past the end of the substring */
-          if (in + 3 > in_end)
+          if (inp + 3 > in_end)
             break;
 
-          c = unescape_character (in + 1);
+          c = unescape_character (inp + 1);
 
           /* catch bad escape sequences and NUL characters */
           if (c <= 0)
@@ -904,7 +904,7 @@ gimp_unescape_uri_string (const char *escaped,
           if (strchr (illegal_escaped_characters, c) != NULL)
             break;
 
-          in += 2;
+          inp += 2;
         }
 
       *out++ = c;
@@ -913,7 +913,7 @@ gimp_unescape_uri_string (const char *escaped,
   gimp_assert (out - result <= len);
   *out = '\0';
 
-  if (in != in_end)
+  if (inp != in_end)
     {
       g_free (result);
       return NULL;
diff --git a/libgimpwidgets/gimppickbutton-quartz.c b/libgimpwidgets/gimppickbutton-quartz.c
index 3da42b59a4..5d581d3d9a 100644
--- a/libgimpwidgets/gimppickbutton-quartz.c
+++ b/libgimpwidgets/gimppickbutton-quartz.c
@@ -35,6 +35,11 @@
 #endif
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
+@protocol NSWindowDelegate
+@end
+#endif
+
 @interface NSWindow (GIMPExt)
 - (NSRect) convertRectToScreen: (NSRect)aRect;
 @end
diff --git a/plug-ins/common/web-browser.c b/plug-ins/common/web-browser.c
index a700e399b6..c7514932d4 100644
--- a/plug-ins/common/web-browser.c
+++ b/plug-ins/common/web-browser.c
@@ -192,11 +192,12 @@ browser_open_url (const gchar  *url,
   NSURL    *ns_url;
   gboolean  retval;
 
-  @autoreleasepool
+  NSAutoreleasePool *arp = [NSAutoreleasePool new];
     {
       ns_url = [NSURL URLWithString: [NSString stringWithUTF8String: url]];
       retval = [[NSWorkspace sharedWorkspace] openURL: ns_url];
     }
+  [arp release];
 
   return retval;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]