kctextdb.h   kctextdb.h 
skipping to change at line 1079 skipping to change at line 1079
} }
const char* rp = stack; const char* rp = stack;
const char* pv = rp; const char* pv = rp;
const char* ep = rp + rsiz; const char* ep = rp + rsiz;
while (rp < ep) { while (rp < ep) {
if (*rp == '\n') { if (*rp == '\n') {
line.append(pv, rp - pv); line.append(pv, rp - pv);
char kbuf[NUMBUFSIZ]; char kbuf[NUMBUFSIZ];
size_t ksiz = std::sprintf(kbuf, "%020lld", (long long)(off + pv - stack)); size_t ksiz = std::sprintf(kbuf, "%020lld", (long long)(off + pv - stack));
size_t vsiz; size_t vsiz;
const char* vbuf = visitor->visit_full(kbuf, ksiz, line.dat const char* vbuf = visitor->visit_full(kbuf, ksiz, line.dat
a(), line.size(), &vsiz); a(), line.size(),
&vsiz);
if (vbuf != Visitor::NOP && vbuf != Visitor::REMOVE) { if (vbuf != Visitor::NOP && vbuf != Visitor::REMOVE) {
char tstack[IOBUFSIZ]; char tstack[IOBUFSIZ];
size_t trsiz = vsiz + 1; size_t trsiz = vsiz + 1;
char* trbuf = trsiz > sizeof(tstack) ? new char[trsiz] : tstack; char* trbuf = trsiz > sizeof(tstack) ? new char[trsiz] : tstack;
std::memcpy(trbuf, vbuf, vsiz); std::memcpy(trbuf, vbuf, vsiz);
trbuf[vsiz] = '\n'; trbuf[vsiz] = '\n';
if (!file->append(trbuf, trsiz)) { if (!file->append(trbuf, trsiz)) {
db->set_error(_KCCODELINE_, Error::SYSTEM, file->error( )); db->set_error(_KCCODELINE_, Error::SYSTEM, file->error( ));
if (trbuf != stack) delete[] trbuf; if (trbuf != stack) delete[] trbuf;
return; return;
 End of changes. 1 change blocks. 
2 lines changed or deleted 3 lines changed or added


 kcutil.h   kcutil.h 
skipping to change at line 338 skipping to change at line 338
* Split a string with delimiters. * Split a string with delimiters.
* @param str the string. * @param str the string.
* @param delims the delimiters. * @param delims the delimiters.
* @param elems a vector object into which the result elements are pushed. * @param elems a vector object into which the result elements are pushed.
* @return the number of result elements. * @return the number of result elements.
*/ */
size_t strsplit(const std::string& str, const std::string& delims, size_t strsplit(const std::string& str, const std::string& delims,
std::vector<std::string>* elems); std::vector<std::string>* elems);
/** /**
* Convert a UTF-8 string into a UCS-4 vector.
* @param src the source object.
* @param dest the destination object.
*/
void strutftoucs(const std::string& src, std::vector<uint32_t>* dest);
/**
* Convert a UCS-4 vector into a UTF-8 string.
* @param src the source object.
* @param dest the destination object.
*/
void strucstoutf(const std::vector<uint32_t>& src, std::string* dest);
/**
* Serialize a string vector object into a string object. * Serialize a string vector object into a string object.
* @param src the source object. * @param src the source object.
* @param dest the destination object. * @param dest the destination object.
*/ */
void strvecdump(const std::vector<std::string>& src, std::string* dest); void strvecdump(const std::vector<std::string>& src, std::string* dest);
/** /**
* Deserialize a string object into a string vector object. * Deserialize a string object into a string vector object.
* @param src the destination object. * @param src the source object.
* @param dest the source object. * @param dest the destination object.
*/ */
void strvecload(const std::string& src, std::vector<std::string>* dest); void strvecload(const std::string& src, std::vector<std::string>* dest);
/** /**
* Serialize a string vector object into a string object. * Serialize a string vector object into a string object.
* @param src the source object. * @param src the source object.
* @param dest the destination object. * @param dest the destination object.
*/ */
void strmapdump(const std::map<std::string, std::string>& src, std::string* dest); void strmapdump(const std::map<std::string, std::string>& src, std::string* dest);
/** /**
* Deserialize a string object into a string map object. * Deserialize a string object into a string map object.
* @param src the destination object. * @param src the source object.
* @param dest the source object. * @param dest the destination object.
*/ */
void strmapload(const std::string& src, std::map<std::string, std::string>* dest); void strmapload(const std::string& src, std::map<std::string, std::string>* dest);
/** /**
* Encode a serial object by hexadecimal encoding. * Encode a serial object by hexadecimal encoding.
* @param buf the pointer to the region. * @param buf the pointer to the region.
* @param size the size of the region. * @param size the size of the region.
* @return the result string. * @return the result string.
* @note Because the region of the return value is allocated with the the n ew[] operator, it * @note Because the region of the return value is allocated with the the n ew[] operator, it
* should be released with the delete[] operator when it is no longer in us e. * should be released with the delete[] operator when it is no longer in us e.
skipping to change at line 1427 skipping to change at line 1441
break; break;
} }
++it; ++it;
} }
std::string col(pv, it); std::string col(pv, it);
elems->push_back(col); elems->push_back(col);
return elems->size(); return elems->size();
} }
/** /**
* Convert a UTF-8 string into a UCS-4 vector.
*/
inline void strutftoucs(const std::string& src, std::vector<uint32_t>* dest
) {
_assert_(dest);
const unsigned char* rp = (unsigned char*)src.c_str();
while (*rp != '\0') {
uint32_t c = *(unsigned char*)rp;
if (c < 0x80) {
dest->push_back(c);
} else if (c < 0xe0) {
if (rp[1] >= 0x80) {
dest->push_back(((rp[0] & 0x1f) << 6) | (rp[1] & 0x3f));
rp++;
}
} else if (c < 0xf0) {
if (rp[1] >= 0x80 && rp[2] >= 0x80) {
dest->push_back(((rp[0] & 0x0f) << 12) | ((rp[1] & 0x3f) << 6) | (r
p[2] & 0x3f));
rp += 2;
}
} else if (c < 0xf8) {
if (rp[1] >= 0x80 && rp[2] >= 0x80 && rp[3] >= 0x80) {
dest->push_back(((rp[0] & 0x07) << 18) | ((rp[1] & 0x3f) << 12) |
((rp[2] & 0x3f) << 6) | (rp[3] & 0x3f));
rp += 3;
}
} else if (c < 0xfc) {
if (rp[1] >= 0x80 && rp[2] >= 0x80 && rp[3] >= 0x80 && rp[4] >= 0x80)
{
dest->push_back(((rp[0] & 0x03) << 24) | ((rp[1] & 0x3f) << 18) |
((rp[2] & 0x3f) << 12) | ((rp[3] & 0x3f) << 6) | (r
p[4] & 0x3f));
rp += 4;
}
} else if (c < 0xfe) {
if (rp[1] >= 0x80 && rp[2] >= 0x80 && rp[3] >= 0x80 && rp[4] >= 0x80
&& rp[4] >= 0x80) {
dest->push_back(((rp[0] & 0x01) << 30) | ((rp[1] & 0x3f) << 24) |
((rp[2] & 0x3f) << 18) | ((rp[3] & 0x3f) << 12) |
((rp[4] & 0x3f) << 6) | (rp[5] & 0x3f));
rp += 5;
}
}
rp++;
}
}
/**
* Convert a UCS-4 array into a UTF-8 string.
*/
inline void strucstoutf(const std::vector<uint32_t>& src, std::string* dest
) {
_assert_(dest);
std::vector<uint32_t>::const_iterator it = src.begin();
std::vector<uint32_t>::const_iterator itend = src.end();
while (it != itend) {
uint32_t c = *it;
if (c < 0x80) {
dest->append(1, c);
} else if (c < 0x800) {
dest->append(1, 0xc0 | (c >> 6));
dest->append(1, 0x80 | (c & 0x3f));
} else if (c < 0x10000) {
dest->append(1, 0xe0 | (c >> 12));
dest->append(1, 0x80 | ((c & 0xfff) >> 6));
dest->append(1, 0x80 | (c & 0x3f));
} else if (c < 0x200000) {
dest->append(1, 0xf0 | (c >> 18));
dest->append(1, 0x80 | ((c & 0x3ffff) >> 12));
dest->append(1, 0x80 | ((c & 0xfff) >> 6));
dest->append(1, 0x80 | (c & 0x3f));
} else if (c < 0x4000000) {
dest->append(1, 0xf8 | (c >> 24));
dest->append(1, 0x80 | ((c & 0xffffff) >> 18));
dest->append(1, 0x80 | ((c & 0x3ffff) >> 12));
dest->append(1, 0x80 | ((c & 0xfff) >> 6));
dest->append(1, 0x80 | (c & 0x3f));
} else if (c < 0x80000000) {
dest->append(1, 0xfc | (c >> 30));
dest->append(1, 0x80 | ((c & 0x3fffffff) >> 24));
dest->append(1, 0x80 | ((c & 0xffffff) >> 18));
dest->append(1, 0x80 | ((c & 0x3ffff) >> 12));
dest->append(1, 0x80 | ((c & 0xfff) >> 6));
dest->append(1, 0x80 | (c & 0x3f));
}
++it;
}
}
/**
* Serialize a string vector object into a string object. * Serialize a string vector object into a string object.
*/ */
inline void strvecdump(const std::vector<std::string>& src, std::string* de st) { inline void strvecdump(const std::vector<std::string>& src, std::string* de st) {
_assert_(dest); _assert_(dest);
std::vector<std::string>::const_iterator it = src.begin(); std::vector<std::string>::const_iterator it = src.begin();
std::vector<std::string>::const_iterator itend = src.end(); std::vector<std::string>::const_iterator itend = src.end();
size_t dsiz = 1; size_t dsiz = 1;
while (it != itend) { while (it != itend) {
dsiz += 2 + it->size(); dsiz += 2 + it->size();
++it; ++it;
 End of changes. 4 change blocks. 
4 lines changed or deleted 109 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/