Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-03-31 08:07:24 +0000
committerMarkus Schorn2008-03-31 08:07:24 +0000
commitbb834c4bb714607a150c6051d0c85a86c8dd0cb1 (patch)
treea51a53eb8905d1be505fd84f438fb6e559d816ac /core/org.eclipse.cdt.core
parent2f974e0ef557e5dc5dced406667d25517702285e (diff)
downloadorg.eclipse.cdt-bb834c4bb714607a150c6051d0c85a86c8dd0cb1.tar.gz
org.eclipse.cdt-bb834c4bb714607a150c6051d0c85a86c8dd0cb1.tar.xz
org.eclipse.cdt-bb834c4bb714607a150c6051d0c85a86c8dd0cb1.zip
Common method to compute string for PDOM versions.
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java18
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java2
2 files changed, 10 insertions, 10 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
index 91bad01c326..513feda25ad 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
@@ -96,17 +96,22 @@ public class PDOM extends PlatformObject implements IPDOM {
*/
public static final String FRAGMENT_PROPERTY_VALUE_FORMAT_ID= "org.eclipse.cdt.internal.core.pdom.PDOM"; //$NON-NLS-1$
- public static int version(int major, int minor) {
+ private static int version(int major, int minor) {
return major << 16 + minor;
}
-
public static final int MAJOR_VERSION = 57;
public static final int MINOR_VERSION = 0; // minor versions must be compatible
public static final int CURRENT_VERSION= version(MAJOR_VERSION, MINOR_VERSION);
public static final int MIN_SUPPORTED_VERSION= version(MAJOR_VERSION, 0);
public static final int MAX_SUPPORTED_VERSION= version(MAJOR_VERSION+1, 0)-1;
-
+
+ public static String versionString(int version) {
+ final int major= version >> 16;
+ final int minor= version & 0xffff;
+ return "" + major + '.' + minor; //$NON-NLS-1$
+ }
+
/*
* PDOM internal format history
*
@@ -241,10 +246,6 @@ public class PDOM extends PlatformObject implements IPDOM {
return locationConverter;
}
- public boolean isCurrentVersion() throws CoreException {
- return db.getVersion() == CURRENT_VERSION;
- }
-
public boolean isSupportedVersion() throws CoreException {
final int version = db.getVersion();
return version >= MIN_SUPPORTED_VERSION && version <= MAX_SUPPORTED_VERSION;
@@ -894,8 +895,7 @@ public class PDOM extends PlatformObject implements IPDOM {
return FRAGMENT_PROPERTY_VALUE_FORMAT_ID;
}
if(IIndexFragment.PROPERTY_FRAGMENT_FORMAT_VERSION.equals(propertyName)) {
- int version= db.getVersion();
- return ""+(version >> 16) + '.' + (version & 0xffff); //$NON-NLS-1$
+ return PDOM.versionString(db.getVersion());
}
return new DBProperties(db, PROPERTIES).getProperty(propertyName);
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
index bcdfe9deaf8..6b8998ad0e9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMManager.java
@@ -1172,7 +1172,7 @@ public class PDOMManager implements IWritableIndexManager, IListener {
version= (version << 8) + (b & 0xff);
out.write(b);
}
- if (version < PDOM.MIN_SUPPORTED_VERSION) {
+ if (version < PDOM.MIN_SUPPORTED_VERSION || version > PDOM.MAX_SUPPORTED_VERSION) {
final IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, 0, CCorePlugin.getResourceString("PDOMManager.unsupportedVersion"), null); //$NON-NLS-1$
throw new CoreException(status);
}

Back to the top