ICU-6967 Removed u_compareVersions.
X-SVN-Rev: 26143
This commit is contained in:
parent
c0f12f09e7
commit
edf161736f
@ -1850,21 +1850,6 @@ u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) {
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_compareVersions(UVersionInfo v1, UVersionInfo v2) {
|
||||
int n;
|
||||
if(v1==NULL||v2==NULL) return 0;
|
||||
for(n=0;n<U_MAX_VERSION_LENGTH;n++) {
|
||||
if(v1[n]<v2[n]) {
|
||||
return -1;
|
||||
} else if(v1[n]>v2[n]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0; /* no difference */
|
||||
}
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_versionToString(UVersionInfo versionArray, char *versionString) {
|
||||
uint16_t count, part;
|
||||
|
@ -119,6 +119,7 @@
|
||||
#define U_MAX_VERSION_STRING_LENGTH 20
|
||||
|
||||
/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
|
||||
* To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
@ -245,19 +246,6 @@ u_versionToString(UVersionInfo versionArray, char *versionString);
|
||||
U_STABLE void U_EXPORT2
|
||||
u_getVersion(UVersionInfo versionArray);
|
||||
|
||||
/**
|
||||
* Compare two version numbers, v1 and v2, numerically.
|
||||
* Returns 0 if v1 == v2
|
||||
* Returns -1 if v1 < v2 (v1 is older, v2 is newer)
|
||||
* Returns +1 if v1 > v2 (v1 is newer, v2 is older)
|
||||
* @param v1 version to compare
|
||||
* @param v2 version to compare
|
||||
* @return comparison result
|
||||
* @draft ICU 4.2
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
u_compareVersions(UVersionInfo v1, UVersionInfo v2);
|
||||
|
||||
|
||||
/*===========================================================================
|
||||
* ICU collation framework version information
|
||||
|
@ -3012,12 +3012,12 @@ void TestCLDRVersion() {
|
||||
|
||||
u_versionToString(testExpect,tmp);
|
||||
log_verbose("(data) ExpectCLDRVersionAtLeast { %s }\n", tmp);
|
||||
if(u_compareVersions(cldrVersion, testExpect) < 0) {
|
||||
if(memcmp(cldrVersion, testExpect, sizeof(UVersionInfo)) < 0) {
|
||||
log_data_err("CLDR version is too old, expect at least %s.", tmp);
|
||||
}
|
||||
u_versionToString(testCurrent,tmp);
|
||||
log_verbose("(data) CurrentCLDRVersion { %s }\n", tmp);
|
||||
switch(u_compareVersions(cldrVersion, testCurrent)) {
|
||||
switch(memcmp(cldrVersion, testCurrent, sizeof(UVersionInfo))) {
|
||||
case 0: break; /* OK- current. */
|
||||
case -1: log_info("CLDR version is behind 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break;
|
||||
case 1: log_info("CLDR version is ahead of 'current' (for testdata/root.txt) %s. Some things may fail.\n", tmp); break;
|
||||
|
@ -286,7 +286,7 @@ static void TestCompareVersions()
|
||||
int32_t op, invop, got, invgot;
|
||||
UVersionInfo v1, v2;
|
||||
int32_t j;
|
||||
log_verbose("Testing u_compareVersions()\n");
|
||||
log_verbose("Testing memcmp()\n");
|
||||
for(j=0;testCases[j]!=NULL;j+=3) {
|
||||
v1str = testCases[j+0];
|
||||
opstr = testCases[j+1];
|
||||
@ -303,8 +303,8 @@ static void TestCompareVersions()
|
||||
invop = 0-op; /* inverse operation: with v1 and v2 switched */
|
||||
u_versionFromString(v1, v1str);
|
||||
u_versionFromString(v2, v2str);
|
||||
got = u_compareVersions(v1,v2);
|
||||
invgot = u_compareVersions(v2,v1); /* oppsite */
|
||||
got = memcmp(v1, v2, sizeof(UVersionInfo));
|
||||
invgot = memcmp(v2, v1, sizeof(UVersionInfo)); /* Opposite */
|
||||
if(got==op) {
|
||||
log_verbose("%d: %s %s %s, OK\n", (j/3), v1str, opstr, v2str);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user