void appendAndMergeImpl(MeasureUnitImpl &impl, const SingleUnitImpl &unit, UErrorCode &status) {
for (int32_t i = 0, n = impl.units.length(); i < n; i++) {
auto *candidate = impl.units[i];
- if (candidate->identifier == unit.identifier && candidate->siPrefix == unit.siPrefix) {
+ if ((candidate->getSimpleUnitID() == unit.getSimpleUnitID() ||
+ uprv_strcmp(candidate->getSimpleUnitID(), unit.getSimpleUnitID()) == 0) &&
+ candidate->siPrefix == unit.siPrefix) {
candidate->dimensionality += unit.dimensionality;
return;
}
for (int32_t i = 0, n = compoundSourceUnit.units.length(); i < n; i++) {
auto singleUnit = *compoundSourceUnit.units[i]; // a SingleUnitImpl
- Factor singleFactor = loadSingleFactor(singleUnit.identifier, ratesInfo, status);
+ Factor singleFactor = loadSingleFactor(singleUnit.getSimpleUnitID(), ratesInfo, status);
if (U_FAILURE(status)) return result;
// Apply SiPrefix before the power, because the power may be will flip the factor.
// Extract `ConversionRateInfo` using the absolute unit. For example: in case of `square-meter`,
// we will use `meter`
const auto singleUnitImpl = SingleUnitImpl::forMeasureUnit(singleUnit, status);
- const auto rateInfo = conversionRates.extractConversionInfo(singleUnitImpl.identifier, status);
+ const auto rateInfo =
+ conversionRates.extractConversionInfo(singleUnitImpl.getSimpleUnitID(), status);
if (U_FAILURE(status)) {
return result;
}