Mercurial > emacs
comparison src/w32fns.c @ 24583:0e5c5bd9b99d
(x_to_w32_font): Provide sufficient buffer to encode_coding to avoid carryover.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 07 Apr 1999 05:48:00 +0000 |
parents | b09ceba3d319 |
children | 045e247575d9 |
comparison
equal
deleted
inserted
replaced
24582:1dc1bccbb4cc | 24583:0e5c5bd9b99d |
---|---|
5510 name, weight, &slant, pixels, height, resy, &pitch, width, remainder); | 5510 name, weight, &slant, pixels, height, resy, &pitch, width, remainder); |
5511 if (fields == EOF) return (FALSE); | 5511 if (fields == EOF) return (FALSE); |
5512 | 5512 |
5513 if (fields > 0 && name[0] != '*') | 5513 if (fields > 0 && name[0] != '*') |
5514 { | 5514 { |
5515 int bufsize; | |
5516 unsigned char *buf; | |
5517 | |
5515 setup_coding_system | 5518 setup_coding_system |
5516 (Fcheck_coding_system (Vw32_system_coding_system), &coding); | 5519 (Fcheck_coding_system (Vw32_system_coding_system), &coding); |
5520 bufsize = encoding_buffer_size (&coding, strlen (name)); | |
5521 buf = (unsigned char *) alloca (bufsize); | |
5517 coding.mode |= CODING_MODE_LAST_BLOCK; | 5522 coding.mode |= CODING_MODE_LAST_BLOCK; |
5518 encode_coding (&coding, name, lplogfont->lfFaceName, | 5523 encode_coding (&coding, name, buf, strlen (name), bufsize); |
5519 strlen (name), LF_FACESIZE-1); | 5524 if (coding.produced >= LF_FACESIZE) |
5520 lplogfont->lfFaceName[coding.produced] = 0; | 5525 coding.produced = LF_FACESIZE - 1; |
5526 buf[coding.produced] = 0; | |
5527 strcpy (lplogfont->lfFaceName, buf); | |
5521 } | 5528 } |
5522 else | 5529 else |
5523 { | 5530 { |
5524 lplogfont->lfFaceName[0] = 0; | 5531 lplogfont->lfFaceName[0] = 0; |
5525 } | 5532 } |