This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  275baabc91b08bf55e123382d4b60d43e7eb6a52 (commit)
      from  e650ca498c29302e5ab5961b2543bd1eb56676d6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=275baabc91b08bf55e123382d4b60d43e7eb6a52

commit 275baabc91b08bf55e123382d4b60d43e7eb6a52
Author: mirabilos <[email protected]>
Date:   Tue Mar 7 22:32:29 2017 +0100

    update minijson to latest version, a bit faster

diff --git a/src/common/include/minijson.php b/src/common/include/minijson.php
index 94a61fe..b927c94 100644
--- a/src/common/include/minijson.php
+++ b/src/common/include/minijson.php
@@ -2,7 +2,7 @@
 /**
  * Minimal complete JSON generator and parser for FusionForge and SimKolab
  *
- * Copyright © 2010, 2011, 2012, 2014, 2016
+ * Copyright © 2010, 2011, 2012, 2014, 2016, 2017
  *     mirabilos <[email protected]>
  *
  * Provided that these terms and disclaimer and all copyright notices
@@ -39,8 +39,8 @@
  * in: integer (optional) recursion depth (default: 32)
  * out:        string encoded
  */
-function minijson_encode($x, $ri="", $depth=32) {
-       return (minijson_encode_internal($x, $ri, $depth, false, false));
+function minijson_encode($x, $ri='', $depth=32) {
+       return (minijson_encode_internal($x, $ri, $depth, 0, false));
 }
 
 /**
@@ -56,11 +56,11 @@ function minijson_encode($x, $ri="", $depth=32) {
 function minijson_encode_internal($x, $ri, $depth, $truncsz, $dumprsrc) {
        if (!$depth-- || !isset($x) || is_null($x) || (is_float($x) &&
            (is_nan($x) || is_infinite($x))))
-               return "null";
+               return 'null';
        if ($x === true)
-               return "true";
+               return 'true';
        if ($x === false)
-               return "false";
+               return 'false';
        if (is_int($x)) {
                $y = (int)$x;
                $z = (string)$y;
@@ -69,23 +69,23 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                $x = (string)$x;
        }
        if (is_float($x)) {
-               $rs = sprintf("%.14e", $x);
-               $v = explode("e", $rs);
-               $rs = rtrim($v[0], "0");
-               if (substr($rs, -1) == ".") {
-                       $rs .= "0";
+               $rs = sprintf('%.14e', $x);
+               $v = explode('e', $rs);
+               $rs = rtrim($v[0], '0');
+               if (substr($rs, -1) == '.') {
+                       $rs .= '0';
                }
-               if ($v[1] != "-0" && $v[1] != "+0") {
-                       $rs .= "E" . $v[1];
+               if ($v[1] != '-0' && $v[1] != '+0') {
+                       $rs .= 'E' . $v[1];
                }
                return $rs;
        }
        if (is_string($x)) {
-               $rs = "\"";
+               $rs = '"';
 
                if ($truncsz && (strlen($x) > $truncsz)) {
                        /* truncate very long texts */
-                       $rs = "TOO_LONG_STRING_TRUNCATED:\"";
+                       $rs = 'TOO_LONG_STRING_TRUNCATED:"';
                        $x = substr($x, 0, $truncsz);
                }
 
