hrev45275 adds 1 changeset to branch 'master' old head: 859c378175de9013dda77d57199efc4c962215e0 new head: ab6114fe81eb08864858dbab96e5d55cadbe8e8b overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ab6114f+%5E859c378 ---------------------------------------------------------------------------- ab6114f: 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. [ Siarzhuk Zharski <zharik@xxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev45275 Commit: ab6114fe81eb08864858dbab96e5d55cadbe8e8b URL: http://cgit.haiku-os.org/haiku/commit/?id=ab6114f Author: Siarzhuk Zharski <zharik@xxxxxx> Date: Tue Feb 12 08:30:10 2013 UTC Ticket: https://dev.haiku-os.org/ticket/9444 ---------------------------------------------------------------------------- 1 file changed, 35 insertions(+), 1 deletion(-) src/bin/setmime.cpp | 36 +++++++++++++++++++++++++++++++++++- ---------------------------------------------------------------------------- diff --git a/src/bin/setmime.cpp b/src/bin/setmime.cpp index c5ad68e..c69f6fa 100644 --- a/src/bin/setmime.cpp +++ b/src/bin/setmime.cpp @@ -222,9 +222,12 @@ struct MimeAttribute MimeAttribute(BMessage& msg, int32 index); MimeAttribute(TUserArgs& args); + MimeAttribute(const MimeAttribute& src); status_t InitCheck() { return fStatus; } + MimeAttribute& operator=(const MimeAttribute& src); + void Dump(); void SyncWith(TUserArgs& args) throw(Error); void StoreInto(BMessage* target); @@ -288,12 +291,43 @@ MimeAttribute::MimeAttribute(BMessage& msg, int32 index) MimeAttribute::MimeAttribute(TUserArgs& args) + : + fStatus(B_NO_INIT), + fType('CSTR'), + fViewable(true), + fEditable(false), + fExtra(false), + fWidth(0), + fAlignment(0) { SyncWith(args); 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 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>", name, kAttribute); - if (!*++arg) + if (!*++arg || **arg == '-') throw Error("'%s', argument should be specified", name); TUserArgsI A = fUserAttributes.back().find(key);