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

This commit is contained in:
Alex Samorukov
2019-03-23 23:33:07 +00:00
parent f540f6c0a5
commit 8f3da0e8c4
5 changed files with 32 additions and 25 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;