Lines Matching refs:linestr
129 const std::string &linestr, in appendUtf8() argument
134 tmp[i] = linestr[++pos]; in appendUtf8()
164 bool fixu8(std::string &linestr, size_t origpos, size_t &endpos) { in fixu8() argument
169 char c = linestr[pos]; in fixu8()
171 char c2 = linestr[++pos]; in fixu8()
181 appendUtf8(outstr, linestr, pos, 4); in fixu8()
184 appendUtf8(outstr, linestr, pos, 8); in fixu8()
196 linestr.replace(origpos, (endpos-origpos+1), outstr); in fixu8()
208 bool fixAt(std::string &linestr, size_t pos) { in fixAt() argument
211 if(linestr[pos] != 'u') { in fixAt()
220 if(linestr[pos] == '8') { // u8" in fixAt()
225 char quote = linestr[pos]; in fixAt()
241 for(; pos < linestr.size(); pos++) { in fixAt()
242 if(linestr[pos] == quote) { in fixAt()
244 return fixu8(linestr, origpos, pos); // fix u8"..." in fixAt()
249 if(linestr[pos] == '\\') { in fixAt()
251 if(linestr[pos] == quote) continue; // quoted quote in fixAt()
252 if(linestr[pos] == 'u') continue; // for now ... unicode escape in fixAt()
253 if(linestr[pos] == '\\') continue; in fixAt()
260 char old_byte = linestr[pos]; in fixAt()
261 linestr[pos] = cp1047_to_8859(linestr[pos]); in fixAt()
263 int32_t trail = U8_COUNT_TRAIL_BYTES(linestr[pos]); in fixAt()
265 linestr[pos2] = cp1047_to_8859(linestr[pos2]); in fixAt()
266 if(linestr[pos2] == 0x0A) { in fixAt()
267 linestr[pos2] = 0x85; // NL is ambiguous here in fixAt()
273 const uint8_t *s = (const uint8_t*) (linestr.c_str()); in fixAt()
274 int32_t length = linestr.size(); in fixAt()
278 linestr[pos] = old_byte; // put it back in fixAt()
289 fprintf(stderr, "Line: >>%s<<\n", linestr.c_str()); in fixAt()
303 linestr.replace(pos, seqLen, newSeq); in fixAt()
319 bool fixLine(int /*no*/, std::string &linestr) { in fixLine() argument
320 const char *line = linestr.c_str(); in fixLine()
321 size_t len = linestr.size(); in fixLine()
329 size_t pos = len = linestr.size(); in fixLine()
330 while((pos>0) && (pos = linestr.rfind("u\"", pos)) != std::string::npos) { in fixLine()
332 if(fixAt(linestr, pos)) return true; in fixLine()
338 pos = len = linestr.size(); in fixLine()
339 while((pos>0) && (pos = linestr.rfind("u'", pos)) != std::string::npos) { in fixLine()
341 if(fixAt(linestr, pos)) return true; in fixLine()
347 pos = len = linestr.size(); in fixLine()
348 while((pos>0) && (pos = linestr.rfind("u8\"", pos)) != std::string::npos) { in fixLine()
349 if(fixAt(linestr, pos)) return true; in fixLine()
390 std::string linestr; in convert() local
391 while( getline( inf, linestr)) { in convert()
393 if(fixLine(no, linestr)) { in convert()
399 outf << linestr << '\n'; in convert()