-------- In message <[email protected]>, Geoff Simmons writes: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA256 > >On 8/12/15 5:16 PM, Arianna Aondio wrote: >> Hi, as discussed this afternoon on IRC with Federico, here is a >> patch for a std_vmod function for converting from real to int. > >+VCL_INT __match_proto__(td_std_time2real) >+vmod_real2integer(VRT_CTX, VCL_REAL r) >+{ >+ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); >+ >+ return((long)floor(r)); >+} > >Do we have to worry about what happens if r is non-finite (+-Inf or >NaN)? (Is that possible for a VCL_REAL?)
Yes. Proper range checking should be done, and like all other conversions, a default value parameter to use when that fails should be added. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [email protected] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. _______________________________________________ varnish-dev mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev
