Modified ifNext to only take the ZString parameter and let C++ do the conversions.
This commit is contained in:
parent
d0239074a4
commit
3eb1f5954a
8
File.cpp
8
File.cpp
@ -9,15 +9,11 @@
|
||||
|
||||
namespace coreutils {
|
||||
|
||||
// File::File(std::string fileName, int mode, int authority) {
|
||||
// open(fileName, mode, authority);
|
||||
// }
|
||||
|
||||
File::File(coreutils::ZString fileName, int mode, int authority) {
|
||||
open(fileName.str(), mode, authority);
|
||||
open(fileName, mode, authority);
|
||||
}
|
||||
|
||||
void File::open(std::string fileName, int mode, int authority) {
|
||||
void File::open(coreutils::ZString fileName, int mode, int authority) {
|
||||
|
||||
this->fileName = fileName;
|
||||
|
||||
|
5
File.h
5
File.h
@ -16,7 +16,6 @@ namespace coreutils {
|
||||
class File {
|
||||
|
||||
public:
|
||||
// File(std::string fileName, int mode, int authority);
|
||||
File(ZString fileName, int mode = O_RDONLY, int authority = 0664);
|
||||
~File();
|
||||
void setBufferSize(size_t size);
|
||||
@ -30,10 +29,10 @@ namespace coreutils {
|
||||
size_t size;
|
||||
bool eof();
|
||||
|
||||
std::string fileName;
|
||||
coreutils::ZString fileName;
|
||||
|
||||
private:
|
||||
void open(std::string fileName, int mode, int authority);
|
||||
void open(coreutils::ZString fileName, int mode, int authority);
|
||||
int fd;
|
||||
coreutils::ZString zstring;
|
||||
bool mEof = false;
|
||||
|
18
ZString.cpp
18
ZString.cpp
@ -377,16 +377,16 @@ namespace coreutils {
|
||||
return string == std::string(data, length);
|
||||
}
|
||||
|
||||
bool ZString::ifNext(const char *value) {
|
||||
if (((data + length) - cursor) < strlen(value))
|
||||
return false;
|
||||
bool test = (strncmp(cursor, value, strlen(value)) == 0);
|
||||
if (test)
|
||||
cursor += strlen(value);
|
||||
return test;
|
||||
}
|
||||
// bool ZString::ifNext(const char *value) {
|
||||
// if (((data + length) - cursor) < strlen(value)/)
|
||||
// return false;
|
||||
// bool test = (strncmp(cursor, value, strlen(value)) == 0);
|
||||
// if (test)
|
||||
// cursor += strlen(value);
|
||||
// return test;
|
||||
// }
|
||||
|
||||
bool ZString::ifNext(ZString &value) {
|
||||
bool ZString::ifNext(ZString value) {
|
||||
if (((data + length) - cursor) < value.getLength())
|
||||
return false;
|
||||
bool test = (strncmp(cursor, value.getCursor(), value.getLength()) == 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user