aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2006-04-18 08:13:49 +0000
committerYAMAMOTO Mitsuharu2006-04-18 08:13:49 +0000
commitb96fe6eadbcd91867aa29e2289f6923a23dc946c (patch)
tree57588a3939712eca96c1bc953012177abd19ffab /src
parent1091c0b3cc5b4b17f3d046390c4e037d9363f80b (diff)
downloademacs-b96fe6eadbcd91867aa29e2289f6923a23dc946c.tar.gz
emacs-b96fe6eadbcd91867aa29e2289f6923a23dc946c.zip
(XCreateGC, x_per_char_metric, xlfdpat_create)
(init_font_name_table, init_font_name_table, mac_do_list_fonts) (XLoadQueryFont, mac_store_apple_event): Don't check return value of xmalloc.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/macterm.c76
2 files changed, 39 insertions, 55 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2c96a985d8f..8a00cf2dbd4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,21 @@
12006-04-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * image.c (x_create_bitmap_from_data) [MAC_OS]: Don't check return
4 value of xmalloc.
5
6 * mac.c (mac_coerce_file_name_ptr, mac_coerce_file_name_desc)
7 (create_apple_event_from_event_ref, xrm_get_preference_database)
8 (cfstring_create_normalized): Don't check return value of xmalloc.
9
10 * macselect.c (get_scrap_target_type_list, defer_apple_events)
11 (copy_scrap_flavor_data, mac_handle_service_event): Don't check
12 return value of xmalloc/xrealloc.
13
14 * macterm.c (XCreateGC, x_per_char_metric, xlfdpat_create)
15 (init_font_name_table, init_font_name_table, mac_do_list_fonts)
16 (XLoadQueryFont, mac_store_apple_event): Don't check
17 return value of xmalloc.
18
12006-04-17 Kim F. Storm <storm@cua.dk> 192006-04-17 Kim F. Storm <storm@cua.dk>
2 20
3 * window.c (coordinates_in_window): On the vertical border, 21 * window.c (coordinates_in_window): On the vertical border,
diff --git a/src/macterm.c b/src/macterm.c
index cc8e659515b..7313cf1b3ee 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -1508,11 +1508,8 @@ XCreateGC (display, window, mask, xgcv)
1508{ 1508{
1509 GC gc = xmalloc (sizeof (*gc)); 1509 GC gc = xmalloc (sizeof (*gc));
1510 1510
1511 if (gc) 1511 bzero (gc, sizeof (*gc));
1512 { 1512 XChangeGC (display, gc, mask, xgcv);
1513 bzero (gc, sizeof (*gc));
1514 XChangeGC (display, gc, mask, xgcv);
1515 }
1516 1513
1517 return gc; 1514 return gc;
1518} 1515}
@@ -2160,21 +2157,17 @@ x_per_char_metric (font, char2b)
2160 if (*row == NULL) 2157 if (*row == NULL)
2161 { 2158 {
2162 *row = xmalloc (sizeof (XCharStructRow)); 2159 *row = xmalloc (sizeof (XCharStructRow));
2163 if (*row) 2160 bzero (*row, sizeof (XCharStructRow));
2164 bzero (*row, sizeof (XCharStructRow));
2165 } 2161 }
2166 if (*row) 2162 pcm = (*row)->per_char + char2b->byte2;
2163 if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
2167 { 2164 {
2168 pcm = (*row)->per_char + char2b->byte2; 2165 BLOCK_INPUT;
2169 if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2)) 2166 mac_query_char_extents (font->mac_style,
2170 { 2167 (char2b->byte1 << 8) + char2b->byte2,
2171 BLOCK_INPUT; 2168 NULL, NULL, pcm, NULL);
2172 mac_query_char_extents (font->mac_style, 2169 UNBLOCK_INPUT;
2173 (char2b->byte1 << 8) + char2b->byte2, 2170 XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
2174 NULL, NULL, pcm, NULL);
2175 UNBLOCK_INPUT;
2176 XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
2177 }
2178 } 2171 }
2179 } 2172 }
2180 else 2173 else
@@ -6563,12 +6556,7 @@ xlfdpat_create (pattern)
6563 struct xlfdpat_block *blk; 6556 struct xlfdpat_block *blk;
6564 6557
6565 pat = xmalloc (sizeof (struct xlfdpat)); 6558 pat = xmalloc (sizeof (struct xlfdpat));
6566 if (pat == NULL)
6567 goto error;
6568
6569 pat->buf = xmalloc (strlen (pattern) + 1); 6559 pat->buf = xmalloc (strlen (pattern) + 1);
6570 if (pat->buf == NULL)
6571 goto error;
6572 6560
6573 /* Normalize the pattern string and store it to `pat->buf'. */ 6561 /* Normalize the pattern string and store it to `pat->buf'. */
6574 nblocks = 0; 6562 nblocks = 0;
@@ -6632,8 +6620,6 @@ xlfdpat_create (pattern)
6632 } 6620 }
6633 6621
6634 pat->blocks = xmalloc (sizeof (struct xlfdpat_block) * nblocks); 6622 pat->blocks = xmalloc (sizeof (struct xlfdpat_block) * nblocks);
6635 if (pat->blocks == NULL)
6636 goto error;
6637 6623
6638 /* Divide the normalized pattern into blocks. */ 6624 /* Divide the normalized pattern into blocks. */
6639 p = pat->buf; 6625 p = pat->buf;
@@ -7093,9 +7079,10 @@ init_font_name_table ()
7093 Qnil, Qnil, Qnil);; 7079 Qnil, Qnil, Qnil);;
7094 err = ATSUFontCount (&nfonts); 7080 err = ATSUFontCount (&nfonts);
7095 if (err == noErr) 7081 if (err == noErr)
7096 font_ids = xmalloc (sizeof (ATSUFontID) * nfonts); 7082 {
7097 if (font_ids) 7083 font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
7098 err = ATSUGetFontIDs (font_ids, nfonts, NULL); 7084 err = ATSUGetFontIDs (font_ids, nfonts, NULL);
7085 }
7099 if (err == noErr) 7086 if (err == noErr)
7100 for (i = 0; i < nfonts; i++) 7087 for (i = 0; i < nfonts; i++)
7101 { 7088 {
@@ -7105,8 +7092,6 @@ init_font_name_table ()
7105 if (err != noErr) 7092 if (err != noErr)
7106 continue; 7093 continue;
7107 name = xmalloc (name_len + 1); 7094 name = xmalloc (name_len + 1);
7108 if (name == NULL)
7109 continue;
7110 name[name_len] = '\0'; 7095 name[name_len] = '\0';
7111 err = ATSUFindFontName (font_ids[i], kFontFamilyName, 7096 err = ATSUFindFontName (font_ids[i], kFontFamilyName,
7112 kFontMacintoshPlatform, kFontNoScript, 7097 kFontMacintoshPlatform, kFontNoScript,
@@ -7436,8 +7421,6 @@ mac_do_list_fonts (pattern, maxnames)
7436 int former_len = ptr - font_name_table[i]; 7421 int former_len = ptr - font_name_table[i];
7437 7422
7438 scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1); 7423 scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1);
7439 if (scaled == NULL)
7440 continue;
7441 memcpy (scaled, font_name_table[i], former_len); 7424 memcpy (scaled, font_name_table[i], former_len);
7442 sprintf (scaled + former_len, 7425 sprintf (scaled + former_len,
7443 "-%d-%d-72-72-m-%d-%s", 7426 "-%d-%d-72-72-m-%d-%s",
@@ -7770,18 +7753,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
7770 font->max_char_or_byte2 = 0xff; 7753 font->max_char_or_byte2 = 0xff;
7771 7754
7772 font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100); 7755 font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100);
7773 if (font->bounds.rows == NULL)
7774 {
7775 mac_unload_font (&one_mac_display_info, font);
7776 return NULL;
7777 }
7778 bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100); 7756 bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100);
7779 font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow)); 7757 font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow));
7780 if (font->bounds.rows[0] == NULL)
7781 {
7782 mac_unload_font (&one_mac_display_info, font);
7783 return NULL;
7784 }
7785 bzero (font->bounds.rows[0], sizeof (XCharStructRow)); 7758 bzero (font->bounds.rows[0], sizeof (XCharStructRow));
7786 7759
7787#if USE_CG_TEXT_DRAWING 7760#if USE_CG_TEXT_DRAWING
@@ -7803,9 +7776,10 @@ XLoadQueryFont (Display *dpy, char *fontname)
7803 } 7776 }
7804 7777
7805 if (font->cg_font) 7778 if (font->cg_font)
7806 font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100); 7779 {
7807 if (font->cg_glyphs) 7780 font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
7808 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); 7781 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
7782 }
7809#endif 7783#endif
7810 space_bounds = font->bounds.rows[0]->per_char + 0x20; 7784 space_bounds = font->bounds.rows[0]->per_char + 0x20;
7811 err = mac_query_char_extents (font->mac_style, 0x20, 7785 err = mac_query_char_extents (font->mac_style, 0x20,
@@ -7951,11 +7925,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
7951 7925
7952 font->bounds.per_char = 7926 font->bounds.per_char =
7953 xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); 7927 xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
7954 if (font->bounds.per_char == NULL)
7955 {
7956 mac_unload_font (&one_mac_display_info, font);
7957 return NULL;
7958 }
7959 bzero (font->bounds.per_char, 7928 bzero (font->bounds.per_char,
7960 sizeof (XCharStruct) * (0xff - 0x20 + 1)); 7929 sizeof (XCharStruct) * (0xff - 0x20 + 1));
7961 7930
@@ -8958,15 +8927,12 @@ mac_store_apple_event (class, id, desc)
8958 Lisp_Object class, id; 8927 Lisp_Object class, id;
8959 const AEDesc *desc; 8928 const AEDesc *desc;
8960{ 8929{
8961 OSErr err = noErr; 8930 OSErr err;
8962 struct input_event buf; 8931 struct input_event buf;
8963 AEDesc *desc_copy; 8932 AEDesc *desc_copy;
8964 8933
8965 desc_copy = xmalloc (sizeof (AEDesc)); 8934 desc_copy = xmalloc (sizeof (AEDesc));
8966 if (desc_copy == NULL) 8935 err = AEDuplicateDesc (desc, desc_copy);
8967 err = memFullErr;
8968 else
8969 err = AEDuplicateDesc (desc, desc_copy);
8970 if (err == noErr) 8936 if (err == noErr)
8971 { 8937 {
8972 EVENT_INIT (buf); 8938 EVENT_INIT (buf);