From be6ddad58e19dd88ca9dfc61c29c8b8a37434b41 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Fri, 5 May 2017 14:01:38 +0200 Subject: [PATCH] Editorial: check non-null before null In particular in all places with two null checks in a row and for EUC-JP as it would stand out otherwise. --- encoding.bs | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/encoding.bs b/encoding.bs index eba8e27..f315b5b 100644 --- a/encoding.bs +++ b/encoding.bs @@ -1678,13 +1678,13 @@ consumers of content generated with GBK's encoder. pointer is null and the index code point for pointer in index gb18030 otherwise. -
  • If code point is null and byte is an - ASCII byte, prepend - byte to stream. +

  • If code point is non-null, return a code point whose value is + code point. -

  • If code point is null, return error. +

  • If byte is an ASCII byte, prepend byte to + stream. -

  • Return a code point whose value is code point. +

  • Return error.

  • If byte is an ASCII byte, return @@ -1727,7 +1727,7 @@ consumers of content generated with GBK's encoder. code point in index gb18030.

  • -

    If pointer is not null, run these substeps: +

    If pointer is non-null, run these substeps:

    1. Let lead be pointer / 190 + 0x81. @@ -1826,13 +1826,13 @@ consumers of content generated with GBK's encoder. pointer is null and the index code point for pointer in index Big5 otherwise. -

    2. If code point is null and byte is an - ASCII byte, prepend - byte to stream. +

    3. If code point is non-null, return a code point whose value is + code point. -

    4. If code point is null, return error. +

    5. If byte is an ASCII byte, prepend byte to + stream. -

    6. Return a code point whose value is code point. +

    7. Return error.

  • If byte is an ASCII byte, return @@ -1923,12 +1923,13 @@ consumers of content generated with GBK's encoder.

  • Unset the EUC-JP jis0212 flag. +

  • If code point is non-null, return a code point whose value is + code point. +

  • If byte is an ASCII byte, prepend byte to stream. -

  • If code point is null, return error. - -

  • Return a code point whose value is code point. +

  • Return error.

  • If byte is an ASCII byte, return @@ -2341,13 +2342,13 @@ consumers of content generated with GBK's encoder. pointer is null, and the index code point for pointer in index jis0208 otherwise. -

  • If code point is null and byte is an - ASCII byte, prepend - byte to stream. +

  • If code point is non-null, return a code point whose value is + code point. -

  • If code point is null, return error. +

  • If byte is an ASCII byte, prepend byte to + stream. -

  • Return a code point whose value is code point. +

  • Return error.

  • If byte is an ASCII byte or 0x80, return a code point @@ -2445,13 +2446,13 @@ consumers of content generated with GBK's encoder. and the index code point for pointer in index EUC-KR otherwise. -

  • If code point is null and byte is an - ASCII byte, prepend - byte to stream. +

  • If code point is non-null, return a code point whose value is + code point. -

  • If code point is null, return error. +

  • If byte is an ASCII byte, prepend byte to + stream. -

  • Return a code point whose value is code point. +

  • Return error.

  • If byte is an ASCII byte, return @@ -2535,7 +2536,7 @@ and byte, runs these steps:

    1. If byte is end-of-stream and either - UTF-16 lead byte or UTF-16 lead surrogate is not null, set + UTF-16 lead byte or UTF-16 lead surrogate is non-null, set UTF-16 lead byte and UTF-16 lead surrogate to null, and return error. @@ -2559,7 +2560,7 @@ and byte, runs these steps:

      Then set UTF-16 lead byte to null.

    2. -

      If UTF-16 lead surrogate is not null, let +

      If UTF-16 lead surrogate is non-null, let lead surrogate be UTF-16 lead surrogate, set UTF-16 lead surrogate to null, and then run these substeps: