1From b81fb7942ab77b0bf6791e5fd98411dd68f133d9 Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Sun, 18 Dec 2022 15:13:00 -0800 4Subject: [PATCH] libyui-ncurses: Replace off64_t with off_t and stat64 with stat 5 6stat is same as stat64 when 64bit off_t is used. 7 8Upstream-Status: Submitted [https://github.com/libyui/libyui/pull/88] 9Signed-off-by: Khem Raj <raj.khem@gmail.com> 10--- 11 CMakeLists.txt | 2 +- 12 src/NCAskForFile.cc | 6 +++--- 13 src/NCFileSelection.cc | 24 ++++++++++++------------ 14 src/NCFileSelection.h | 6 +++--- 15 4 files changed, 19 insertions(+), 19 deletions(-) 16 17diff --git a/CMakeLists.txt b/libyui-ncurses/CMakeLists.txt 18index b10eab8e..2000bb58 100644 19--- a/CMakeLists.txt 20+++ b/CMakeLists.txt 21@@ -58,7 +58,7 @@ set( CMAKE_INSTALL_MESSAGE LAZY ) # Suppress "up-to-date" messages during "make 22 # Initialize compiler flags for all targets in all subdirectories 23 add_compile_options( "-Wall" ) 24 add_compile_options( "-Os" ) # Optimize for size (overrides CMake's -O3 in RELEASE builds) 25- 26+add_compile_options( "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ) # Enable largefile support 27 if ( WERROR ) 28 add_compile_options( "-Werror" ) 29 endif() 30diff --git a/src/NCAskForFile.cc b/libyui-ncurses/src/NCAskForFile.cc 31index aba6e0a6..44bb81bc 100644 32--- a/src/NCAskForFile.cc 33+++ b/src/NCAskForFile.cc 34@@ -73,8 +73,8 @@ std::string NCAskForFile::checkIniDir( std::string iniDir ) 35 { 36 std::string dname = ""; 37 38- struct stat64 statInfo; 39- stat64( iniDir.c_str(), &statInfo ); 40+ struct stat statInfo; 41+ stat( iniDir.c_str(), &statInfo ); 42 43 if ( S_ISDIR( statInfo.st_mode ) ) 44 { 45@@ -90,7 +90,7 @@ std::string NCAskForFile::checkIniDir( std::string iniDir ) 46 && pos != 0 ) 47 { 48 std::string dir = iniDir.substr( 0, pos ); 49- stat64( dir.c_str(), &statInfo ); 50+ stat( dir.c_str(), &statInfo ); 51 52 if ( S_ISDIR( statInfo.st_mode ) ) 53 { 54diff --git a/src/NCFileSelection.cc b/libyui-ncurses/src/NCFileSelection.cc 55index 3eb9c908..8894dc72 100644 56--- a/src/NCFileSelection.cc 57+++ b/src/NCFileSelection.cc 58@@ -46,7 +46,7 @@ using std::list; 59 60 61 NCFileInfo::NCFileInfo( string fileName, 62- struct stat64 * statInfo, 63+ struct stat * statInfo, 64 bool link ) 65 { 66 _name = fileName; 67@@ -146,7 +146,7 @@ NCFileInfo::NCFileInfo() 68 _mode = ( mode_t )0; 69 _device = ( dev_t )0; 70 _links = ( nlink_t )0; 71- _size = ( off64_t )0; 72+ _size = ( off_t )0; 73 _mtime = ( time_t )0; 74 } 75 76@@ -177,11 +177,11 @@ NCFileSelection::NCFileSelection( YWidget * parent, 77 { 78 SetSepChar( ' ' ); 79 80- struct stat64 statInfo; 81+ struct stat statInfo; 82 83 if ( !iniDir.empty() ) 84 { 85- stat64( iniDir.c_str(), &statInfo ); 86+ stat( iniDir.c_str(), &statInfo ); 87 } 88 89 if ( iniDir.empty() 90@@ -559,8 +559,8 @@ NCursesEvent NCFileTable::wHandleInput( wint_t key ) 91 bool NCFileTable::fillList() 92 { 93 94- struct stat64 statInfo; 95- struct stat64 linkInfo; 96+ struct stat statInfo; 97+ struct stat linkInfo; 98 struct dirent * entry; 99 list<string> tmpList; 100 list<string>::iterator it; 101@@ -592,7 +592,7 @@ bool NCFileTable::fillList() 102 { 103 string fullName = currentDir + "/" + ( *it ); 104 105- if ( lstat64( fullName.c_str(), &statInfo ) == 0 ) 106+ if ( lstat( fullName.c_str(), &statInfo ) == 0 ) 107 { 108 if ( S_ISREG( statInfo.st_mode ) || S_ISBLK( statInfo.st_mode ) ) 109 { 110@@ -604,7 +604,7 @@ bool NCFileTable::fillList() 111 } 112 else if ( S_ISLNK( statInfo.st_mode ) ) 113 { 114- if ( stat64( fullName.c_str(), &linkInfo ) == 0 ) 115+ if ( stat( fullName.c_str(), &linkInfo ) == 0 ) 116 { 117 if ( S_ISREG( linkInfo.st_mode ) || S_ISBLK( linkInfo.st_mode ) ) 118 { 119@@ -701,8 +701,8 @@ void NCDirectoryTable::fillHeader() 120 121 bool NCDirectoryTable::fillList() 122 { 123- struct stat64 statInfo; 124- struct stat64 linkInfo; 125+ struct stat statInfo; 126+ struct stat linkInfo; 127 struct dirent * entry; 128 list<string> tmpList; 129 list<string>::iterator it; 130@@ -734,7 +734,7 @@ bool NCDirectoryTable::fillList() 131 { 132 string fullName = currentDir + "/" + ( *it ); 133 134- if ( lstat64( fullName.c_str(), &statInfo ) == 0 ) 135+ if ( lstat( fullName.c_str(), &statInfo ) == 0 ) 136 { 137 if ( S_ISDIR( statInfo.st_mode ) ) 138 { 139@@ -746,7 +746,7 @@ bool NCDirectoryTable::fillList() 140 } 141 else if ( S_ISLNK( statInfo.st_mode ) ) 142 { 143- if ( stat64( fullName.c_str(), &linkInfo ) == 0 ) 144+ if ( stat( fullName.c_str(), &linkInfo ) == 0 ) 145 { 146 if ( S_ISDIR( linkInfo.st_mode ) ) 147 { 148diff --git a/src/NCFileSelection.h b/libyui-ncurses/src/NCFileSelection.h 149index 0569215d..5c459d62 100644 150--- a/src/NCFileSelection.h 151+++ b/src/NCFileSelection.h 152@@ -44,10 +44,10 @@ 153 struct NCFileInfo 154 { 155 /** 156- * Constructor from a stat buffer (i.e. based on an lstat64() call). 157+ * Constructor from a stat buffer (i.e. based on an lstat() call). 158 **/ 159 NCFileInfo( std::string fileName, 160- struct stat64 * statInfo, 161+ struct stat * statInfo, 162 bool link = false ); 163 164 NCFileInfo(); 165@@ -65,7 +65,7 @@ struct NCFileInfo 166 dev_t _device; // device this object resides on 167 mode_t _mode; // file permissions + object type 168 nlink_t _links; // number of links 169- off64_t _size; // size in bytes 170+ off_t _size; // size in bytes 171 time_t _mtime; // modification time 172 173 bool isDir() { return (( S_ISDIR( _mode ) ) ? true : false ); } 174-- 1752.39.0 176 177