MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / comment

Method comment

src/value.cpp:364–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364std::string CommentValue::comment(const char* encoding) const {
365 std::string c;
366 if (value_.length() < 8) {
367 return c;
368 }
369 c = value_.substr(8);
370 if (charsetId() == unicode) {
371 const char* from = !encoding || *encoding == '\0' ? detectCharset(c) : encoding;
372 if (!convertStringCharset(c, from, "UTF-8"))
373 throw Error(ErrorCode::kerInvalidIconvEncoding, from, "UTF-8");
374 }
375
376 // # 1266 Remove trailing nulls
377 if (charsetId() == undefined || charsetId() == ascii) {
378 auto n = c.find('\0');
379 if (n != std::string::npos)
380 c.resize(n);
381 }
382 return c;
383}
384
385CommentValue::CharsetId CommentValue::charsetId() const {
386 CharsetId charsetId = undefined;

Callers 9

mainFunction · 0.45
encode0x0805Method · 0.45
parseChunkContentMethod · 0.45
cnvExifCommentMethod · 0.45
readMetadataMethod · 0.45
printCommentMethod · 0.45
eraseCommentMethod · 0.45
runMethod · 0.45
metacopyFunction · 0.45

Calls 3

convertStringCharsetFunction · 0.85
ErrorFunction · 0.85
resizeMethod · 0.80

Tested by

no test coverage detected