From 9649845b63c4c658cd2637d95546d7051b8ed713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 26 Oct 2016 03:25:57 +0200 Subject: some changes before upload --- debian/patches/0135-replace_gets.patch | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'debian/patches') diff --git a/debian/patches/0135-replace_gets.patch b/debian/patches/0135-replace_gets.patch index 36b990d..26b21ec 100644 --- a/debian/patches/0135-replace_gets.patch +++ b/debian/patches/0135-replace_gets.patch @@ -1,13 +1,13 @@ -Description: Replace gets with readline +Description: Replace deprecated gets() with std::cin.getline() Author: Jörg Frings-Fürst Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=841626 Last-Update: 2016-10-22 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: trunk/bin/dbfutil1.cpp +Index: xbase64-3.1.2/bin/dbfutil1.cpp =================================================================== ---- trunk.orig/bin/dbfutil1.cpp -+++ trunk/bin/dbfutil1.cpp +--- xbase64-3.1.2.orig/bin/dbfutil1.cpp ++++ xbase64-3.1.2/bin/dbfutil1.cpp @@ -38,6 +38,7 @@ */ @@ -16,14 +16,12 @@ Index: trunk/bin/dbfutil1.cpp // next lines are helpful for debugging purposes /* -@@ -153,11 +154,18 @@ void MyClass::FilterMenu() +@@ -153,11 +154,16 @@ void MyClass::FilterMenu() /************************************************************************/ void MyClass::SetFilter() { - char Expression[512]; - memset( Expression, 0x00, 512 ); -+ /* replace getc with getline */ -+ + constexpr int SIZE = 512; + + char Expression[SIZE]; @@ -31,20 +29,18 @@ Index: trunk/bin/dbfutil1.cpp while( !strlen( Expression )){ std::cout << "Enter filter expression (like AMOUNT<5)" << std::endl; - gets( Expression ); -+/* gets( Expression );*/ ++ + std::cin.getline(Expression, SIZE-1); + Expression[SIZE-1] = '\0'; + std::cin.ignore(std::numeric_limits::max(), '\n'); } if( xbf ) delete xbf; -@@ -235,19 +243,27 @@ void MyClass::LastFilterRec() +@@ -235,19 +241,24 @@ void MyClass::LastFilterRec() #ifdef XB_EXPRESSIONS void MyClass::ProcessExpression() { - char exprsn[256]; -+ /* replace getc with getline */ -+ + constexpr int SIZE = 256; + + char exprsn[SIZE]; @@ -61,7 +57,6 @@ Index: trunk/bin/dbfutil1.cpp std::cout << ">"; - gets( exprsn ); -+/* gets( exprsn ); */ + + std::cin.getline(exprsn, SIZE-1); + exprsn[SIZE-1] = '\0'; -- cgit v1.2.3