<p>Patch set 7:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4; color: #000000;">Code-Review -1</span></p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15906">View Change</a></p><p>7 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c">File funcs/func_math.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@502">Patch Set #7, Line 502:</a> <code style="font-family:monospace,monospace">   if (ast_strlen_zero(args.num1) || ast_str_to_int(args.num1, &int1)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Now that I think some more about it I think this check would also be better split out. If args.num1 is not given (ex: MIN(,5)) then continue. However if a given value fails to parse to an int maybe that should cause a return error?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@506">Patch Set #7, Line 506:</a> <code style="font-family:monospace,monospace">       if (ast_strlen_zero(args.num2) || ast_str_to_int(args.num2, &int2)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Similar here. Should the parsing of the int cause a separate return error?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@514">Patch Set #7, Line 514:</a> <code style="font-family:monospace,monospace">    response_int = (int1 > int2) ? int2 : int1;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">What happens here if args.num1 is not set, but args.num2 is? For example MIN(,5).</p><p style="white-space: pre-wrap; word-wrap: break-word;">Probably needs an extra check:<br>if response_int == -1: response_int = int2<br>else: response_int = (int1 > int2) ? int2 : int1;</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@532">Patch Set #7, Line 532:</a> <code style="font-family:monospace,monospace">     if (ast_strlen_zero(args.num1) || ast_str_to_int(args.num1, &int1)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Similar to the others, should an int parsing error cause the function to return error here too?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@536">Patch Set #7, Line 536:</a> <code style="font-family:monospace,monospace">       if (ast_strlen_zero(args.num2) || ast_str_to_int(args.num2, &int2)) {</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Again, should an int parsing error be separated out here too and the function return?</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@544">Patch Set #7, Line 544:</a> <code style="font-family:monospace,monospace"> response_int = (int1 < int2) ? int2 : int1;</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Similar to the problem above...</p><p style="white-space: pre-wrap; word-wrap: break-word;">What happens here if args.num1 is not set, but args.num2 is? For example MAX(,5).</p><p style="white-space: pre-wrap; word-wrap: break-word;">Probably needs an extra check:<br>if response_int == -1: response_int = int2<br>else: response_int = (int1 < int2) ? int2 : int1;</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/15906/7/funcs/func_math.c@562">Patch Set #7, Line 562:</a> <code style="font-family:monospace,monospace">           ast_log(LOG_WARNING, "Missing argument for number(s).");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">Maybe update to say something like "Bad or missing argument for number" to encompass the potential parsing failure as well.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15906">change 15906</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15906"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I2bda9269d18f9d54833c85e48e41fce0e0ce4d8d </div>
<div style="display:none"> Gerrit-Change-Number: 15906 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-CC: Ivan Poddubny <ivan.poddubny@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 20 May 2021 15:52:29 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: Yes </div>
<div style="display:none"> Gerrit-MessageType: comment </div>