|
a/src/utils/readfile.cpp |
|
b/src/utils/readfile.cpp |
|
... |
|
... |
76 |
|
76 |
|
77 |
class FileToString : public FileScanDo {
|
77 |
class FileToString : public FileScanDo {
|
78 |
public:
|
78 |
public:
|
79 |
FileToString(string& data) : m_data(data) {}
|
79 |
FileToString(string& data) : m_data(data) {}
|
80 |
string& m_data;
|
80 |
string& m_data;
|
81 |
bool init(unsigned int size, string *reason) {
|
81 |
bool init(size_t size, string *reason) {
|
82 |
if (size > 0)
|
82 |
if (size > 0)
|
83 |
m_data.reserve(size);
|
83 |
m_data.reserve(size);
|
84 |
return true;
|
84 |
return true;
|
85 |
}
|
85 |
}
|
86 |
bool data(const char *buf, int cnt, string *reason) {
|
86 |
bool data(const char *buf, int cnt, string *reason) {
|
|
... |
|
... |
133 |
return false;
|
133 |
return false;
|
134 |
}
|
134 |
}
|
135 |
noclosing = false;
|
135 |
noclosing = false;
|
136 |
}
|
136 |
}
|
137 |
|
137 |
|
|
|
138 |
if (cnttoread != (size_t)-1 && cnttoread) {
|
|
|
139 |
doer->init(cnttoread+1, reason);
|
138 |
if (st.st_size > 0) {
|
140 |
} else if (st.st_size > 0) {
|
139 |
doer->init(st.st_size+1, reason);
|
141 |
doer->init(st.st_size+1, reason);
|
140 |
} else if (cnttoread) {
|
|
|
141 |
doer->init(cnttoread+1, reason);
|
|
|
142 |
} else {
|
142 |
} else {
|
143 |
doer->init(0, reason);
|
143 |
doer->init(0, reason);
|
144 |
}
|
144 |
}
|
145 |
|
145 |
|
146 |
off_t curoffs = 0;
|
146 |
off_t curoffs = 0;
|