]> code.delx.au - gnu-emacs/blobdiff - src/ccl.c
Rework C source files to avoid ^(
[gnu-emacs] / src / ccl.c
index 053544c8274789d5768454a1ee8074ce2d3d139b..d9620340f09be08b1de3a37eb0bad6bf08b6838a 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1,5 +1,5 @@
 /* CCL (Code Conversion Language) interpreter.
-   Copyright (C) 2001-2015 Free Software Foundation, Inc.
+   Copyright (C) 2001-2016 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -12,8 +12,8 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -1713,7 +1713,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_STAT_INVALID_CMD:
          msglen = sprintf (msg,
                            "\nCCL: Invalid command %x (ccl_code = %x) at %d.",
-                           code & 0x1F, code, this_ic);
+                           code & 0x1Fu, code + 0u, this_ic);
 #ifdef CCL_DEBUG
          {
            int i = ccl_backtrace_idx - 1;
@@ -2071,12 +2071,10 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
     }
 
   buf_magnification = ccl.buf_magnification ? ccl.buf_magnification : 1;
-
-  if ((min (PTRDIFF_MAX, SIZE_MAX) - 256) / buf_magnification < str_bytes)
+  outbufsize = str_bytes;
+  if (INT_MULTIPLY_WRAPV (buf_magnification, outbufsize, &outbufsize)
+      || INT_ADD_WRAPV (256, outbufsize, &outbufsize))
     memory_full (SIZE_MAX);
-  outbufsize = (ccl.buf_magnification
-               ? str_bytes * ccl.buf_magnification + 256
-               : str_bytes + 256);
   outp = outbuf = xmalloc (outbufsize);
 
   consumed_chars = consumed_bytes = 0;
@@ -2283,10 +2281,6 @@ syms_of_ccl (void)
   DEFSYM (Qccl, "ccl");
   DEFSYM (Qcclp, "cclp");
 
-  /* This symbol is a property which associates with ccl program vector.
-     Ex: (get 'ccl-big5-encoder 'ccl-program) returns ccl program vector.  */
-  DEFSYM (Qccl_program, "ccl-program");
-
   /* Symbols of ccl program have this property, a value of the property
      is an index for Vccl_program_table. */
   DEFSYM (Qccl_program_idx, "ccl-program-idx");