std::to_string conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 3 years ago
parent 10a62b2350
commit b6c2062fae

@ -926,7 +926,7 @@ int Extract::writeIccProfile(const std::string& target) const {
} // Extract::writeIccProfile } // Extract::writeIccProfile
void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const { void Extract::writePreviewFile(const Exiv2::PreviewImage& pvImg, size_t num) const {
std::string pvFile = newFilePath(path_, "-preview") + Exiv2::toString(num); std::string pvFile = newFilePath(path_, "-preview") + std::to_string(num);
std::string pvPath = pvFile + pvImg.extension(); std::string pvPath = pvFile + pvImg.extension();
if (dontOverwrite(pvPath)) if (dontOverwrite(pvPath))
return; return;

@ -1323,14 +1323,14 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
} }
#endif #endif
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Invalid command line:") + cmdLine); std::to_string(num) + ": " + _("Invalid command line:") + cmdLine);
} }
std::string cmd(line.substr(cmdStart, cmdEnd - cmdStart)); std::string cmd(line.substr(cmdStart, cmdEnd - cmdStart));
CmdId cmdId = commandId(cmd); CmdId cmdId = commandId(cmd);
if (cmdId == CmdId::invalid) { if (cmdId == CmdId::invalid) {
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Invalid command") + " `" + cmd + "'"); std::to_string(num) + ": " + _("Invalid command") + " `" + cmd + "'");
} }
Exiv2::TypeId defaultType = Exiv2::invalidTypeId; Exiv2::TypeId defaultType = Exiv2::invalidTypeId;
@ -1361,7 +1361,7 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
} }
if (metadataId == MetadataId::invalid) { if (metadataId == MetadataId::invalid) {
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Invalid key") + " `" + key + "'"); std::to_string(num) + ": " + _("Invalid key") + " `" + key + "'");
} }
} }
std::string value; std::string value;
@ -1382,7 +1382,7 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
if (cmdId == CmdId::reg && (keyEnd == std::string::npos || valStart == std::string::npos)) { if (cmdId == CmdId::reg && (keyEnd == std::string::npos || valStart == std::string::npos)) {
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Invalid command line") + " "); std::to_string(num) + ": " + _("Invalid command line") + " ");
} }
if (cmdId != CmdId::reg && typeStart != std::string::npos && typeEnd != std::string::npos) { if (cmdId != CmdId::reg && typeStart != std::string::npos && typeEnd != std::string::npos) {
@ -1392,7 +1392,7 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
valStart = line.find_first_not_of(delim, typeEnd + 1); valStart = line.find_first_not_of(delim, typeEnd + 1);
if (valStart == std::string::npos) { if (valStart == std::string::npos) {
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Invalid command line") + " "); std::to_string(num) + ": " + _("Invalid command line") + " ");
} }
type = tmpType; type = tmpType;
explicitType = true; explicitType = true;
@ -1418,7 +1418,7 @@ bool parseLine(ModifyCmd& modifyCmd, const std::string& line, int num) {
if (cmdId == CmdId::reg) { if (cmdId == CmdId::reg) {
if (value.empty()) { if (value.empty()) {
throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage, throw Exiv2::Error(Exiv2::ErrorCode::kerErrorMessage,
Exiv2::toString(num) + ": " + _("Empty value for key") + +" `" + key + "'"); std::to_string(num) + ": " + _("Empty value for key") + +" `" + key + "'");
} }
// Registration needs to be done immediately as the new namespaces are // Registration needs to be done immediately as the new namespaces are

@ -29,7 +29,7 @@ int main(int argc, char* const argv[]) try {
<< "\n"; << "\n";
Exiv2::PreviewImage preview = loader.getPreviewImage(pos); Exiv2::PreviewImage preview = loader.getPreviewImage(pos);
auto s = preview.writeFile(filename + "_" + Exiv2::toString(pos.width_) + "x" + Exiv2::toString(pos.height_)); auto s = preview.writeFile(filename + "_" + std::to_string(pos.width_) + "x" + std::to_string(pos.height_));
if (s == 0) if (s == 0)
return EXIT_FAILURE; return EXIT_FAILURE;
} }

@ -947,7 +947,7 @@ void Converter::cnvXmpDate(const char* from, const char* to) {
} }
if (subsecTag) { if (subsecTag) {
prepareExifTarget(subsecTag, true); prepareExifTarget(subsecTag, true);
(*exifData_)[subsecTag] = toString(datetime.nanoSecond); (*exifData_)[subsecTag] = std::to_string(datetime.nanoSecond);
} }
} }
} else { // "Exif.GPSInfo.GPSTimeStamp" } else { // "Exif.GPSInfo.GPSTimeStamp"

@ -165,7 +165,7 @@ void Error::setMsg(int count) {
std::string msg{errList.at(static_cast<size_t>(code_))}; std::string msg{errList.at(static_cast<size_t>(code_))};
auto pos = msg.find("%0"); auto pos = msg.find("%0");
if (pos != std::string::npos) { if (pos != std::string::npos) {
msg.replace(pos, 2, toString(static_cast<int>(code_))); msg.replace(pos, 2, std::to_string(static_cast<int>(code_)));
} }
if (count > 0) { if (count > 0) {
pos = msg.find("%1"); pos = msg.find("%1");

@ -3328,7 +3328,7 @@ std::ostream& Nikon3MakerNote::print0x009e(std::ostream& os, const Value& value,
if (td) { if (td) {
s = std::string(exvGettext(td->label_)).append(d).append(s); s = std::string(exvGettext(td->label_)).append(d).append(s);
} else { } else {
s = std::string(_("Unknown")).append(" (").append(toString(l)).append(")").append(d).append(s); s = std::string(_("Unknown")).append(" (").append(std::to_string(l)).append(")").append(d).append(s);
} }
} }
return os << s; return os << s;

@ -954,7 +954,7 @@ DataBuf makePnm(size_t width, size_t height, const DataBuf& rgb) {
return {}; return {};
} }
const std::string header = "P6\n" + toString(width) + " " + toString(height) + "\n255\n"; const std::string header = "P6\n" + std::to_string(width) + " " + std::to_string(height) + "\n255\n";
const auto headerBytes = reinterpret_cast<const byte*>(header.data()); const auto headerBytes = reinterpret_cast<const byte*>(header.data());
DataBuf dest(header.size() + rgb.size()); DataBuf dest(header.size() + rgb.size());

Loading…
Cancel
Save