static UBool gIncludeCopyright = FALSE;
static UBool gUsePoolBundle = FALSE;
+static UBool gIsDefaultFormatVersion = TRUE;
static int32_t gFormatVersion = 3;
/* How do we store string values? */
}
void setFormatVersion(int32_t formatVersion) {
+ gIsDefaultFormatVersion = FALSE;
gFormatVersion = formatVersion;
}
return;
}
+ int32_t formatVersion = gFormatVersion;
if (fPoolStringIndexLimit != 0) {
int32_t sum = fPoolStringIndexLimit + fLocalStringIndexLimit;
if ((sum - 1) > RES_MAX_OFFSET) {
fPoolStringIndex16Limit = (int32_t)(
((int64_t)fPoolStringIndexLimit * 0xffff) / sum);
}
+ } else if (gIsDefaultFormatVersion && formatVersion == 3 && !fIsPoolBundle) {
+ // If we just default to formatVersion 3
+ // but there are no pool bundle strings to share
+ // and we do not write a pool bundle,
+ // then write formatVersion 2 which is just as good.
+ formatVersion = 2;
}
fRoot->write16(this);
uprv_strcpy(dataName, fLocale);
}
- uprv_memcpy(dataInfo.formatVersion, gFormatVersions + gFormatVersion, sizeof(UVersionInfo));
+ uprv_memcpy(dataInfo.formatVersion, gFormatVersions + formatVersion, sizeof(UVersionInfo));
mem = udata_create(outputDir, "res", dataName,
&dataInfo, (gIncludeCopyright==TRUE)? U_COPYRIGHT_STRING:NULL, &errorCode);