summaryrefslogtreecommitdiff
path: root/tools/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/file.c')
-rw-r--r--tools/file.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/file.c b/tools/file.c
index 2283500..6ca3ac3 100644
--- a/tools/file.c
+++ b/tools/file.c
@@ -1,5 +1,6 @@
#include "tools/file.h"
+#include <vdr/tools.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
@@ -13,12 +14,12 @@ cTBFile::~cTBFile() {
Close();
}
-bool cTBFile::Open(const cTBString &Filename, int Mode, mode_t Attribs) {
+bool cTBFile::Open(const std::string &Filename, int Mode, mode_t Attribs) {
int filed;
if (IsOpen()) Close();
- if ((filed = ::open(Filename, Mode, Attribs)) == -1)
+ if ((filed = ::open(Filename.c_str(), Mode, Attribs)) == -1)
return false;
if (!cTBSource::Open(filed))
@@ -35,7 +36,7 @@ bool cTBFile::Open(uint Fileno) {
if (!cTBSource::Open(Fileno))
return false;
- m_Filename.Format("<&%d>", Fileno);
+ m_Filename = (std::string)"<&" + (const char*)itoa(Fileno) + ">";
m_Anonymous = true;
return true;
}
@@ -52,12 +53,12 @@ bool cTBFile::Close(void) {
if (!cTBSource::Close())
ret = false;
- m_Filename.Clear();
+ m_Filename = "";
return ret;
}
bool cTBFile::Unlink(void) const {
- if (m_Filename.IsNull())
+ if (m_Filename == "")
ERRNUL(ENOENT);
if (!IsOpen())
@@ -69,8 +70,8 @@ bool cTBFile::Unlink(void) const {
return cTBFile::Unlink(m_Filename);
}
-bool cTBFile::Unlink(const cTBString &Filename) {
- return (::unlink(Filename) != -1);
+bool cTBFile::Unlink(const std::string &Filename) {
+ return (::unlink(Filename.c_str()) != -1);
}
ssize_t cTBFile::Size(void) const {
@@ -85,10 +86,10 @@ ssize_t cTBFile::Size(void) const {
return buf.st_size;
}
-ssize_t cTBFile::Size(const cTBString &Filename) {
+ssize_t cTBFile::Size(const std::string &Filename) {
struct stat buf;
- if (stat(Filename, &buf) == -1)
+ if (stat(Filename.c_str(), &buf) == -1)
return -1;
return buf.st_size;