Fix init.problem in setmime MimeAttribute ctor
* additional check for empty attribute values introduced; * implemented copy-ctor and assignment operator for MimeAttribute; * added missed initialization of parameters in the "UserArgs" MimeAttribute ctor; * Fixes #9444.
This commit is contained in:
parent
859c378175
commit
ab6114fe81
|
@ -222,9 +222,12 @@ struct MimeAttribute
|
||||||
|
|
||||||
MimeAttribute(BMessage& msg, int32 index);
|
MimeAttribute(BMessage& msg, int32 index);
|
||||||
MimeAttribute(TUserArgs& args);
|
MimeAttribute(TUserArgs& args);
|
||||||
|
MimeAttribute(const MimeAttribute& src);
|
||||||
|
|
||||||
status_t InitCheck() { return fStatus; }
|
status_t InitCheck() { return fStatus; }
|
||||||
|
|
||||||
|
MimeAttribute& operator=(const MimeAttribute& src);
|
||||||
|
|
||||||
void Dump();
|
void Dump();
|
||||||
void SyncWith(TUserArgs& args) throw(Error);
|
void SyncWith(TUserArgs& args) throw(Error);
|
||||||
void StoreInto(BMessage* target);
|
void StoreInto(BMessage* target);
|
||||||
|
@ -288,12 +291,43 @@ MimeAttribute::MimeAttribute(BMessage& msg, int32 index)
|
||||||
|
|
||||||
|
|
||||||
MimeAttribute::MimeAttribute(TUserArgs& args)
|
MimeAttribute::MimeAttribute(TUserArgs& args)
|
||||||
|
:
|
||||||
|
fStatus(B_NO_INIT),
|
||||||
|
fType('CSTR'),
|
||||||
|
fViewable(true),
|
||||||
|
fEditable(false),
|
||||||
|
fExtra(false),
|
||||||
|
fWidth(0),
|
||||||
|
fAlignment(0)
|
||||||
{
|
{
|
||||||
SyncWith(args);
|
SyncWith(args);
|
||||||
fStatus = B_OK;
|
fStatus = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MimeAttribute::MimeAttribute(const MimeAttribute& src)
|
||||||
|
{
|
||||||
|
*this = src;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MimeAttribute&
|
||||||
|
MimeAttribute::operator=(const MimeAttribute& src)
|
||||||
|
{
|
||||||
|
fStatus = src.fStatus;
|
||||||
|
fName = src.fName;
|
||||||
|
fPublicName = src.fPublicName;
|
||||||
|
fType = src.fType;
|
||||||
|
fViewable = src.fViewable;
|
||||||
|
fEditable = src.fEditable;
|
||||||
|
fExtra = src.fExtra;
|
||||||
|
fWidth = src.fWidth;
|
||||||
|
fAlignment = src.fAlignment;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MimeAttribute::SyncWith(TUserArgs& args) throw(Error)
|
MimeAttribute::SyncWith(TUserArgs& args) throw(Error)
|
||||||
{
|
{
|
||||||
|
@ -609,7 +643,7 @@ MimeType::_Init(char** argv) throw (Error)
|
||||||
throw Error("'%s' allowed only after the '%s' <name>",
|
throw Error("'%s' allowed only after the '%s' <name>",
|
||||||
name, kAttribute);
|
name, kAttribute);
|
||||||
|
|
||||||
if (!*++arg)
|
if (!*++arg || **arg == '-')
|
||||||
throw Error("'%s', argument should be specified", name);
|
throw Error("'%s', argument should be specified", name);
|
||||||
|
|
||||||
TUserArgsI A = fUserAttributes.back().find(key);
|
TUserArgsI A = fUserAttributes.back().find(key);
|
||||||
|
|
Loading…
Reference in New Issue