case nsIDataType::TYPE_INT64:
case nsIDataType::VTYPE_INT64:
static nsresult ConvertAndCopyVariant(nsIVariant *inVar, PRUint16 type, nsIVariant **_retval){    nsresult rv;        nsCOMPtr<nsIWritableVariant> outVar;    outVar = do_CreateInstance("@mozilla.org/variant;1");    if(!outVar)        return NS_ERROR_FAILURE;    PRUint16 inVarType;    rv = inVar->GetDataType(&inVarType);    if(NS_FAILED(rv))        return rv;    nsDiscriminatedUnion u;    nsVariant::Initialize(&u);    switch(type)    {    case nsIDataType::TYPE_INT8:                MEMBER_COPY_CAST(Int8, PRUint8)        break;    case nsIDataType::TYPE_INT16:                MEMBER_COPY(Int16)        break;    case nsIDataType::TYPE_INT32:                MEMBER_COPY(Int32)        break;    case nsIDataType::TYPE_INT64:                MEMBER_COPY(Int64)        break;    case nsIDataType::TYPE_UINT8:                MEMBER_COPY(Uint8)        break;    case nsIDataType::TYPE_UINT16:                MEMBER_COPY(Uint16)        break;    case nsIDataType::TYPE_UINT32:                MEMBER_COPY(Uint32)        break;    case nsIDataType::TYPE_UINT64:                MEMBER_COPY(Uint64)        break;    case nsIDataType::TYPE_FLOAT:                MEMBER_COPY(Float)        break;    case nsIDataType::TYPE_DOUBLE:                MEMBER_COPY(Double)        break;    case nsIDataType::TYPE_BOOL:                MEMBER_COPY(Bool)        break;    case nsIDataType::TYPE_CHAR:                MEMBER_COPY(Char)        break;    case nsIDataType::TYPE_WCHAR:                MEMBER_COPY(WChar)        break;    case nsIDataType::TYPE_VOID:                if(inVarType != nsIDataType::TYPE_VOID)            return NS_ERROR_CANNOT_CONVERT_DATA;        rv = outVar->SetAsVoid();        NS_ENSURE_SUCCESS(rv,rv);        break;    case nsIDataType::TYPE_ID:                MEMBER_COPY(ID)        break;    case nsIDataType::TYPE_ASTRING:            {        nsAutoString str;        rv = inVar->GetAsAString(str);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsAString(str);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_CHAR_STR:            {        char* str;        rv = inVar->GetAsString(&str);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsString(str);        if(str) nsMemory::Free(str);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_STRING_SIZE_IS:            {        char* str;        PRUint32 size;        rv = inVar->GetAsStringWithSize(&size, &str);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsStringWithSize(size, str);        if(str) nsMemory::Free(str);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_WCHAR_STR:            {        PRUnichar* str;        rv = inVar->GetAsWString(&str);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsWString(str);        if(str) nsMemory::Free((char*)str);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_WSTRING_SIZE_IS:            {        PRUnichar* str;        PRUint32 size;        rv = inVar->GetAsWStringWithSize(&size, &str);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsWStringWithSize(size, str);        if(str) nsMemory::Free((char*)str);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_INTERFACE:            {        nsISupports* ptr;        rv = inVar->GetAsISupports(&ptr);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsISupports(ptr);        NS_IF_RELEASE(ptr);        NS_ENSURE_SUCCESS(rv,rv);        break;    }    case nsIDataType::TYPE_INTERFACE_IS:            {        nsISupports* ptr;        nsIID* iid;        rv = inVar->GetAsInterface(&iid, (void**)&ptr);        if(NS_FAILED(rv)) return rv;        rv = outVar->SetAsInterface(*iid, ptr);        NS_IF_RELEASE(ptr);        if(iid) nsMemory::Free((char*)iid);        NS_ENSURE_SUCCESS(rv,rv);        break;    }        break;    case nsIDataType::TYPE_ARRAY:           return NS_ERROR_NOT_IMPLEMENTED;    case nsIDataType::TYPE_EMPTY:        if(inVarType != nsIDataType::TYPE_EMPTY)            return NS_ERROR_CANNOT_CONVERT_DATA;        rv = outVar->SetAsEmpty();        NS_ENSURE_SUCCESS(rv,rv);        break;    default:        NS_ERROR("bad type in variant!");        break;    }    nsVariant::Cleanup(&u);    *_retval = outVar;    NS_IF_ADDREF(*_retval);    return NS_OK;}        