[OpenSIPS-Devel] [opensips] Make s.int also operate on floats/doubles by truncating them to an int (#836)
rrb3942
notifications at github.com
Tue Mar 22 18:09:09 CET 2016
This actually makes two changes:
1. It makes it so that when {s.int} is performed on an empty string it returns 0. This was the old/original behavior that was changed by https://github.com/OpenSIPS/opensips/commit/4fdb55bfab9b7cfcc3dfbf15093e2becafe7ec4b
Not sure if it was intended to affect the transformation or not. While I think the change is good for the primary use of that function, for the script level transformation we should be more lax.
2. {s.int} now also accepts a double/float and returns an int. It always truncates the number (e.g. 2.9 is 2, 2.3 is 2, -2.9 is -2, -2.3 is -2), which I think is a sane default. If someone needs more control over the rounding they can use the mathops module.
See issue #788 for some a bit of discussion on making {s.int} more permissive.
Not sure where to update the documentation for the transformations. If someone can point me at the right spot I am glad to update the documentation as well to reflect these changes.
Thanks.
You can view, comment on, or merge this pull request online at:
https://github.com/OpenSIPS/opensips/pull/836
-- Commit Summary --
* Make s.int also operate on floats/doubles by truncating them to an int
-- File Changes --
M Makefile.defs (2)
M transformations.c (24)
-- Patch Links --
https://github.com/OpenSIPS/opensips/pull/836.patch
https://github.com/OpenSIPS/opensips/pull/836.diff
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/836
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20160322/4927fd32/attachment.htm>
More information about the Devel
mailing list