git-svn-id: svn://db.shs.com.ru/pip@207 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-07-24 19:25:07 +00:00
parent 0b8b417c6d
commit 314c4a1a9b
5 changed files with 48 additions and 12 deletions

View File

@@ -40,12 +40,12 @@
#endif
#define S_IFHDN 0x40
#if defined(QNX) || defined(ANDROID)
# define _fopen_call_ fopen
# define _fseek_call_ fseek
# define _ftell_call_ ftell
# define _stat_struct_ struct stat
# define _stat_call_ stat
# define _stat_link_ lstat
# define _fopen_call_ fopen
# define _fseek_call_ fseek
# define _ftell_call_ ftell
# define _stat_struct_ struct stat
# define _stat_call_ stat
# define _stat_link_ lstat
#else
# if defined(MAC_OS)
# define _fopen_call_ fopen
@@ -56,9 +56,9 @@
# define _fseek_call_ fseeko64
# define _ftell_call_ ftello64
# endif
# define _stat_struct_ struct stat64
# define _stat_call_ stat64
# define _stat_link_ lstat64
# define _stat_struct_ struct stat64
# define _stat_call_ stat64
# define _stat_link_ lstat64
#endif
@@ -182,8 +182,8 @@ bool PIFile::closeDevice() {
PIString PIFile::readLine() {
PIString str;
if (!opened_) return str;
int cc, cp = 0;
while (!isEnd() && cp < 4095) {
int cc;
while (!isEnd()) {
cc = fgetc(fd);
if (char(cc) == '\n' || cc == EOF) break;
str.push_back(char(cc));
@@ -395,6 +395,22 @@ void PIFile::remove() {
const char * PIFile::defaultCharset() {
return PIInit::instance()->file_charset;
}
void PIFile::setDefaultCharset(const char * c) {
if (PIInit::instance()->file_charset) delete PIInit::instance()->file_charset;
PIInit::instance()->file_charset = 0;
if (!c) return;
PIInit::instance()->file_charset = new char[1024];
memset(PIInit::instance()->file_charset, 0, 1024);
strcpy(PIInit::instance()->file_charset, c);
piCout << PIInit::instance()->file_charset;
}
PIFile::FileInfo PIFile::fileInfo(const PIString & path) {
FileInfo ret;