couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [2/4] jiffy commit: updated refs/heads/master to f85e2fc
Date Mon, 30 Oct 2017 21:42:37 GMT
Tighten string buffer size calculation in enc_string.

When "\u"-escaping a Unicode character, the esc_extra value doesn't
need to include the number of bytes in the input string.  That is, if
a three-byte UTF-8 character is being escaped to a six-byte "\uXXXX"
sequence, esc_extra only needs to be increased by 3.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/df791ef6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/df791ef6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/df791ef6

Branch: refs/heads/master
Commit: df791ef638f138781d45ee65d2e98b1c2f384b8d
Parents: e19df02
Author: David Hull <david.hull@openx.com>
Authored: Thu Oct 5 20:48:56 2017 +0000
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Mon Oct 30 10:11:21 2017 -0500

----------------------------------------------------------------------
 c_src/encoder.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/df791ef6/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index e864777..afc3c14 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -307,10 +307,7 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
                     if(uval < 0) {
                         return 0;
                     }
-                    esc_extra += utf8_esc_len(uval);
-                    if(ulen < 0) {
-                        return 0;
-                    }
+                    esc_extra += utf8_esc_len(uval) - ulen;
                 }
                 i += ulen;
         }


Mime
View raw message