--- parser3/src/classes/math.C 2007/08/17 09:00:50 1.50 +++ parser3/src/classes/math.C 2008/06/16 12:38:41 1.53 @@ -8,7 +8,7 @@ Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o. */ -static const char * const IDENT_MATH_C="$Date: 2007/08/17 09:00:50 $"; +static const char * const IDENT_MATH_C="$Date: 2008/06/16 12:38:41 $"; #include "pa_vmethod_frame.h" #include "pa_common.h" @@ -283,7 +283,7 @@ static void _crypt(Request& r, MethodPar } static void _md5(Request& r, MethodParams& params) { - const char *string=params.as_string(0, "parameter must be string").cstr(); + const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr(); PA_MD5_CTX context; unsigned char digest[16]; @@ -418,7 +418,7 @@ void SHA1PadMessage(SHA1Context *context static void _sha1(Request& r, MethodParams& params) { - const char *string = params.as_string(0, "parameter must be string").cstr(); + const char *string = params.as_string(0, PARAMETER_MUST_BE_STRING).cstr(); SHA1Context c; SHA1Reset (&c); @@ -487,24 +487,10 @@ static void _uid64(Request& r, MethodPar } static void _crc32(Request& r, MethodParams& params) { - const char *string=params.as_string(0, "parameter must be string").cstr(); + const char *string=params.as_string(0, PARAMETER_MUST_BE_STRING).cstr(); r.write_no_lang(*new VInt(pa_crc32(string, strlen(string)))); } -static void _long2ip(Request& r, MethodParams& params) { - unsigned long l=(unsigned long)trunc(params.as_double(0, "parameter must be expression", r)); - static const int ip_cstr_bufsize=15+1+1; - char* ip_cstr=new(PointerFreeGC) char[ip_cstr_bufsize]; - - snprintf(ip_cstr, ip_cstr_bufsize, "%d.%d.%d.%d", - (l>>24) & 0xFF, - (l>>16) & 0xFF, - (l>>8) & 0xFF, - l & 0xFF); - - r.write_no_lang(*new String(ip_cstr)); -} - // constructor MMath::MMath(): Methoded("math") { @@ -542,8 +528,6 @@ MMath::MMath(): Methoded("math") { // ^math:crc32[string] ADD1(crc32); - ADD1(long2ip); - // ^math:uuid[] ADD0(uuid);