additionalType->prefix.flags = TD_INT32;    paramDesc->type.prefix.flags = TD_UINT32;   paramDesc = aParams->GetNextParam(); if (!paramDesc) { return NS_ERROR_OUT_OF_MEMORY; }   paramDesc->type.prefix.flags = TD_ARRAY | XPT_TDP_POINTER; paramDesc->type.type.additional_type = typeIndex; return NS_OK;
}  if (depth || arrayDimension > 1) { NS_ASSERTION(depth==1, "bad depth"); paramDesc->type.prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER; paramDesc->type.type.iface = iidx.Get(IIDX::IDX_nsIVariant); return NS_OK; }    nsCOMPtr<nsISchemaType> arrayType; rv = complexType->GetArrayType(getter_AddRefs(arrayType)); if (NS_FAILED(rv)) { return rv; }  ParamAccumulator arrayTypeParams; rv = GetParamDescOfType(iism, aSet, arrayType, iidx, defaultResult, qualifier, depth+1, &arrayTypeParams); if (NS_FAILED(rv)) { return rv; }  rv = aSet->AllocateAdditionalType(&typeIndex, &additionalType); if (NS_FAILED(rv)) { return rv; }      if(arrayTypeParams.GetCount() != 1) { additionalType->prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER; additionalType->type.iface = iidx.Get(IIDX::IDX_nsIVariant); } else {  *additionalType = arrayTypeParams.GetArray()->type;    if (additionalType->prefix.flags == (TD_DOMSTRING | XPT_TDP_POINTER)) { additionalType->prefix.flags = TD_PWSTRING | XPT_TDP_POINTER; } }   paramDesc->type.prefix.flags = TD_UINT32;   paramDesc = aParams->GetNextParam(); if (!paramDesc) { return NS_ERROR_OUT_OF_MEMORY; }   paramDesc->type.prefix.flags = TD_ARRAY | XPT_TDP_POINTER; paramDesc->type.type.additional_type = typeIndex; return NS_OK; }  switch(contentModel) {
static nsresult GetParamDescOfType(nsIInterfaceInfoSuperManager* iism,                                   nsIGenericInterfaceInfoSet* aSet,                                   nsISchemaType* aType,                                   const IIDX& iidx,                                   XPTParamDescriptor* defaultResult,                                   const nsAString& qualifier,                                   ParamAccumulator* aParams){  XPTTypeDescriptor* additionalType;  PRUint16 typeIndex;  nsCOMPtr<nsISchemaSimpleType> simpleType;  nsresult rv;  XPTParamDescriptor* paramDesc = aParams->GetNextParam();  if (!paramDesc) {    return NS_ERROR_OUT_OF_MEMORY;  }  nsCOMPtr<nsISchemaComplexType> complexType(do_QueryInterface(aType));  if (complexType) {    PRUint16 contentModel;    rv = complexType->GetContentModel(&contentModel);    if (NS_FAILED(rv)) {      return rv;    }    // XXX need to deal with array case!!!            switch(contentModel) {      case nsISchemaComplexType::CONTENT_MODEL_EMPTY:                // XXX For NOW let's try out part of the Array scheme...        rv = aSet->AllocateAdditionalType(&typeIndex,                                          &additionalType);        if (NS_FAILED(rv)) {          return rv;        }        // XXX Fix the type 'filler-inner'        // We may need to use a local ParamAccumulator here and recur in order        // To figure out this type. Yuk!        additionalType->prefix.flags = TD_INT32;        // Add the leading 'length' param.        paramDesc->type.prefix.flags = TD_UINT32;                // Alloc another param descriptor to hold the array info.        paramDesc = aParams->GetNextParam();        if (!paramDesc) {          return NS_ERROR_OUT_OF_MEMORY;        }        // Set this *second* param as an array and return.        paramDesc->type.prefix.flags = TD_ARRAY | XPT_TDP_POINTER;        paramDesc->type.type.additional_type = typeIndex;        return NS_OK;      case nsISchemaComplexType::CONTENT_MODEL_SIMPLE:        rv = complexType->GetSimpleBaseType(getter_AddRefs(simpleType));        if (NS_FAILED(rv)) {          return rv;        }        goto do_simple;      case nsISchemaComplexType::CONTENT_MODEL_ELEMENT_ONLY:      case nsISchemaComplexType::CONTENT_MODEL_MIXED:        break;      default:        NS_ERROR("unexpected contentModel!");        return NS_ERROR_UNEXPECTED;    }    nsCOMPtr<nsISchemaModelGroup> modelGroup;    rv = complexType->GetModelGroup(getter_AddRefs(modelGroup));    if (NS_FAILED(rv)) {      return rv;    }    PRUint16 compositor;    rv = modelGroup->GetCompositor(&compositor);    if (NS_FAILED(rv)) {      return rv;    }    if (compositor != nsISchemaModelGroup::COMPOSITOR_SEQUENCE) {      return NS_ERROR_UNEXPECTED;    }    // XXX figure out if this is an array (or was that already handled    // by the CONTENT_MODEL_EMPTY check above???    rv = FindOrConstructInterface(iism, aSet, complexType, modelGroup, iidx,                                   defaultResult, qualifier, &typeIndex);    if (NS_FAILED(rv)) {      return rv;    }    paramDesc->type.prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER;    paramDesc->type.type.iface = typeIndex;    return NS_OK;  }  // If it is not complex it *must* be simple.  simpleType = do_QueryInterface(aType, &rv);do_simple:  if (!simpleType) {    return rv;  }  // We just ignore the restrictions on restrictionTypes and get at the  // underlying simple type.  nsCOMPtr<nsISchemaRestrictionType> restrictionType;  while (nsnull != (restrictionType = do_QueryInterface(simpleType))) {    rv = restrictionType->GetBaseType(getter_AddRefs(simpleType));    if (NS_FAILED(rv)) {      return rv;    }  }  nsCOMPtr<nsISchemaBuiltinType> builtinType(do_QueryInterface(simpleType));  if (builtinType) {    PRUint16 typeID;    rv = builtinType->GetBuiltinType(&typeID);    if (NS_FAILED(rv)) {      return rv;    }    switch(typeID) {      case nsISchemaBuiltinType::BUILTIN_TYPE_ANYTYPE:        paramDesc->type.prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER;        paramDesc->type.type.iface = iidx.Get(IIDX::IDX_nsIVariant);        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_STRING:      case nsISchemaBuiltinType::BUILTIN_TYPE_NORMALIZED_STRING:      case nsISchemaBuiltinType::BUILTIN_TYPE_TOKEN:        paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_BYTE:        paramDesc->type.prefix.flags = TD_INT8;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDBYTE:        paramDesc->type.prefix.flags = TD_UINT8;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY:        // XXX isArray issues.        paramDesc->type.prefix.flags = TD_UINT8;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY:        // XXX isArray issues.        paramDesc->type.prefix.flags = TD_UINT8;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_POSITIVEINTEGER:      case nsISchemaBuiltinType::BUILTIN_TYPE_NONNEGATIVEINTEGER:        // XXX need a longInteger class?        paramDesc->type.prefix.flags = TD_UINT64;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_INTEGER:      case nsISchemaBuiltinType::BUILTIN_TYPE_NEGATIVEINTEGER:      case nsISchemaBuiltinType::BUILTIN_TYPE_NONPOSITIVEINTEGER:        // XXX need a longInteger class?        paramDesc->type.prefix.flags = TD_INT64;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_INT:        paramDesc->type.prefix.flags = TD_INT32;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDINT:        paramDesc->type.prefix.flags = TD_UINT32;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_LONG:        paramDesc->type.prefix.flags = TD_INT64;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDLONG:        paramDesc->type.prefix.flags = TD_UINT64;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_SHORT:        paramDesc->type.prefix.flags = TD_INT16;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_UNSIGNEDSHORT:        paramDesc->type.prefix.flags = TD_UINT16;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_DECIMAL:        // XXX need a decimal class?        paramDesc->type.prefix.flags = TD_DOUBLE;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_FLOAT:        paramDesc->type.prefix.flags = TD_FLOAT;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_DOUBLE:        paramDesc->type.prefix.flags = TD_DOUBLE;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_BOOLEAN:        paramDesc->type.prefix.flags = TD_BOOL;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_TIME:        paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_DATETIME:        // XXX date type?        paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_DURATION:      case nsISchemaBuiltinType::BUILTIN_TYPE_DATE:      case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTH:      case nsISchemaBuiltinType::BUILTIN_TYPE_GYEAR:      case nsISchemaBuiltinType::BUILTIN_TYPE_GYEARMONTH:      case nsISchemaBuiltinType::BUILTIN_TYPE_GDAY:      case nsISchemaBuiltinType::BUILTIN_TYPE_GMONTHDAY:        paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;        return NS_OK;      case nsISchemaBuiltinType::BUILTIN_TYPE_NAME:      case nsISchemaBuiltinType::BUILTIN_TYPE_QNAME:      case nsISchemaBuiltinType::BUILTIN_TYPE_NCNAME:      case nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI:      case nsISchemaBuiltinType::BUILTIN_TYPE_LANGUAGE:      case nsISchemaBuiltinType::BUILTIN_TYPE_ID:      case nsISchemaBuiltinType::BUILTIN_TYPE_IDREF:      case nsISchemaBuiltinType::BUILTIN_TYPE_IDREFS:      case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITY:      case nsISchemaBuiltinType::BUILTIN_TYPE_ENTITIES:      case nsISchemaBuiltinType::BUILTIN_TYPE_NOTATION:      case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKEN:      case nsISchemaBuiltinType::BUILTIN_TYPE_NMTOKENS:        paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;        return NS_OK;      default:        NS_ERROR("unexpected typeID!");        return NS_ERROR_UNEXPECTED;    }    NS_ERROR("missing return");    return NS_ERROR_UNEXPECTED;  }  // else...  nsCOMPtr<nsISchemaListType> listType(do_QueryInterface(simpleType));  if (listType) {    paramDesc->type.prefix.flags = TD_DOMSTRING | XPT_TDP_POINTER;    return NS_OK;  }  // else...  nsCOMPtr<nsISchemaUnionType> unionType(do_QueryInterface(simpleType));  if (unionType) {    paramDesc->type.prefix.flags = TD_INTERFACE_TYPE | XPT_TDP_POINTER;    paramDesc->type.type.iface = iidx.Get(IIDX::IDX_nsIVariant);    return NS_OK;  }  // else...  NS_ERROR("unexpected simple type!");  return NS_ERROR_UNEXPECTED;}