]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
check for say errors in say_money functions
authorMichael Jerris <mike@jerris.com>
Wed, 7 May 2014 17:18:16 +0000 (13:18 -0400)
committerMichael Jerris <mike@jerris.com>
Wed, 7 May 2014 17:18:21 +0000 (13:18 -0400)
src/mod/say/mod_say_fr/mod_say_fr.c
src/mod/say/mod_say_hu/mod_say_hu.c
src/mod/say/mod_say_it/mod_say_it.c
src/mod/say/mod_say_nl/mod_say_nl.c
src/mod/say/mod_say_th/mod_say_th.c

index 07a6595d48563e88a621e28c5191c35dcbe0b96a..e795f674c9fabf7721910812c8aa3b57c9946dbc 100644 (file)
@@ -401,6 +401,7 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
        char sbuf[16] = "";                     /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
        char *dollars = NULL;
        char *cents = NULL;
+       switch_status_t status;
 
        if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -428,7 +429,9 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
        }
 
        /* Say dollar amount */
-       fr_say_general_count(session, dollars, say_args, args);
+       if (( status = fr_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS) {
+               return status;
+       }
        if (atoi(dollars) == 1) {
                say_file("currency/dollar.wav");
        } else {
@@ -440,7 +443,9 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay,
 
        /* Say cents */
        if (cents) {
-               fr_say_general_count(session, cents, say_args, args);
+               if (( status = fr_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS) {
+                       return status;
+               }
                if (atoi(cents) == 1) {
                        say_file("currency/cent.wav");
                } else {
index fa2912306bb8ef7e7bf750401285864cde762833..6a830c6a98ae5f4f52618f6a3b0e59517844aa5a 100644 (file)
@@ -357,6 +357,7 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay,
 {
        char sbuf[16] = "";
        char *forint;
+       switch_status_t status;
 
        if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -374,7 +375,9 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay,
                forint++;
        }
 
-       hu_say_general_count(session, forint, say_args, args);
+       if (( status = hu_say_general_count(session, forint, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
+               return status;
+       }
        say_file("currency/forint.wav");
 
        return SWITCH_STATUS_SUCCESS;
index 4b723545c45998caf04849e6f0aa37d6e7dc3fb2..11d2b4f0db7c066dd1717543bf2b4c8543902825 100644 (file)
@@ -440,6 +440,7 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
        char sbuf[16] = "";                     /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
        char *dollars = NULL;
        char *cents = NULL;
+       switch_status_t status;
 
        if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -467,7 +468,10 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
        }
 
        /* Say dollar amount */
-       it_say_general_count(session, dollars, say_args, args);
+       if (( status = it_say_general_count(session, dollars, say_args, args) ) != SWITCH_STATUS_SUCCESS ) {
+               return status;
+       }
+
        if (atoi(dollars) == 1) {
                say_file("currency/dollar.wav");
        } else {
@@ -479,7 +483,9 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay,
 
        /* Say cents */
        if (cents) {
-               it_say_general_count(session, cents, say_args, args);
+               if (( status = it_say_general_count(session, cents, say_args, args) ) != SWITCH_STATUS_SUCCESS ) {
+                       return status;
+               }
                if (atoi(cents) == 1) {
                        say_file("currency/cent.wav");
                } else {
index a53390e4c5786fb795217a895146a2bd6e429632..f6dec530d173b12907330b24b8828001736a4c33 100644 (file)
@@ -321,6 +321,7 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
        char sbuf[16] = "";                     /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
        char *dollars = NULL;
        char *cents = NULL;
+       switch_status_t status;
 
        if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -348,7 +349,10 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
        }
 
        /* Say dollar amount */
-       nl_say_general_count(session, dollars, say_args, args);
+       if (( status = nl_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
+               return status;
+       }
+
        if (atoi(dollars) == 1) {
                say_file("currency/dollar.wav");
        } else {
@@ -360,7 +364,9 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay,
 
        /* Say cents */
        if (cents) {
-               nl_say_general_count(session, cents, say_args, args);
+               if (( status = nl_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS) {
+                       return status;
+               }
                if (atoi(cents) == 1) {
                        say_file("currency/cent.wav");
                } else {
index e1526a47ad6e9b1a1b2981717af5078c76ca8091..ac60b01d9adccf87b04cd41c266bd923c6e9ae96 100644 (file)
@@ -423,6 +423,7 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay,
        char sbuf[16] = "";                     /* enough for 999,999,999,999.99 (w/o the commas or leading $) */
        char *dollars = NULL;
        char *cents = NULL;
+       switch_status_t status;
 
        if (strlen(tosay) > 15 || !switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -450,12 +451,17 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay,
        }
 
        /* Say dollar amount */
-       th_say_general_count(session, dollars, say_args, args);
+       if (( status = th_say_general_count(session, dollars, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
+               return status;
+       }
+
        say_file("currency/dollar.wav");
 
        /* Say cents */
        if (cents) {
-               th_say_general_count(session, cents, say_args, args);
+               if (( status = th_say_general_count(session, cents, say_args, args)) != SWITCH_STATUS_SUCCESS ) {
+                       return status;
+               }
        } else {
                say_file("digits/0.wav");
        }