/* Coding system handler (conversion, detection, and etc).
- Copyright (C) 1995,97,1998,2002,2003 Electrotechnical Laboratory, JAPAN.
- Licensed to the Free Software Foundation.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005,
+ 2006 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1997, 1998, 2002, 2003, 2004, 2005
+ National Institute of Advanced Industrial Science and Technology (AIST)
+ Registration Number H14PRO021
This file is part of GNU Emacs.
c = -1; \
else \
{ \
- c -= 0xA0; \
+ c -= 0x80; \
*p++ = c; \
} \
} \
component[ncomponent] = c;
}
}
- else
+ else if (c >= 0x80)
{
/* This may be an old Emacs 20 style format. See the comment at
the section 2 of this file. */
else
return 0;
}
+ else
+ return 0;
if (buf == bufp || dst + (bufp - buf) <= (dst_bytes ? dst_end : src))
{
{
coding->eol_type = CODING_EOL_UNDECIDED;
coding->common_flags = CODING_REQUIRE_DETECTION_MASK;
+ if (system_eol_type != CODING_EOL_LF)
+ coding->common_flags |= CODING_REQUIRE_ENCODING_MASK;
}
else if (XFASTINT (eol_type) == 1)
{
coding->type = coding_type_no_conversion;
coding->category_idx = CODING_CATEGORY_IDX_BINARY;
coding->common_flags = 0;
- coding->eol_type = CODING_EOL_LF;
+ coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF;
+ if (coding->eol_type != CODING_EOL_LF)
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
coding->pre_write_conversion = coding->post_read_conversion = Qnil;
- return -1;
+ return NILP (coding_system) ? 0 : -1;
}
/* Free memory blocks allocated for storing composition information. */
coding->consumed = coding->consumed_char = 0;
coding->errors = 0;
coding->result = CODING_FINISH_NORMAL;
+ if (coding->eol_type == CODING_EOL_UNDECIDED)
+ coding->eol_type = system_eol_type;
switch (coding->type)
{
if (coding->type == coding_type_ccl
|| coding->eol_type == CODING_EOL_CRLF
|| coding->eol_type == CODING_EOL_CR
+ || (coding->eol_type == CODING_EOL_UNDECIDED
+ && system_eol_type != CODING_EOL_LF)
|| (coding->cmp_data && coding->cmp_data->used > 0))
{
/* We can't skip any data. */
code_convert_region_unwind (arg)
Lisp_Object arg;
{
+ struct gcpro gcpro1;
+ GCPRO1 (arg);
+
inhibit_pre_post_conversion = 0;
Vlast_coding_system_used = XCAR (arg);
for (arg = XCDR (arg); ! NILP (arg); arg = XCDR (arg))
Fkill_buffer (XCAR (arg));
+
+ UNGCPRO;
return Qnil;
}
from = XFASTINT (start);
to = XFASTINT (end);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return make_number (to - from);
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
CHECK_STRING (string);
CHECK_SYMBOL (coding_system);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return (NILP (nocopy) ? Fcopy_sequence (string) : string);
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
CHECK_STRING (string);
CHECK_SYMBOL (coding_system);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return string;
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)