@@ -101,9 +101,9 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                if (function_exists('mb_internal_encoding') &&
                    function_exists('mb_convert_encoding')) {
                        $mb_encoding = mb_internal_encoding();
-                       mb_internal_encoding("UTF-8");
-                       $z = mb_convert_encoding($x, "UTF-16LE", "UTF-8");
-                       $y = mb_convert_encoding($z, "UTF-8", "UTF-16LE");
+                       mb_internal_encoding('UTF-8');
+                       $z = mb_convert_encoding($x, 'UTF-16LE', 'UTF-8');
+                       $y = mb_convert_encoding($z, 'UTF-8', 'UTF-16LE');
                        $isunicode = ($y == $x);
                }
                if ($isunicode) {
@@ -120,26 +120,26 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        if ($y == 0) {
                                break;
                        } elseif ($y == 8) {
-                               $rs .= "\\b";
+                               $rs .= '\b';
                        } elseif ($y == 9) {
-                               $rs .= "\\t";
+                               $rs .= '\t';
                        } elseif ($y == 10) {
-                               $rs .= "\\n";
+                               $rs .= '\n';
                        } elseif ($y == 12) {
-                               $rs .= "\\f";
+                               $rs .= '\f';
                        } elseif ($y == 13) {
-                               $rs .= "\\r";
+                               $rs .= '\r';
                        } elseif ($y == 34) {
-                               $rs .= "\\\"";
+                               $rs .= '\"';
                        } elseif ($y == 92) {
-                               $rs .= "\\\\";
+                               $rs .= '\\\\';
                        } elseif ($y < 0x20 || $y > 0xFFFD ||
                            ($y >= 0xD800 && $y <= 0xDFFF) ||
                            ($y > 0x7E && (!$isunicode || $y < 0xA0))) {
-                               $rs .= sprintf("\\u%04X", $y);
+                               $rs .= sprintf('\u%04X', $y);
                        } elseif ($isunicode && $y > 0x7E) {
-                               $rs .= mb_convert_encoding($v, "UTF-8",
-                                   "UTF-16LE");
+                               $rs .= mb_convert_encoding($v, 'UTF-8',
+                                   'UTF-16LE');
                        } else {
                                $rs .= $v[0];
                        }
@@ -147,7 +147,7 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                if ($mb_encoding !== false) {
                        mb_internal_encoding($mb_encoding);
                }
-               return $rs."\"";
+               return $rs.'"';
        }
        if (is_array($x)) {
                $k = array_keys($x);
@@ -182,18 +182,18 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        }
                }
 
-               $si = $ri === false ? false : $ri . "  ";
+               $si = $ri === false ? false : $ri . '  ';
                $first = true;
                if ($isnum) {
                        /* all array keys are integers 0‥n */
-                       $rs = "[";
+                       $rs = '[';
                        if ($ri !== false)
                                $rs .= "\n";
                        foreach ($s as $v) {
                                if ($first)
                                        $first = false;
                                elseif ($ri === false)
-                                       $rs .= ",";
+                                       $rs .= ',';
                                else
                                        $rs .= ",\n";
                                if ($si !== false)
@@ -203,11 +203,11 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        }
                        if ($ri !== false)
                                $rs .= "\n" . $ri;
-                       $rs .= "]";
+                       $rs .= ']';
                        return $rs;
                }
 
-               $rs = "{";
+               $rs = '{';
                if ($ri !== false)
                        $rs .= "\n";
                sort($k, SORT_STRING);
@@ -215,7 +215,7 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        if ($first)
                                $first = false;
                        elseif ($ri === false)
-                               $rs .= ",";
+                               $rs .= ',';
                        else
                                $rs .= ",\n";
                        if ($si !== false)
@@ -223,15 +223,15 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        $rs .= minijson_encode_internal((string)$v, false,
                            $depth, $truncsz, $dumprsrc);
                        if ($ri === false)
-                               $rs .= ":";
+                               $rs .= ':';
                        else
-                               $rs .= ": ";
+                               $rs .= ': ';
                        $rs .= minijson_encode_internal($x[$v], $si,
                            $depth, $truncsz, $dumprsrc);
                }
                if ($ri !== false)
                        $rs .= "\n" . $ri;
-               $rs .= "}";
+               $rs .= '}';
                return $rs;
        }
        if (is_object($x)) {
@@ -243,9 +243,9 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        $k[$v] = 
preg_replace('/^\0([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\*)\0(.)/',
                            '\\\\$1\\\\$2', $v);
                }
-               $si = $ri === false ? false : $ri . "  ";
+               $si = $ri === false ? false : $ri . '  ';
                $first = true;
-               $rs = "{";
+               $rs = '{';
                if ($ri !== false)
                        $rs .= "\n";
                asort($k, SORT_STRING);
@@ -253,7 +253,7 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        if ($first)
                                $first = false;
                        elseif ($ri === false)
-                               $rs .= ",";
+                               $rs .= ',';
                        else
                                $rs .= ",\n";
                        if ($si !== false)
@@ -261,32 +261,32 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
                        $rs .= minijson_encode_internal($s, false,
                            $depth, $truncsz, $dumprsrc);
                        if ($ri === false)
-                               $rs .= ":";
+                               $rs .= ':';
                        else
-                               $rs .= ": ";
+                               $rs .= ': ';
                        $rs .= minijson_encode_internal($x[$v], $si,
                            $depth, $truncsz, $dumprsrc);
                }
                if ($ri !== false)
                        $rs .= "\n" . $ri;
