[asterisk-commits] kmoore: branch kmoore/stasis-http_sounds r389044 - /team/kmoore/stasis-http_s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 17 22:48:46 CDT 2013


Author: kmoore
Date: Fri May 17 22:48:42 2013
New Revision: 389044

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389044
Log:
Address review feedback

Modified:
    team/kmoore/stasis-http_sounds/res/res_sounds.c

Modified: team/kmoore/stasis-http_sounds/res/res_sounds.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-http_sounds/res/res_sounds.c?view=diff&rev=389044&r1=389043&r2=389044
==============================================================================
--- team/kmoore/stasis-http_sounds/res/res_sounds.c (original)
+++ team/kmoore/stasis-http_sounds/res/res_sounds.c Fri May 17 22:48:42 2013
@@ -229,7 +229,7 @@
 static char *sounds_get_description(const char *filename, const char *lang)
 {
 	RAII_VAR(struct sound_variant *, variant, NULL, ao2_cleanup);
-	if (!filename || !lang) {
+	if (ast_strlen_zero(filename) || ast_strlen_zero(lang)) {
 		return NULL;
 	}
 
@@ -245,7 +245,7 @@
 static struct ast_format_cap *sounds_get_format_cap(const char *filename, const char *lang)
 {
 	RAII_VAR(struct sound_variant *, variant, NULL, ao2_cleanup);
-	if (!filename || !lang) {
+	if (ast_strlen_zero(filename) || ast_strlen_zero(lang)) {
 		return NULL;
 	}
 
@@ -391,6 +391,9 @@
 	while (!feof(f)) {
 		char *file_identifier, *description;
 		if (!fgets(buf, sizeof(buf), f)) {
+			if (ferror(f)) {
+				ast_log(LOG_ERROR, "Error reading from file %s\n", ast_str_buffer(description_file_path));
+			}
 			continue;
 		}
 
@@ -401,6 +404,9 @@
 				if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 1] == '\n') {
 					break;
 				}
+			}
+			if (ferror(f)) {
+				ast_log(LOG_ERROR, "Error reading from file %s\n", ast_str_buffer(description_file_path));
 			}
 			continue;
 		}




More information about the asterisk-commits mailing list