[asterisk-commits] file: branch 1.4 r47398 - /branches/1.4/apps/app_voicemail.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 9 15:32:31 MST 2006


Author: file
Date: Thu Nov  9 16:32:30 2006
New Revision: 47398

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47398
Log:
Do conversion in a more easier to read and working way for \r, \n, and \t. (issue #8324 reported by johnlange)

Modified:
    branches/1.4/apps/app_voicemail.c

Modified: branches/1.4/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_voicemail.c?view=diff&rev=47398&r1=47397&r2=47398
==============================================================================
--- branches/1.4/apps/app_voicemail.c (original)
+++ branches/1.4/apps/app_voicemail.c Thu Nov  9 16:32:30 2006
@@ -7398,13 +7398,17 @@
 			tmpread = tmpwrite = emailbody;
 			while ((tmpwrite = strchr(tmpread,'\\'))) {
 				switch (tmpwrite[1]) {
+				case 'r':
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\r';
+					break;
 				case 'n':
-					*tmpwrite++ = '\n';
-					memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\n';
 					break;
 				case 't':
-					*tmpwrite++ = '\t';
-					memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\t';
 					break;
 				default:
 					ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);
@@ -7422,13 +7426,17 @@
 			tmpread = tmpwrite = pagerbody;
 			while ((tmpwrite = strchr(tmpread, '\\'))) {
 				switch (tmpwrite[1]) {
+				case 'r':
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\r';
+					break;
 				case 'n':
-					*tmpwrite++ = '\n';
-					memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\n';
 					break;
 				case 't':
-					*tmpwrite++ = '\t';
-					memmove(tmpwrite, tmpwrite + 1, strlen(tmpwrite + 1) + 1);
+					memmove(tmpwrite + 1, tmpwrite + 2, strlen(tmpwrite + 2) + 1);
+					*tmpwrite = '\t';
 					break;
 				default:
 					ast_log(LOG_NOTICE, "Substitution routine does not support this character: %c\n", tmpwrite[1]);



More information about the asterisk-commits mailing list