-               $rs .= "}";
+               $rs .= '}';
                return $rs;
        }
 
        /* http://de2.php.net/manual/en/function.is-resource.php#103942 */
-       if ($dumprsrc && !is_null(@get_resource_type($x))) {
-               $k = "" . (string)get_resource_type($x);
-               $rs = "{";
+       if ($dumprsrc && !is_null($rsrctype = @get_resource_type($x))) {
+               $k = ''.$rsrctype;
+               $rs = '{';
                if ($ri !== false)
-                       $rs .= "\n" . $ri . "  ";
-               $rs .= "\"\\u0000resource\":";
+                       $rs .= "\n" . $ri . '  ';
+               $rs .= '"\u0000resource":';
                if ($ri !== false)
-                       $rs .= " ";
+                       $rs .= ' ';
                $rs .= minijson_encode_internal($k, false,
                    $depth, $truncsz, $dumprsrc);
                if ($ri !== false)
                        $rs .= "\n" . $ri;
-               $rs .= "}";
+               $rs .= '}';
                return $rs;
        }
 
@@ -305,17 +305,17 @@ function minijson_encode_internal($x, $ri, $depth, 
$truncsz, $dumprsrc) {
  */
 function minijson_decode($sj, &$ov, $depth=32) {
        if (!isset($sj) || !$sj) {
-               $ov = "empty input";
+               $ov = 'empty input';
                return false;
        }
 
        /* mb_convert_encoding simply must exist for the decoder */
        $mb_encoding = mb_internal_encoding();
-       mb_internal_encoding("UTF-8");
+       mb_internal_encoding('UTF-8');
 
        /* see note about mb_check_encoding in the JSON encoder… */
-       $wj = mb_convert_encoding($sj, "UTF-16LE", "UTF-8");
-       $mj = mb_convert_encoding($wj, "UTF-8", "UTF-16LE");
+       $wj = mb_convert_encoding($sj, 'UTF-16LE', 'UTF-8');
+       $mj = mb_convert_encoding($wj, 'UTF-8', 'UTF-16LE');
        $rv = ($mj == $sj);
        unset($sj);
        unset($mj);
@@ -338,7 +338,7 @@ function minijson_decode($sj, &$ov, $depth=32) {
                /* parse recursively */
                $rv = minijson_decode_value($j, $p, $ov, $depth);
        } else {
-               $ov = "input not valid UTF-8";
+               $ov = 'input not valid UTF-8';
        }
 
        if ($rv) {
@@ -348,7 +348,7 @@ function minijson_decode($sj, &$ov, $depth=32) {
                /* end of string? */
                if ($j[$p] !== 0) {
                        /* no, trailing waste */
-                       $ov = "expected EOS at wchar #" . $p;
+                       $ov = 'expected EOS at wchar #' . $p;
                        $rv = false;
                }
        }
@@ -374,8 +374,8 @@ function minijson_get_hexdigit(&$j, &$p, &$v, $i) {
        } elseif ($wc >= 0x61 && $wc <= 0x66) {
                $v += $wc - 0x57;
        } else {
-               $ov = sprintf("invalid hex in unicode escape" .
-                   " sequence (%d) at wchar #%u", $i, $p);
+               $ov = sprintf('invalid hex in unicode escape' .
+                   ' sequence (%d) at wchar #%u', $i, $p);
                return false;
        }
        return true;
@@ -403,7 +403,7 @@ function minijson_decode_array(&$j, &$p, &$ov, $depth) {
                        $p++;
                        if ($first) {
                                /* no comma before the first member */
-                               $ov = "unexpected comma at wchar #" . $p;
+                               $ov = 'unexpected comma at wchar #' . $p;
                                return false;
                        }
                } elseif (!$first) {
@@ -412,7 +412,7 @@ function minijson_decode_array(&$j, &$p, &$ov, $depth) {
                         * comma; this also catches e.g. trailing
                         * rubbish after numbers
                         */
-                       $ov = "expected comma at wchar #" . $p;
+                       $ov = 'expected comma at wchar #' . $p;
                        return false;
                }
                $first = false;
@@ -449,7 +449,7 @@ function minijson_decode_object(&$j, &$p, &$ov, $depth) {
                        $p++;
                        if ($first) {
                                /* no comma before the first member */
-                               $ov = "unexpected comma at wchar #" . $p;
+                               $ov = 'unexpected comma at wchar #' . $p;
                                return false;
                        }
                } elseif (!$first) {
@@ -458,7 +458,7 @@ function minijson_decode_object(&$j, &$p, &$ov, $depth) {
                         * comma; this also catches e.g. trailing
                         * rubbish after numbers
                         */
-                       $ov = "expected comma at wchar #" . $p;
+                       $ov = 'expected comma at wchar #' . $p;
                        return false;
                }
                $first = false;
@@ -468,7 +468,7 @@ function minijson_decode_object(&$j, &$p, &$ov, $depth) {
 
                /* parse the member key */
                if ($j[$p++] != 0x22) {
-                       $ov = "expected key string at wchar #" . $p;
+                       $ov = 'expected key string at wchar #' . $p;
                        return false;
                }
                $k = null;
@@ -483,7 +483,7 @@ function minijson_decode_object(&$j, &$p, &$ov, $depth) {
 
                /* key-value separator? */
                if ($j[$p++] != 0x3A) {
-                       $ov = "expected colon at wchar #" . $p;
+                       $ov = 'expected colon at wchar #' . $p;
                        return false;
                }
 
@@ -507,7 +507,7 @@ function minijson_decode_value(&$j, &$p, &$ov, $depth) {
 
        /* style: falling through exits with false */
        if ($wc == 0) {
-               $ov = "unexpected EOS at wchar #" . $p;
+               $ov = 'unexpected EOS at wchar #' . $p;
        } elseif ($wc == 0x6E) {
                /* literal null? */
                if ($j[$p++] == 0x75 &&
@@ -516,7 +516,7 @@ function minijson_decode_value(&$j, &$p, &$ov, $depth) {
                        $ov = NULL;
                        return true;
                }
-               $ov = "expected ull after n near wchar #" . $p;
+               $ov = 'expected ull after n near wchar #' . $p;
        } elseif ($wc == 0x74) {
                /* literal true? */
                if ($j[$p++] == 0x72 &&
@@ -525,7 +525,7 @@ function minijson_decode_value(&$j, &$p, &$ov, $depth) {
                        $ov = true;
                        return true;
                }
-               $ov = "expected rue after t near wchar #" . $p;
+               $ov = 'expected rue after t near wchar #' . $p;
        } elseif ($wc == 0x66) {
                /* literal false? */
                if ($j[$p++] == 0x61 &&
@@ -535,45 +535,45 @@ function minijson_decode_value(&$j, &$p, &$ov, $depth) {
                        $ov = false;
                        return true;
                }
-               $ov = "expected alse after f near wchar #" . $p;
+               $ov = 'expected alse after f near wchar #' . $p;
        } elseif ($wc == 0x5B) {
                if (--$depth > 0) {
                        return minijson_decode_array($j, $p, $ov, $depth);
                }
-               $ov = "recursion limit exceeded at wchar #" . $p;
+               $ov = 'recursion limit exceeded at wchar #' . $p;
        } elseif ($wc == 0x7B) {
                if (--$depth > 0) {
                        return minijson_decode_object($j, $p, $ov, $depth);
                }
-               $ov = "recursion limit exceeded at wchar #" . $p;
+               $ov = 'recursion limit exceeded at wchar #' . $p;
        } elseif ($wc == 0x22) {
                return minijson_decode_string($j, $p, $ov);
        } elseif ($wc == 0x2D || ($wc >= 0x30 && $wc <= 0x39)) {
                $p--;
                return minijson_decode_number($j, $p, $ov);
        } else {
-               $ov = sprintf("unexpected U+%04X at wchar #%u", $wc, $p);
+               $ov = sprintf('unexpected U+%04X at wchar #%u', $wc, $p);
        }
        return false;
 }
 
 function minijson_decode_string(&$j, &$p, &$ov) {
        /* UTF-16LE string buffer */
-       $s = "";
+       $s = '';
 
        while (true) {
                $wc = $j[$p++];
                if ($wc < 0x20) {
-                       $ov = "unescaped control character $wc at wchar #" . $p;
+                       $ov = 'unescaped control character $wc at wchar #' . $p;
                        return false;
                } elseif ($wc == 0x22) {
                        /* regular exit point for the loop */
 
                        /* convert to UTF-8, then re-check against UTF-16 */
-                       $ov = mb_convert_encoding($s, "UTF-8", "UTF-16LE");
-                       $tmp = mb_convert_encoding($ov, "UTF-16LE", "UTF-8");
+                       $ov = mb_convert_encoding($s, 'UTF-8', 'UTF-16LE');
+                       $tmp = mb_convert_encoding($ov, 'UTF-16LE', 'UTF-8');
                        if ($tmp != $s) {
-                               $ov = "no Unicode string before wchar #" . $p;
+                               $ov = 'no Unicode string before wchar #' . $p;
                                return false;
                        }
                        return true;
@@ -604,19 +604,19 @@ function minijson_decode_string(&$j, &$p, &$ov) {
                                        }
                                }
                                if ($v < 1 || $v > 0xFFFD) {
-                                       $ov = "non-Unicode escape $v before 
wchar #" . $p;
+                                       $ov = 'non-Unicode escape $v before 
wchar #' . $p;
                                        return false;
                                }
                                $s .= chr($v & 0xFF) . chr($v >> 8);
                        } else {
-                               $ov = "invalid escape sequence at wchar #" . $p;
+                               $ov = 'invalid escape sequence at wchar #' . $p;
                                return false;
                        }
                } elseif ($wc > 0xD7FF && $wc < 0xE000) {
-                       $ov = "surrogate $wc at wchar #" . $p;
+                       $ov = 'surrogate $wc at wchar #' . $p;
                        return false;
                } elseif ($wc > 0xFFFD) {
-                       $ov = "non-Unicode char $wc at wchar #" . $p;
+                       $ov = 'non-Unicode char $wc at wchar #' . $p;
                        return false;
                } else {
                        $s .= chr($wc & 0xFF) . chr($wc >> 8);
@@ -625,22 +625,22 @@ function minijson_decode_string(&$j, &$p, &$ov) {
 }
 
 function minijson_decode_number(&$j, &$p, &$ov) {
-       $s = "";
+       $s = '';
        $isint = true;
 
        /* check for an optional minus sign */
        $wc = $j[$p++];
        if ($wc == 0x2D) {
-               $s = "-";
+               $s = '-';
                $wc = $j[$p++];
        }
 
        if ($wc == 0x30) {
                /* begins with zero (0 or 0.x) */
-               $s .= "0";
+               $s .= '0';
                $wc = $j[$p++];
                if ($wc >= 0x30 && $wc <= 0x39) {
-                       $ov = "no leading zeroes please at wchar #" . $p;
+                       $ov = 'no leading zeroes please at wchar #' . $p;
                        return false;
                }
        } elseif ($wc >= 0x31 && $wc <= 0x39) {
@@ -650,21 +650,21 @@ function minijson_decode_number(&$j, &$p, &$ov) {
                        $wc = $j[$p++];
                }
        } else {
-               $ov = "decimal digit expected at wchar #" . $p;
-               if ($s[0] != "-") {
+               $ov = 'decimal digit expected at wchar #' . $p;
+               if ($s[0] != '-') {
                        /* we had none, so it’s allowed to prepend one */
-                       $ov = "minus sign or " . $ov;
+                       $ov = 'minus sign or ' . $ov;
                }
                return false;
        }
 
        /* do we have a fractional part? */
        if ($wc == 0x2E) {
-               $s .= ".";
+               $s .= '.';
                $isint = false;
                $wc = $j[$p++];
                if ($wc < 0x30 || $wc > 0x39) {
-                       $ov = "fractional digit expected at wchar #" . $p;
+                       $ov = 'fractional digit expected at wchar #' . $p;
                        return false;
                }
                while ($wc >= 0x30 && $wc <= 0x39) {
@@ -675,7 +675,7 @@ function minijson_decode_number(&$j, &$p, &$ov) {
 
        /* do we have an exponent, treat number as mantissa? */
        if ($wc == 0x45 || $wc == 0x65) {
-               $s .= "E";
+               $s .= 'E';
                $isint = false;
                $wc = $j[$p++];
                if ($wc == 0x2B || $wc == 0x2D) {
@@ -683,7 +683,7 @@ function minijson_decode_number(&$j, &$p, &$ov) {
                        $wc = $j[$p++];
                }
                if ($wc < 0x30 || $wc > 0x39) {
-                       $ov = "exponent digit expected at wchar #" . $p;
+                       $ov = 'exponent digit expected at wchar #' . $p;
                        return false;
                }
                while ($wc >= 0x30 && $wc <= 0x39) {

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/minijson.php | 184 ++++++++++++++++++++--------------------
 1 file changed, 92 insertions(+), 92 deletions(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to