File isql-fix-output-if-charset-is-different-from-locale.patch of Package firebird

From: mkubecek <mkubecek@de594faa-8d1b-4a0c-9a6a-a7de5f8bf859>
Date: Tue, 29 May 2012 20:14:54 +0000
Subject: isql: fix output if charset is different from locale

git-svn-id: https://firebird.svn.sourceforge.net/svnroot/firebird/firebird/trunk@54565 de594faa-8d1b-4a0c-9a6a-a7de5f8bf859
---
 src/isql/isql.epp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/isql/isql.epp b/src/isql/isql.epp
index 31c6d6b..93828ca 100644
--- a/src/isql/isql.epp
+++ b/src/isql/isql.epp
@@ -306,7 +306,18 @@ namespace IcuUtil
 			if (len > width)
 				len = width;
 
-			sprintf(buffer, (right ? "%*.*s" : "%-*.*s"), width, len, str);
+			if (right) {
+				memcpy(buffer + width - len, str, len);
+				if (width > len)
+					memset(buffer, ' ', width - len);
+			}
+			else
+			{
+				memcpy(buffer, str, len);
+				if (width > len)
+					memset(buffer + len, ' ', width - len);
+			}
+			buffer[width] = '\0';
 			return;
 		}
 
-- 
1.8.4.5

openSUSE Build Service is sponsored by