summaryrefslogtreecommitdiff
path: root/debian/patches/0135-replace_gets.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/0135-replace_gets.patch')
-rw-r--r--debian/patches/0135-replace_gets.patch19
1 files changed, 7 insertions, 12 deletions
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 <debian@jff-webhosting.net>
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<std::streamsize>::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';