Merge "res_pjsip: Implement additional SIP RFCs for Google Voice trunk compatability"
[asterisk/asterisk.git] / formats / format_g719.c
index 3b2195a..673ec07 100644 (file)
@@ -26,7 +26,7 @@
 /*** MODULEINFO
        <support_level>core</support_level>
  ***/
+
 #include "asterisk.h"
 
 #include "asterisk/mod_format.h"
 
 static struct ast_frame *g719read(struct ast_filestream *s, int *whennext)
 {
-       int res;
-       /* Send a frame from the file to the appropriate channel */
+       size_t res;
 
+       /* Send a frame from the file to the appropriate channel */
        AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
-               if (feof(s->f)) {
-                       if (res) {
-                               ast_debug(3, "Incomplete frame data at end of %s file "
-                                                 "(expected %d bytes, read %d)\n",
-                                                 ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res);
-                       }
-               } else {
-                       ast_log(LOG_ERROR, "Error while reading %s file: %s\n",
-                                       ast_format_get_name(s->fr.subclass.format), strerror(errno));
+               if (res) {
+                       ast_log(LOG_WARNING, "Short read of %s data (expected %d bytes, read %zu): %s\n",
+                                       ast_format_get_name(s->fr.subclass.format), s->fr.datalen, res,
+                                       strerror(errno));
                }
                return NULL;
        }
@@ -161,4 +156,3 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ITU G.719",
        .unload = unload_module,
        .load_pri = AST_MODPRI_APP_DEPEND
 );
-