--- parser3/src/classes/math.C 2015/10/06 22:20:50 1.78 +++ parser3/src/classes/math.C 2016/07/21 17:05:37 1.82 @@ -1,7 +1,7 @@ /** @file Parser: @b math parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) portions from gen_uuid.c, @@ -22,7 +22,7 @@ extern "C" char *crypt(const char* , const char* ); #endif -volatile const char * IDENT_MATH_C="$Id: math.C,v 1.78 2015/10/06 22:20:50 moko Exp $"; +volatile const char * IDENT_MATH_C="$Id: math.C,v 1.82 2016/07/21 17:05:37 moko Exp $"; // defines @@ -31,16 +31,16 @@ volatile const char * IDENT_MATH_C="$Id: // class class MMath: public Methoded { -public: - MMath(); - public: // Methoded bool used_directly() { return false; } + +public: + MMath(); }; // global variables -DECLARE_CLASS_VAR(math, 0 /*fictive*/, new MMath); +DECLARE_CLASS_VAR(math, new MMath); // methods @@ -480,23 +480,10 @@ static void _digest(Request& r, MethodPa } static void _uuid(Request& r, MethodParams& /*params*/) { - uuid uuid=get_uuid(); - - const size_t bufsize=36+1/*zero-teminator*/+1/*for faulty snprintfs*/; - char* cstr=new(PointerFreeGC) char[bufsize]; - - snprintf(cstr, bufsize, - "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", - uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, - uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, - uuid.node[0], uuid.node[1], uuid.node[2], - uuid.node[3], uuid.node[4], uuid.node[5]); - - r.write_pass_lang(*new String(cstr)); + r.write_pass_lang(*new String(get_uuid_cstr())); } static void _uid64(Request& r, MethodParams& /*params*/) { - unsigned char id[64/8]; random(&id, sizeof(id)); @@ -510,7 +497,7 @@ static void _crc32(Request& r, MethodPar static void toBase(unsigned long long int value, unsigned int base, char*& ptr){ static const char* hex="0123456789ABCDEF"; - int rest = value % base; + unsigned int rest = (unsigned int)(value % base); if(value >= base) toBase( (value-rest)/base, base, ptr); *ptr++=(char)hex[rest];