<p>Richard Mudgett <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/8209">View Change</a></p><p>Patch set 4:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p>(8 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/8209/4/include/asterisk/file.h">File include/asterisk/file.h:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/include/asterisk/file.h@447">Patch Set #4, Line 447:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> * \retval 1 if not supported<br> * \retval 0 if supported<br> */<br>int ast_is_file_ext_supported(const char *file_ext);<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">The return value is opposite of what the function name implies. Avoid confusion and make return what someone would expect.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">if (ast_is_file_ext_supported(ext)) {<br> ext is supported.<br>}</pre></li></ul></li><li><p><a href="https://gerrit.asterisk.org/#/c/8209/4/include/asterisk/mod_format.h">File include/asterisk/mod_format.h:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/include/asterisk/mod_format.h@47">Patch Set #4, Line 47:</a> <code style="font-family:monospace,monospace"> char mime_types[80]; /*!< MIME Types related to the format (separated by | if more than one)*/</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Some kinda delimiter will be needed to support cases like : https://gerrit.</blockquote></p><ul><li>80 should be enough. The contents of the struct is constant and the compiler will warn if you try to assign a longer string into the fixed size where it is initialized.</li></ul><ul><li>This patch cannot go anywhere but the master branch because adding anything to this struct breaks ABI.</li></ul></li></ul></li><li><p><a href="https://gerrit.asterisk.org/#/c/8209/4/main/file.c">File main/file.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/file.c@356">Patch Set #4, Line 356:</a> <code style="font-family:monospace,monospace">static int mime_types_compare(const char *mime_types, const char *type)</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">This function is not needed. The only difference between this function and the already existing exts_compare() function is the name.</p><p style="white-space: pre-wrap; word-wrap: break-word;">How about renaming the old function to:<br>int type_is_in(const char *list, const char *type)</p><p style="white-space: pre-wrap; word-wrap: break-word;"><br>Also make use ast_strdupa() to dynamically allocate and copy 'list' to the stack:<br>char *stringp = ast_strdupa(list);</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/file.c@1950">Patch Set #4, Line 1950:</a> <code style="font-family:monospace,monospace"> if (exts) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Not sure I get your suggestion here. </blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">It would avoid wasted processing to not pass in a NULL exts or check it for NULL first. As it is you check it for every time through the loop.</p></li></ul></li><li><p><a href="https://gerrit.asterisk.org/#/c/8209/4/main/media_cache.c">File main/media_cache.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/media_cache.c@146">Patch Set #4, Line 146:</a> <code style="font-family:monospace,monospace"> char temp_ext[PATH_MAX];</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">How about found_ext[] instead.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/media_cache.c@147">Patch Set #4, Line 147:</a> <code style="font-family:monospace,monospace"> strcpy(temp_ext, ext);</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">strcpy() could write beyond the buffer. Use ast_string_copy().</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/media_cache.c@162">Patch Set #4, Line 162:</a> <code style="font-family:monospace,monospace"> char *tmp = strsep(&exts, "|");</code></p><p style="white-space: pre-wrap; word-wrap: break-word;">tmp is always a lousy name as it provides no meaningful information about what tmp is.</p><p style="white-space: pre-wrap; word-wrap: break-word;">In this case ext or exten would be a better name.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/8209/4/main/media_cache.c@164">Patch Set #4, Line 164:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;"> /* Not updating the original ext here to keep the key for media-cache same */<br> snprintf(temp_ext, strlen(temp_ext), ".%s", tmp);<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Is having to truncate the extension a good thing? It seems a bad thing to wind up renaming a file to something with a truncated format extension.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/8209">change 8209</a>. To unsubscribe, 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/8209"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I1b14692a49b2c1ac67688f58757184122e92ba89 </div>
<div style="display:none"> Gerrit-Change-Number: 8209 </div>
<div style="display:none"> Gerrit-PatchSet: 4 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Gaurav Khurana <gkhurana@godaddy.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 14 Feb 2018 23:17:44 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>