[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / filesystem / IFile.cpp
blobeddffeaf0009c0fd47d2e92c1de262eb7b47aa6b
1 /*
2 * Copyright (c) 2002 Frodo
3 * Portions Copyright (c) by the authors of ffmpeg and xvid
4 * Copyright (C) 2002-2018 Team Kodi
5 * This file is part of Kodi - https://kodi.tv
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 * See LICENSES/README.md for more information.
9 */
11 #include "IFile.h"
13 #include "URL.h"
15 #include <cstring>
16 #include <errno.h>
18 using namespace XFILE;
20 //////////////////////////////////////////////////////////////////////
21 // Construction/Destruction
22 //////////////////////////////////////////////////////////////////////
24 IFile::IFile() = default;
26 IFile::~IFile() = default;
28 int IFile::Stat(struct __stat64* buffer)
30 if (buffer)
31 *buffer = {};
33 errno = ENOENT;
34 return -1;
36 bool IFile::ReadString(char *szLine, int iLineLength)
38 if(Seek(0, SEEK_CUR) < 0) return false;
40 int64_t iFilePos = GetPosition();
41 int iBytesRead = Read( (unsigned char*)szLine, iLineLength - 1);
42 if (iBytesRead <= 0)
43 return false;
45 szLine[iBytesRead] = 0;
47 for (int i = 0; i < iBytesRead; i++)
49 if ('\n' == szLine[i])
51 if ('\r' == szLine[i + 1])
53 szLine[i + 1] = 0;
54 Seek(iFilePos + i + 2, SEEK_SET);
56 else
58 // end of line
59 szLine[i + 1] = 0;
60 Seek(iFilePos + i + 1, SEEK_SET);
62 break;
64 else if ('\r' == szLine[i])
66 if ('\n' == szLine[i + 1])
68 szLine[i + 1] = 0;
69 Seek(iFilePos + i + 2, SEEK_SET);
71 else
73 // end of line
74 szLine[i + 1] = 0;
75 Seek(iFilePos + i + 1, SEEK_SET);
77 break;
80 return true;
83 CRedirectException::CRedirectException() :
84 m_pNewFileImp(NULL), m_pNewUrl(NULL)
88 CRedirectException::CRedirectException(IFile *pNewFileImp, CURL *pNewUrl) :
89 m_pNewFileImp(pNewFileImp), m_pNewUrl(pNewUrl)