LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File firebird-2.5.2-isqllocale.patch of Package firebird (Project openSUSE:Factory)

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 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/isql/isql.epp b/src/isql/isql.epp
index dc0936d..4930ccf 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.7.7