aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog31
-rw-r--r--src/coding.c29
-rw-r--r--src/font.c14
-rw-r--r--src/insdel.c11
-rw-r--r--src/lisp.h1
-rw-r--r--src/w32.c106
-rw-r--r--src/w32heap.c6
-rw-r--r--src/w32notify.c12
-rw-r--r--src/xdisp.c7
9 files changed, 163 insertions, 54 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ffa4bdf927f..e147889f796 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,32 @@
12013-01-25 Eli Zaretskii <eliz@gnu.org>
2
3 * w32notify.c (Fw32notify_add_watch): Doc fix. (Bug#13540)
4
52013-01-25 Dmitry Antipov <dmantipov@yandex.ru>
6
7 * font.c (num_fonts): Remove the leftover from old
8 debugging code. Adjust comment style here and there.
9 * insdel.c (insert_1): Remove.
10 * lisp.h (insert_1): Remove prototype.
11 * xdisp.c (message_dolog): Adjust users to call insert_1_both.
12
132013-01-25 Eli Zaretskii <eliz@gnu.org>
14
15 * w32.c (max_filename_mbslen): New function.
16 (normalize_filename, readdir): Use it to detect locales where ANSI
17 encoding of file names uses a double-byte character set (DBCS).
18 If a DBCS encoding is used, advance by characters using
19 CharNextExA, instead of incrementing a 'char *' pointer. Use
20 _mbslwr instead of _strlwr. (Bug#13515)
21
22 * w32heap.c (allocate_heap) [!_WIN64]: Decrease the initial
23 request of memory reservation to 1.7GB. (Bug#13065)
24
252013-01-25 Andreas Schwab <schwab@linux-m68k.org>
26
27 * coding.c (detect_coding_iso_2022): Move back mis-reordered code
28 at check_extra_latin label. (Bug#13505)
29
12013-01-24 Dmitry Antipov <dmantipov@yandex.ru> 302013-01-24 Dmitry Antipov <dmantipov@yandex.ru>
2 31
3 * nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script): 32 * nsfont.m (ns_escape_name, ns_unescape_name, ns_registry_to_script):
@@ -19,7 +48,7 @@
19 (w32_read_socket): Save iconified state to generate DEICONIFY_EVENT 48 (w32_read_socket): Save iconified state to generate DEICONIFY_EVENT
20 properly. Likewise for obscured. 49 properly. Likewise for obscured.
21 * xterm.c: Ditto. 50 * xterm.c: Ditto.
22 (handle_one_xevent): Save visible state go generate ICONIFY_EVENT 51 (handle_one_xevent): Save visible state to generate ICONIFY_EVENT
23 properly. 52 properly.
24 * nsterm.m: Ditto. 53 * nsterm.m: Ditto.
25 (windowDidDeminiaturize): Generate DEICONIFY_EVENT. 54 (windowDidDeminiaturize): Generate DEICONIFY_EVENT.
diff --git a/src/coding.c b/src/coding.c
index a9bf9032a69..93da9db0d36 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -3057,20 +3057,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
3057 } 3057 }
3058 if (single_shifting) 3058 if (single_shifting)
3059 break; 3059 break;
3060 check_extra_latin: 3060 goto check_extra_latin;
3061 if (! VECTORP (Vlatin_extra_code_table)
3062 || NILP (AREF (Vlatin_extra_code_table, c)))
3063 {
3064 rejected = CATEGORY_MASK_ISO;
3065 break;
3066 }
3067 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
3068 & CODING_ISO_FLAG_LATIN_EXTRA)
3069 found |= CATEGORY_MASK_ISO_8_1;
3070 else
3071 rejected |= CATEGORY_MASK_ISO_8_1;
3072 rejected |= CATEGORY_MASK_ISO_8_2;
3073 break;
3074 3061
3075 default: 3062 default:
3076 if (c < 0) 3063 if (c < 0)
@@ -3121,6 +3108,20 @@ detect_coding_iso_2022 (struct coding_system *coding,
3121 } 3108 }
3122 break; 3109 break;
3123 } 3110 }
3111 check_extra_latin:
3112 if (! VECTORP (Vlatin_extra_code_table)
3113 || NILP (AREF (Vlatin_extra_code_table, c)))
3114 {
3115 rejected = CATEGORY_MASK_ISO;
3116 break;
3117 }
3118 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
3119 & CODING_ISO_FLAG_LATIN_EXTRA)
3120 found |= CATEGORY_MASK_ISO_8_1;
3121 else
3122 rejected |= CATEGORY_MASK_ISO_8_1;
3123 rejected |= CATEGORY_MASK_ISO_8_2;
3124 break;
3124 } 3125 }
3125 } 3126 }
3126 detect_info->rejected |= CATEGORY_MASK_ISO; 3127 detect_info->rejected |= CATEGORY_MASK_ISO;
diff --git a/src/font.c b/src/font.c
index 18caf751643..3cffe2558ae 100644
--- a/src/font.c
+++ b/src/font.c
@@ -717,7 +717,7 @@ font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val)
717} 717}
718 718
719 719
720/* Font name parser and unparser */ 720/* Font name parser and unparser. */
721 721
722static int parse_matrix (const char *); 722static int parse_matrix (const char *);
723static int font_expand_wildcards (Lisp_Object *, int); 723static int font_expand_wildcards (Lisp_Object *, int);
@@ -1746,7 +1746,7 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec
1746/* This part (through the next ^L) is still experimental and not 1746/* This part (through the next ^L) is still experimental and not
1747 tested much. We may drastically change codes. */ 1747 tested much. We may drastically change codes. */
1748 1748
1749/* OTF handler */ 1749/* OTF handler. */
1750 1750
1751#if 0 1751#if 0
1752 1752
@@ -2035,7 +2035,7 @@ font_otf_Anchor (OTF_Anchor *anchor)
2035#endif /* 0 */ 2035#endif /* 0 */
2036 2036
2037 2037
2038/* Font sorting */ 2038/* Font sorting. */
2039 2039
2040static unsigned font_score (Lisp_Object, Lisp_Object *); 2040static unsigned font_score (Lisp_Object, Lisp_Object *);
2041static int font_compare (const void *, const void *); 2041static int font_compare (const void *, const void *);
@@ -2565,7 +2565,6 @@ font_get_cache (FRAME_PTR f, struct font_driver *driver)
2565 return val; 2565 return val;
2566} 2566}
2567 2567
2568static int num_fonts;
2569 2568
2570static void 2569static void
2571font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) 2570font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver)
@@ -2598,7 +2597,6 @@ font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver)
2598 { 2597 {
2599 eassert (font && driver == font->driver); 2598 eassert (font && driver == font->driver);
2600 driver->close (f, font); 2599 driver->close (f, font);
2601 num_fonts--;
2602 } 2600 }
2603 } 2601 }
2604 if (driver->free_entity) 2602 if (driver->free_entity)
@@ -2856,7 +2854,6 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
2856 return Qnil; 2854 return Qnil;
2857 ASET (entity, FONT_OBJLIST_INDEX, 2855 ASET (entity, FONT_OBJLIST_INDEX,
2858 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); 2856 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
2859 num_fonts++;
2860 2857
2861 font = XFONT_OBJECT (font_object); 2858 font = XFONT_OBJECT (font_object);
2862 min_width = (font->min_width ? font->min_width 2859 min_width = (font->min_width ? font->min_width
@@ -2901,7 +2898,6 @@ font_close_object (FRAME_PTR f, Lisp_Object font_object)
2901 eassert (FRAME_X_DISPLAY_INFO (f)->n_fonts); 2898 eassert (FRAME_X_DISPLAY_INFO (f)->n_fonts);
2902 FRAME_X_DISPLAY_INFO (f)->n_fonts--; 2899 FRAME_X_DISPLAY_INFO (f)->n_fonts--;
2903#endif 2900#endif
2904 num_fonts--;
2905} 2901}
2906 2902
2907 2903
@@ -3578,7 +3574,7 @@ font_filter_properties (Lisp_Object font,
3578 Lisp_Object it; 3574 Lisp_Object it;
3579 int i; 3575 int i;
3580 3576
3581 /* Set boolean values to Qt or Qnil */ 3577 /* Set boolean values to Qt or Qnil. */
3582 for (i = 0; boolean_properties[i] != NULL; ++i) 3578 for (i = 0; boolean_properties[i] != NULL; ++i)
3583 for (it = alist; ! NILP (it); it = XCDR (it)) 3579 for (it = alist; ! NILP (it); it = XCDR (it))
3584 { 3580 {
@@ -3757,7 +3753,7 @@ font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face
3757#endif 3753#endif
3758 3754
3759 3755
3760/* Lisp API */ 3756/* Lisp API. */
3761 3757
3762DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, 3758DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0,
3763 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. 3759 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object.
diff --git a/src/insdel.c b/src/insdel.c
index 303247816ca..4cf4e6452a1 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -658,17 +658,6 @@ insert_before_markers_and_inherit (const char *string,
658 } 658 }
659} 659}
660 660
661/* Subroutine used by the insert functions above. */
662
663void
664insert_1 (const char *string, ptrdiff_t nbytes,
665 bool inherit, bool prepare, bool before_markers)
666{
667 insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
668 nbytes, inherit, prepare, before_markers);
669}
670
671
672#ifdef BYTE_COMBINING_DEBUG 661#ifdef BYTE_COMBINING_DEBUG
673 662
674/* See if the bytes before POS/POS_BYTE combine with bytes 663/* See if the bytes before POS/POS_BYTE combine with bytes
diff --git a/src/lisp.h b/src/lisp.h
index 718c970006c..7128c3d4b18 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2879,7 +2879,6 @@ extern int count_combining_after (const unsigned char *,
2879 ptrdiff_t, ptrdiff_t, ptrdiff_t); 2879 ptrdiff_t, ptrdiff_t, ptrdiff_t);
2880extern void insert (const char *, ptrdiff_t); 2880extern void insert (const char *, ptrdiff_t);
2881extern void insert_and_inherit (const char *, ptrdiff_t); 2881extern void insert_and_inherit (const char *, ptrdiff_t);
2882extern void insert_1 (const char *, ptrdiff_t, bool, bool, bool);
2883extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, 2882extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t,
2884 bool, bool, bool); 2883 bool, bool, bool);
2885extern void insert_from_gap (ptrdiff_t, ptrdiff_t); 2884extern void insert_from_gap (ptrdiff_t, ptrdiff_t);
diff --git a/src/w32.c b/src/w32.c
index d014609076e..f722bc5f397 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -37,7 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37/* must include CRT headers *before* config.h */ 37/* must include CRT headers *before* config.h */
38 38
39#include <config.h> 39#include <config.h>
40#include <mbstring.h> /* for _mbspbrk */ 40#include <mbstring.h> /* for _mbspbrk and _mbslwr */
41 41
42#undef access 42#undef access
43#undef chdir 43#undef chdir
@@ -1531,6 +1531,67 @@ srandom (int seed)
1531 srand (seed); 1531 srand (seed);
1532} 1532}
1533 1533
1534/* Current codepage for encoding file names. */
1535static int file_name_codepage;
1536
1537/* Return the maximum length in bytes of a multibyte character
1538 sequence encoded in the current ANSI codepage. This is required to
1539 correctly walk the encoded file names one character at a time. */
1540static int
1541max_filename_mbslen (void)
1542{
1543 /* A simple cache to avoid calling GetCPInfo every time we need to
1544 normalize a file name. The file-name encoding is not supposed to
1545 be changed too frequently, if ever. */
1546 static Lisp_Object last_file_name_encoding;
1547 static int last_max_mbslen;
1548 Lisp_Object current_encoding;
1549
1550 current_encoding = Vfile_name_coding_system;
1551 if (NILP (current_encoding))
1552 current_encoding = Vdefault_file_name_coding_system;
1553
1554 if (!EQ (last_file_name_encoding, current_encoding))
1555 {
1556 CPINFO cp_info;
1557
1558 last_file_name_encoding = current_encoding;
1559 /* Default to the current ANSI codepage. */
1560 file_name_codepage = w32_ansi_code_page;
1561 if (!NILP (current_encoding))
1562 {
1563 char *cpname = SDATA (SYMBOL_NAME (current_encoding));
1564 char *cp = NULL, *end;
1565 int cpnum;
1566
1567 if (strncmp (cpname, "cp", 2) == 0)
1568 cp = cpname + 2;
1569 else if (strncmp (cpname, "windows-", 8) == 0)
1570 cp = cpname + 8;
1571
1572 if (cp)
1573 {
1574 end = cp;
1575 cpnum = strtol (cp, &end, 10);
1576 if (cpnum && *end == '\0' && end - cp >= 2)
1577 file_name_codepage = cpnum;
1578 }
1579 }
1580
1581 if (!file_name_codepage)
1582 file_name_codepage = CP_ACP; /* CP_ACP = 0, but let's not assume that */
1583
1584 if (!GetCPInfo (file_name_codepage, &cp_info))
1585 {
1586 file_name_codepage = CP_ACP;
1587 if (!GetCPInfo (file_name_codepage, &cp_info))
1588 emacs_abort ();
1589 }
1590 last_max_mbslen = cp_info.MaxCharSize;
1591 }
1592
1593 return last_max_mbslen;
1594}
1534 1595
1535/* Normalize filename by converting all path separators to 1596/* Normalize filename by converting all path separators to
1536 the specified separator. Also conditionally convert upper 1597 the specified separator. Also conditionally convert upper
@@ -1540,14 +1601,20 @@ static void
1540normalize_filename (register char *fp, char path_sep) 1601normalize_filename (register char *fp, char path_sep)
1541{ 1602{
1542 char sep; 1603 char sep;
1543 char *elem; 1604 char *elem, *p2;
1605 int dbcs_p = max_filename_mbslen () > 1;
1544 1606
1545 /* Always lower-case drive letters a-z, even if the filesystem 1607 /* Always lower-case drive letters a-z, even if the filesystem
1546 preserves case in filenames. 1608 preserves case in filenames.
1547 This is so filenames can be compared by string comparison 1609 This is so filenames can be compared by string comparison
1548 functions that are case-sensitive. Even case-preserving filesystems 1610 functions that are case-sensitive. Even case-preserving filesystems
1549 do not distinguish case in drive letters. */ 1611 do not distinguish case in drive letters. */
1550 if (fp[1] == ':' && *fp >= 'A' && *fp <= 'Z') 1612 if (dbcs_p)
1613 p2 = CharNextExA (file_name_codepage, fp, 0);
1614 else
1615 p2 = fp + 1;
1616
1617 if (*p2 == ':' && *fp >= 'A' && *fp <= 'Z')
1551 { 1618 {
1552 *fp += 'a' - 'A'; 1619 *fp += 'a' - 'A';
1553 fp += 2; 1620 fp += 2;
@@ -1559,7 +1626,10 @@ normalize_filename (register char *fp, char path_sep)
1559 { 1626 {
1560 if (*fp == '/' || *fp == '\\') 1627 if (*fp == '/' || *fp == '\\')
1561 *fp = path_sep; 1628 *fp = path_sep;
1562 fp++; 1629 if (!dbcs_p)
1630 fp++;
1631 else
1632 fp = CharNextExA (file_name_codepage, fp, 0);
1563 } 1633 }
1564 return; 1634 return;
1565 } 1635 }
@@ -1582,13 +1652,20 @@ normalize_filename (register char *fp, char path_sep)
1582 if (elem && elem != fp) 1652 if (elem && elem != fp)
1583 { 1653 {
1584 *fp = 0; /* temporary end of string */ 1654 *fp = 0; /* temporary end of string */
1585 _strlwr (elem); /* while we convert to lower case */ 1655 _mbslwr (elem); /* while we convert to lower case */
1586 } 1656 }
1587 *fp = sep; /* convert (or restore) path separator */ 1657 *fp = sep; /* convert (or restore) path separator */
1588 elem = fp + 1; /* next element starts after separator */ 1658 elem = fp + 1; /* next element starts after separator */
1589 sep = path_sep; 1659 sep = path_sep;
1590 } 1660 }
1591 } while (*fp++); 1661 if (*fp)
1662 {
1663 if (!dbcs_p)
1664 fp++;
1665 else
1666 fp = CharNextExA (file_name_codepage, fp, 0);
1667 }
1668 } while (*fp);
1592} 1669}
1593 1670
1594/* Destructively turn backslashes into slashes. */ 1671/* Destructively turn backslashes into slashes. */
@@ -2860,15 +2937,22 @@ readdir (DIR *dirp)
2860 strcpy (dir_static.d_name, dir_find_data.cFileName); 2937 strcpy (dir_static.d_name, dir_find_data.cFileName);
2861 dir_static.d_namlen = strlen (dir_static.d_name); 2938 dir_static.d_namlen = strlen (dir_static.d_name);
2862 if (dir_is_fat) 2939 if (dir_is_fat)
2863 _strlwr (dir_static.d_name); 2940 _mbslwr (dir_static.d_name);
2864 else if (downcase) 2941 else if (downcase)
2865 { 2942 {
2866 register char *p; 2943 register char *p;
2867 for (p = dir_static.d_name; *p; p++) 2944 int dbcs_p = max_filename_mbslen () > 1;
2868 if (*p >= 'a' && *p <= 'z') 2945 for (p = dir_static.d_name; *p; )
2869 break; 2946 {
2947 if (*p >= 'a' && *p <= 'z')
2948 break;
2949 if (dbcs_p)
2950 p = CharNextExA (file_name_codepage, p, 0);
2951 else
2952 p++;
2953 }
2870 if (!*p) 2954 if (!*p)
2871 _strlwr (dir_static.d_name); 2955 _mbslwr (dir_static.d_name);
2872 } 2956 }
2873 2957
2874 return &dir_static; 2958 return &dir_static;
diff --git a/src/w32heap.c b/src/w32heap.c
index 9c189dbda6d..81206ce2834 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -98,7 +98,11 @@ allocate_heap (void)
98#ifdef _WIN64 98#ifdef _WIN64
99 size_t size = 0x4000000000i64; /* start by asking for 32GB */ 99 size_t size = 0x4000000000i64; /* start by asking for 32GB */
100#else 100#else
101 size_t size = 0x80000000; /* start by asking for 2GB */ 101 /* We used to start with 2GB here, but on Windows 7 that would leave
102 too little room in the address space for threads started by
103 Windows on our behalf, e.g. when we pop up the file selection
104 dialog. */
105 size_t size = 0x68000000; /* start by asking for 1.7GB */
102#endif 106#endif
103 void *ptr = NULL; 107 void *ptr = NULL;
104 108
diff --git a/src/w32notify.c b/src/w32notify.c
index d78e55f43ed..1bcaa794565 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -442,8 +442,8 @@ DEFUN ("w32notify-add-watch", Fw32notify_add_watch,
442This arranges for filesystem events pertaining to FILE to be reported 442This arranges for filesystem events pertaining to FILE to be reported
443to Emacs. Use `w32notify-rm-watch' to cancel the watch. 443to Emacs. Use `w32notify-rm-watch' to cancel the watch.
444 444
445Value is a descriptor for the added watch, or nil if the file 445Value is a descriptor for the added watch. If the file cannot be
446cannot be watched. 446watched for some reason, this function signals a `file-error' error.
447 447
448FILTER is a list of conditions for reporting an event. It can include 448FILTER is a list of conditions for reporting an event. It can include
449the following symbols: 449the following symbols:
@@ -476,7 +476,13 @@ following:
476 'renamed-from' -- a file was renamed whose old name was FILE 476 'renamed-from' -- a file was renamed whose old name was FILE
477 'renamed-to' -- a file was renamed and its new name is FILE 477 'renamed-to' -- a file was renamed and its new name is FILE
478 478
479FILE is the name of the file whose event is being reported. */) 479FILE is the name of the file whose event is being reported.
480
481Note that some networked filesystems, such as Samba-mounted Unix
482volumes, might not send notifications about file changes. In these
483cases, this function will return a valid descriptor, but notifications
484will never come in. Volumes shared from remote Windows machines do
485generate notifications correctly, though. */)
480 (Lisp_Object file, Lisp_Object filter, Lisp_Object callback) 486 (Lisp_Object file, Lisp_Object filter, Lisp_Object callback)
481{ 487{
482 Lisp_Object encoded_file, watch_object, watch_descriptor; 488 Lisp_Object encoded_file, watch_object, watch_descriptor;
diff --git a/src/xdisp.c b/src/xdisp.c
index c7ee0d37f47..9fb9487732f 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9516,13 +9516,14 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9516 } 9516 }
9517 } 9517 }
9518 else if (nbytes) 9518 else if (nbytes)
9519 insert_1 (m, nbytes, 1, 0, 0); 9519 insert_1_both (m, chars_in_text (msg, nbytes), nbytes, 1, 0, 0);
9520 9520
9521 if (nlflag) 9521 if (nlflag)
9522 { 9522 {
9523 ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte; 9523 ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte;
9524 printmax_t dups; 9524 printmax_t dups;
9525 insert_1 ("\n", 1, 1, 0, 0); 9525
9526 insert_1_both ("\n", 1, 1, 1, 0, 0);
9526 9527
9527 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0); 9528 scan_newline (Z, Z_BYTE, BEG, BEG_BYTE, -2, 0);
9528 this_bol = PT; 9529 this_bol = PT;
@@ -9551,7 +9552,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9551 change message_log_check_duplicate. */ 9552 change message_log_check_duplicate. */
9552 int duplen = sprintf (dupstr, " [%"pMd" times]", dups); 9553 int duplen = sprintf (dupstr, " [%"pMd" times]", dups);
9553 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1); 9554 TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
9554 insert_1 (dupstr, duplen, 1, 0, 1); 9555 insert_1_both (dupstr, duplen, duplen, 1, 0, 1);
9555 } 9556 }
9556 } 9557 }
9557 } 9558 }