summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2008-04-05 23:01:26 +0000
committerMiles Bader <miles@gnu.org>2008-04-05 23:01:26 +0000
commit5bc6ddff00c50acf546530ef0e08a27140614d27 (patch)
tree22f92034de583fe3df108e166385e30220b426fe /src
parentd8c852509f6218db43e5f2ca8baace02d4fa1294 (diff)
parent37128b5497b54367b25ed149ead91821adc65876 (diff)
downloademacs-5bc6ddff00c50acf546530ef0e08a27140614d27.tar.gz
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1107
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog26
-rw-r--r--src/ccl.c4
-rw-r--r--src/ccl.h3
-rw-r--r--src/image.c42
-rw-r--r--src/mac.c2
-rw-r--r--src/macmenu.c26
-rw-r--r--src/macselect.c6
-rw-r--r--src/macterm.h1
-rw-r--r--src/w32.c15
9 files changed, 108 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0071dc3b220..c683d77ad17 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
+2008-04-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * macmenu.c (fill_menu) [TARGET_API_MAC_CARBON]: Use
+ SetMenuItemHierarchicalMenu.
+
+2008-04-05 Jason Rumney <jasonr@gnu.org>
+
+ * image.c (pbm_load): Allow color values up to 65535.
+ Throw an error if max_color_idx is outside the supported range.
+ Report an error when image size is invalid.
+ Read two bytes at a time when raw images have max_color_idx above 255.
+
+2008-04-05 Eli Zaretskii <eliz@gnu.org>
+
+ * w32.c (readdir): If FindFirstFile/FindNextFile return in
+ cFileName a file name that includes `?' characters, use the 8+3
+ alias in cAlternateFileName instead.
+
+2008-04-05 Kenichi Handa <handa@ni.aist.go.jp>
+
+ * ccl.c (ccl_driver): If ccl->quit_silently is nonzero, don't
+ append "CCL: Quitted" when the CCL program is quitted.
+ (setup_ccl_program): Initialize ccl->quit_silently to zero.
+
+ * ccl.h (struct ccl_program): New member quit_silently.
+
2008-04-05 Chong Yidong <cyd@stupidchicken.com>
* search.c (compile_pattern_1): Treat non-nil and non-string of
diff --git a/src/ccl.c b/src/ccl.c
index 6fc6f29d422..380403c6ecd 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1745,7 +1745,8 @@ ccl_driver (ccl, source, destination, src_size, dst_size, charset_list)
break;
case CCL_STAT_QUIT:
- sprintf(msg, "\nCCL: Quited.");
+ if (! ccl->quit_silently)
+ sprintf(msg, "\nCCL: Quited.");
break;
default:
@@ -1948,6 +1949,7 @@ setup_ccl_program (ccl, ccl_prog)
ccl->stack_idx = 0;
ccl->suppress_error = 0;
ccl->eight_bit_control = 0;
+ ccl->quit_silently = 0;
return 0;
}
diff --git a/src/ccl.h b/src/ccl.h
index 4ac8b990fee..18c6ae1ebc7 100644
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -77,6 +77,9 @@ struct ccl_program {
CCL_WRITE_CHAR. After execution,
if no such byte is written, set
this value to zero. */
+ int quit_silently; /* If nonzero, don't append "CCL:
+ Quitted" to the generated text when
+ CCL program is quitted. */
};
/* This data type is used for the spec field of the structure
diff --git a/src/image.c b/src/image.c
index 81754ca68d2..fbf6a15cef6 100644
--- a/src/image.c
+++ b/src/image.c
@@ -5801,13 +5801,18 @@ pbm_load (f, img)
if (type != PBM_MONO)
{
max_color_idx = pbm_scan_number (&p, end);
- if (raw_p && max_color_idx > 255)
- max_color_idx = 255;
+ if (max_color_idx > 65535 || max_color_idx < 0)
+ {
+ image_error ("Unsupported maximum PBM color value", Qnil, Qnil);
+ goto error;
+ }
}
- if (!check_image_size (f, width, height)
- || (type != PBM_MONO && max_color_idx < 0))
- goto error;
+ if (!check_image_size (f, width, height))
+ {
+ image_error ("Invalid image size", Qnil, Qnil);
+ goto error;
+ }
if (!x_create_x_image_and_pixmap (f, width, height, 0,
&ximg, &img->pixmap))
@@ -5867,10 +5872,13 @@ pbm_load (f, img)
}
else
{
- if (raw_p
- && ((type == PBM_GRAY)
- ? (p + height * width > end)
- : (p + 3 * height * width > end)))
+ int expected_size = height * width;
+ if (max_color_idx > 255)
+ expected_size *= 2;
+ if (type == PBM_COLOR)
+ expected_size *= 3;
+
+ if (raw_p && p + expected_size > end)
{
x_destroy_x_image (ximg);
x_clear_image (f, img);
@@ -5884,13 +5892,25 @@ pbm_load (f, img)
{
int r, g, b;
- if (type == PBM_GRAY)
- r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
+ if (type == PBM_GRAY && raw_p)
+ {
+ r = g = b = *p++;
+ if (max_color_idx > 255)
+ r = g = b = r * 256 + *p++;
+ }
+ else if (type == PBM_GRAY)
+ r = g = b = pbm_scan_number (&p, end);
else if (raw_p)
{
r = *p++;
+ if (max_color_idx > 255)
+ r = r * 256 + *p++;
g = *p++;
+ if (max_color_idx > 255)
+ g = g * 256 + *p++;
b = *p++;
+ if (max_color_idx > 255)
+ b = b * 256 + *p++;
}
else
{
diff --git a/src/mac.c b/src/mac.c
index 5a8c8823ec4..74cfeb24865 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -79,7 +79,7 @@ static ComponentInstance as_scripting_component;
/* The single script context used for all script executions. */
static OSAID as_script_context;
-#ifndef MAC_OS_X
+#ifndef MAC_OSX
#if TARGET_API_MAC_CARBON
static int wakeup_from_rne_enabled_p = 0;
#define ENABLE_WAKEUP_FROM_RNE (wakeup_from_rne_enabled_p = 1)
diff --git a/src/macmenu.c b/src/macmenu.c
index 1d2e89ddd25..ddc6e3c2b84 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -39,7 +39,7 @@ Boston, MA 02110-1301, USA. */
#if !TARGET_API_MAC_CARBON
#include <MacTypes.h>
#include <Menus.h>
-#include <QuickDraw.h>
+#include <Quickdraw.h>
#include <ToolUtils.h>
#include <Fonts.h>
#include <Controls.h>
@@ -2752,7 +2752,7 @@ create_and_show_dialog (f, first_wv)
SendEventToEventTarget (event, toolbox_dispatcher);
ReleaseEvent (event);
}
-#ifdef MAC_OSX
+#if 0 /* defined (MAC_OSX) */
else if (err != eventLoopTimedOutErr)
{
if (err == eventLoopQuitErr)
@@ -3194,7 +3194,11 @@ fill_menu (menu, wv, kind, submenu_id)
MenuRef submenu = NewMenu (submenu_id, "\pX");
InsertMenu (submenu, -1);
+#if TARGET_API_MAC_CARBON
+ SetMenuItemHierarchicalMenu (menu, pos, submenu);
+#else
SetMenuItemHierarchicalID (menu, pos, submenu_id);
+#endif
submenu_id = fill_menu (submenu, wv->contents, kind, submenu_id + 1);
}
}
@@ -3256,7 +3260,23 @@ fill_menubar (wv, deep_p)
if (err == noErr)
{
if (CFStringCompare (title, old_title, 0) != kCFCompareEqualTo)
- err = SetMenuTitleWithCFString (menu, title);
+ {
+#ifdef MAC_OSX
+ if (id + 1 == min_menu_id[MAC_MENU_MENU_BAR + 1]
+ || GetMenuRef (id + 1) == NULL)
+ {
+ /* This is a workaround for Mac OS X 10.5 where
+ just calling SetMenuTitleWithCFString fails
+ to change the title of the last (Help) menu
+ in the menu bar. */
+ DeleteMenu (id);
+ DisposeMenu (menu);
+ menu = NULL;
+ }
+ else
+#endif /* MAC_OSX */
+ err = SetMenuTitleWithCFString (menu, title);
+ }
CFRelease (old_title);
}
else
diff --git a/src/macselect.c b/src/macselect.c
index 55466d4a54b..51a30e3a6b5 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -468,7 +468,11 @@ x_own_selection (selection_name, selection_value)
selection_time = long_to_cons (last_event_timestamp);
if (sel)
- ownership_info = mac_get_selection_ownership_info (sel);
+ {
+ BLOCK_INPUT;
+ ownership_info = mac_get_selection_ownership_info (sel);
+ UNBLOCK_INPUT;
+ }
else
ownership_info = Qnil; /* dummy value for local-only selection */
selection_data = Fcons (selection_name,
diff --git a/src/macterm.h b/src/macterm.h
index ddbf0f04182..1e0ffbab263 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -631,6 +631,7 @@ extern void x_free_frame_resources P_ ((struct frame *));
extern void x_destroy_window P_ ((struct frame *));
extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
extern void x_delete_display P_ ((struct x_display_info *));
+extern void mac_initialize P_ ((void));
extern Pixmap XCreatePixmap P_ ((Display *, WindowRef, unsigned int,
unsigned int, unsigned int));
extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowRef, char *,
diff --git a/src/w32.c b/src/w32.c
index 1108f22b112..af7de20bc3a 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1935,6 +1935,21 @@ readdir (DIR *dirp)
dir_static.d_namlen = strlen (dir_static.d_name);
dir_static.d_reclen = sizeof (struct direct) - MAXNAMLEN + 3 +
dir_static.d_namlen - dir_static.d_namlen % 4;
+
+ /* If the file name in cFileName[] includes `?' characters, it means
+ the original file name used characters that cannot be represented
+ by the current ANSI codepage. To avoid total lossage, retrieve
+ the short 8+3 alias of the long file name. */
+ if (_mbspbrk (dir_find_data.cFileName, "?"))
+ {
+ strcpy (dir_static.d_name, dir_find_data.cAlternateFileName);
+ /* 8+3 aliases are returned in all caps, which could break
+ various alists that look at filenames' extensions. */
+ downcase = 1;
+ }
+ else
+ strcpy (dir_static.d_name, dir_find_data.cFileName);
+ dir_static.d_namlen = strlen (dir_static.d_name);
if (dir_is_fat)
_strlwr (dir_static.d_name);
else if (downcase)