test_json: Fix test names with reserved words
[asterisk/asterisk.git] / formats / format_ilbc.c
index 6b811e6..8b41ab2 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "asterisk.h"
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/mod_format.h"
 #include "asterisk/module.h"
 #include "asterisk/endian.h"
@@ -51,8 +49,16 @@ static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)
        /* Send a frame from the file to the appropriate channel */
        AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
        if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
-               if (res)
-                       ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));
+               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));
+               }
                return NULL;
        }
        *whennext = s->fr.samples = ILBC_SAMPLES;
@@ -137,7 +143,7 @@ static int load_module(void)
 {
        ilbc_f.format = ast_format_ilbc;
        if (ast_format_def_register(&ilbc_f))
-               return AST_MODULE_LOAD_FAILURE;
+               return AST_MODULE_LOAD_DECLINE;
        return AST_MODULE_LOAD_SUCCESS;
 }