code format
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
PIIODevice wrapper around PIString
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
PIP - Platform Independent Primitives
|
||||
PIIODevice wrapper around PIString
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "piiostring.h"
|
||||
@@ -48,7 +48,7 @@ bool PIIOString::open(PIString * string, PIIODevice::DeviceMode mode) {
|
||||
|
||||
|
||||
bool PIIOString::open(const PIString & string) {
|
||||
str = const_cast<PIString*>(&string);
|
||||
str = const_cast<PIString *>(&string);
|
||||
return PIIODevice::open(PIIODevice::ReadOnly);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ PIString PIIOString::readLine() {
|
||||
if ((*str)[np] == '\n') break;
|
||||
}
|
||||
PIString ret = str->mid(pos, np - pos);
|
||||
pos = piMini(np + 1, str->size_s());
|
||||
pos = piMini(np + 1, str->size_s());
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ ssize_t PIIOString::readDevice(void * read_to, ssize_t max_size) {
|
||||
pos += max_size;
|
||||
if (pos > str->size_s()) pos = str->size_s();
|
||||
const char * cc = rs.data();
|
||||
int ret = strlen(cc);
|
||||
int ret = strlen(cc);
|
||||
memcpy(read_to, cc, ret);
|
||||
return ret;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ ssize_t PIIOString::readDevice(void * read_to, ssize_t max_size) {
|
||||
|
||||
ssize_t PIIOString::writeDevice(const void * data, ssize_t max_size) {
|
||||
if (!canWrite() || !str) return -1;
|
||||
//piCout << "write" << data;
|
||||
// piCout << "write" << data;
|
||||
if (pos > str->size_s()) pos = str->size_s();
|
||||
PIString rs = PIString::fromUTF8((const char *)data);
|
||||
if (rs.size_s() > max_size) rs.resize(max_size);
|
||||
|
||||
Reference in New Issue
Block a user