Diffstat (limited to 'noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp index 9069c09..3fd877f 100644 --- a/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTSDPAttribute.cpp @@ -202,128 +202,131 @@ void OTSDPAttribute::setInt(const OTSDPAttribute::int128_t & val) { void OTSDPAttribute::setUInt(const uint128_t & val) { type = UINT; Value.uintVal = new uint128_t(val); } void OTSDPAttribute::setUUID(const OTUUID & val) { type = UUID; Value.uuidVal = new OTUUID( val ); } void OTSDPAttribute::setBool(bool val) { type = BOOLEAN; Value.boolVal = val; } void OTSDPAttribute::setString( const QString & val) { type = STRING; Value.stringVal = new QString( val ); } void OTSDPAttribute::setURL( const QString & val) { type = URL; Value.stringVal = new QString(val); } void OTSDPAttribute::setSequence(const AttributeVector& val) { type = SEQUENCE; Value.sequenceVal = new AttributeVector(); Value.sequenceVal->setAutoDelete( TRUE ); *Value.sequenceVal = val; } void OTSDPAttribute::setAlternative(const AttributeVector& val) { type = ALTERNATIVE; Value.sequenceVal = new AttributeVector(); Value.sequenceVal->setAutoDelete( TRUE ); *Value.sequenceVal = val; } QString OTSDPAttribute::getString() { assert(type == STRING); return *Value.stringVal; } QString OTSDPAttribute::getURL() { assert(type == URL); return *Value.stringVal; } const OTSDPAttribute::int128_t & OTSDPAttribute::getInt() { assert(type == INT); return *Value.intVal; } const OTSDPAttribute::uint128_t & OTSDPAttribute::getUInt() { assert(type == UINT); return *Value.uintVal; } const OTUUID & OTSDPAttribute::getUUID() { assert(type == UUID); return *Value.uuidVal; } bool OTSDPAttribute::getBool() { assert(type == BOOLEAN); return Value.boolVal; } AttributeVector * OTSDPAttribute::getSequence() { assert(type == SEQUENCE); return Value.sequenceVal; } AttributeVector * OTSDPAttribute::getAlternative() { assert(type == ALTERNATIVE); return Value.sequenceVal; } UUIDVector OTSDPAttribute::getAllUUIDs() { UUIDVector uuids; if (getType() == UUID) { uuids.resize( uuids.size()+1 ); uuids[uuids.size()-1] = getUUID(); } else { AttributeVector * subAttributes = 0 ; if (getType() == SEQUENCE) { subAttributes = getSequence(); } else if (getType() == ALTERNATIVE) { subAttributes = getAlternative(); } + if (!subAttributes) + return 0; + int os; for( unsigned int i = 0; i < subAttributes->count(); i++ ) { UUIDVector subUUIDs = (*subAttributes)[i]->getAllUUIDs(); os = uuids.size(); uuids.resize( uuids.size()+subUUIDs.count() ); for( unsigned int k = 0; k < subUUIDs.count(); k++ ) { uuids[os + k] = subUUIDs[k]; } } } return uuids; } static char * Attr2String[] = { "Invalid", "Nil", "UInt", "int", "UUID", "Boolean", "String", "Sequence", "Alternative", "URL", "Unknown" }; const char * OTSDPAttribute::getTypeString() { return Attr2String[type]; } |