|
|
| version 1.83, 2016/11/01 23:10:40 | version 1.86, 2017/12/07 00:23:16 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b math parser class. | Parser: @b math parser class. |
| Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) |
| Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru>(http://paf.design.ru) |
| portions from gen_uuid.c, | portions from gen_uuid.c, |
| Line 46 DECLARE_CLASS_VAR(math, new MMath); | Line 46 DECLARE_CLASS_VAR(math, new MMath); |
| static void _random(Request& r, MethodParams& params) { | static void _random(Request& r, MethodParams& params) { |
| double top=params.as_double(0, "range must be expression", r); | double top=params.as_double(0, "range must be expression", r); |
| if(top<=0 || top>MAX_UINT) | if(top<1 || top>INT32_MAX) |
| throw Exception(PARSER_RUNTIME, | throw Exception(PARSER_RUNTIME, 0, "top(%.15g) must be [1..%u]", top, INT32_MAX); |
| 0, | |
| "top(%g) must be [1..%u]", top, MAX_UINT); | |
| r.write(*new VInt(_random(uint(top)))); | r.write(*new VInt(_random(uint(top)))); |
| } | } |
| Line 394 static void _digest(Request& r, MethodPa | Line 391 static void _digest(Request& r, MethodPa |
| else if (smethod == "sha1" ) method = M_SHA1; | else if (smethod == "sha1" ) method = M_SHA1; |
| else if (smethod == "sha256" ) method = M_SHA256; | else if (smethod == "sha256" ) method = M_SHA256; |
| else if (smethod == "sha512" ) method = M_SHA512; | else if (smethod == "sha512" ) method = M_SHA512; |
| else throw Exception(PARSER_RUNTIME, &smethod, "must be 'md5' or 'sha1'"); | else throw Exception(PARSER_RUNTIME, &smethod, "must be 'md5' or 'sha1' or 'sha256' or 'sha512'"); |
| const char *hmac=0; | const char *hmac=0; |
| enum Format { F_HEX, F_BASE64 } format = F_HEX; | enum Format { F_HEX, F_BASE64 } format = F_HEX; |