Mercurial > emacs
comparison src/coding.h @ 58453:04580c50dd1c
(ENCODE_FILE, DECODE_FILE, ENCODE_SYSTEM, DECODE_SYSTEM):
Don't use XFASTINT blindly.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Tue, 23 Nov 2004 05:21:31 +0000 |
| parents | 695cf19ef79e |
| children | 44a9e60f1d12 |
comparison
equal
deleted
inserted
replaced
| 58452:8b0845c0b266 | 58453:04580c50dd1c |
|---|---|
| 1 /* Header for coding system handler. | 1 /* Header for coding system handler. |
| 2 Copyright (C) 2004 Free Software Foundation, Inc. | |
| 2 Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. | 3 Copyright (C) 1995, 1997 Electrotechnical Laboratory, JAPAN. |
| 3 Licensed to the Free Software Foundation. | 4 Licensed to the Free Software Foundation. |
| 4 | 5 |
| 5 This file is part of GNU Emacs. | 6 This file is part of GNU Emacs. |
| 6 | 7 |
| 570 | 571 |
| 571 /* Encode the file name NAME using the specified coding system | 572 /* Encode the file name NAME using the specified coding system |
| 572 for file names, if any. */ | 573 for file names, if any. */ |
| 573 #define ENCODE_FILE(name) \ | 574 #define ENCODE_FILE(name) \ |
| 574 (! NILP (Vfile_name_coding_system) \ | 575 (! NILP (Vfile_name_coding_system) \ |
| 575 && XFASTINT (Vfile_name_coding_system) != 0 \ | 576 && !EQ (Vfile_name_coding_system, make_number (0)) \ |
| 576 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ | 577 ? code_convert_string_norecord (name, Vfile_name_coding_system, 1) \ |
| 577 : (! NILP (Vdefault_file_name_coding_system) \ | 578 : (! NILP (Vdefault_file_name_coding_system) \ |
| 578 && XFASTINT (Vdefault_file_name_coding_system) != 0 \ | 579 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \ |
| 579 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ | 580 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 1) \ |
| 580 : name)) | 581 : name)) |
| 581 | 582 |
| 582 /* Decode the file name NAME using the specified coding system | 583 /* Decode the file name NAME using the specified coding system |
| 583 for file names, if any. */ | 584 for file names, if any. */ |
| 584 #define DECODE_FILE(name) \ | 585 #define DECODE_FILE(name) \ |
| 585 (! NILP (Vfile_name_coding_system) \ | 586 (! NILP (Vfile_name_coding_system) \ |
| 586 && XFASTINT (Vfile_name_coding_system) != 0 \ | 587 && !EQ (Vfile_name_coding_system, make_number (0)) \ |
| 587 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ | 588 ? code_convert_string_norecord (name, Vfile_name_coding_system, 0) \ |
| 588 : (! NILP (Vdefault_file_name_coding_system) \ | 589 : (! NILP (Vdefault_file_name_coding_system) \ |
| 589 && XFASTINT (Vdefault_file_name_coding_system) != 0 \ | 590 && !EQ (Vdefault_file_name_coding_system, make_number (0)) \ |
| 590 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ | 591 ? code_convert_string_norecord (name, Vdefault_file_name_coding_system, 0) \ |
| 591 : name)) | 592 : name)) |
| 592 | 593 |
| 593 #ifdef WINDOWSNT | 594 #ifdef WINDOWSNT |
| 594 /* Encode the string STR using the specified coding system | 595 /* Encode the string STR using the specified coding system |
| 595 for w32 system functions, if any. */ | 596 for w32 system functions, if any. */ |
| 596 #define ENCODE_SYSTEM(str) \ | 597 #define ENCODE_SYSTEM(str) \ |
| 597 (! NILP (Vlocale_coding_system) \ | 598 (! NILP (Vlocale_coding_system) \ |
| 598 && XFASTINT (Vlocale_coding_system) != 0 \ | 599 && !EQ (Vlocale_coding_system, make_number (0)) \ |
| 599 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ | 600 ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \ |
| 600 : str) | 601 : str) |
| 601 | 602 |
| 602 /* Decode the string STR using the specified coding system | 603 /* Decode the string STR using the specified coding system |
| 603 for w32 system functions, if any. */ | 604 for w32 system functions, if any. */ |
| 604 #define DECODE_SYSTEM(name) \ | 605 #define DECODE_SYSTEM(name) \ |
| 605 (! NILP (Vlocale_coding_system) \ | 606 (! NILP (Vlocale_coding_system) \ |
| 606 && XFASTINT (Vlocale_coding_system) != 0 \ | 607 && !EQ (Vlocale_coding_system, make_number (0)) \ |
| 607 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ | 608 ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \ |
| 608 : str) | 609 : str) |
| 609 | 610 |
| 610 #else /* WINDOWSNT */ | 611 #else /* WINDOWSNT */ |
| 611 | 612 |
