Allow to add/set tags without a value with the command line tool.

v0.27.3
Andreas Huggel 14 years ago
parent 863772fba1
commit 19f165629f

@ -384,6 +384,10 @@ is determined based on \fIkey\fP.
The remaining text on the line is the value. It can optionally be
enclosed in single quotes ('\fIvalue\fP') or double quotes ("\fIvalue\fP").
.sp 1
The value is optional. Not providing any value is equivalent to an
empty value ("") and is mainly useful to create an XMP array property,
e.g., a bag.
.sp 1
The format of Exif \fBComment\fP values includes an optional charset
specification at the beginning:
.sp 1

@ -1098,21 +1098,24 @@ namespace {
bool explicitType = false;
if (cmdId != del) {
// Get type and value
std::string::size_type typeStart
= line.find_first_not_of(delim, keyEnd+1);
std::string::size_type typeEnd
= line.find_first_of(delim, typeStart+1);
std::string::size_type typeStart = std::string::npos;
if (keyEnd != std::string::npos) typeStart = line.find_first_not_of(delim, keyEnd+1);
std::string::size_type typeEnd = std::string::npos;
if (typeStart != std::string::npos) typeEnd = line.find_first_of(delim, typeStart+1);
std::string::size_type valStart = typeStart;
std::string::size_type valEnd = line.find_last_not_of(delim);
std::string::size_type valEnd = std::string::npos;
if (valStart != std::string::npos) valEnd = line.find_last_not_of(delim);
if ( keyEnd == std::string::npos
|| typeStart == std::string::npos
|| valStart == std::string::npos) {
if ( cmdId == reg
&& ( keyEnd == std::string::npos
|| valStart == std::string::npos)) {
throw Exiv2::Error(1, Exiv2::toString(num)
+ ": " + _("Invalid command line") + " " );
}
if (cmdId != reg && typeEnd != std::string::npos) {
if ( cmdId != reg
&& typeStart != std::string::npos
&& typeEnd != std::string::npos) {
std::string typeStr(line.substr(typeStart, typeEnd-typeStart));
Exiv2::TypeId tmpType = Exiv2::TypeInfo::typeId(typeStr);
if (tmpType != Exiv2::invalidTypeId) {
@ -1126,6 +1129,7 @@ namespace {
}
}
if (valStart != std::string::npos) {
value = parseEscapes(line.substr(valStart, valEnd+1-valStart));
std::string::size_type last = value.length()-1;
if ( (value[0] == '"' && value[last] == '"')
@ -1133,6 +1137,7 @@ namespace {
value = value.substr(1, value.length()-2);
}
}
}
modifyCmd.cmdId_ = cmdId;
modifyCmd.key_ = key;

Loading…
Cancel
Save