Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Gayed2004-03-03 21:21:34 +0000
committerGrant Gayed2004-03-03 21:21:34 +0000
commit0bb2b2e9cf8a52c0c9dba0fd59ed5e92bb2f1746 (patch)
tree7e8d7e255c4c600c75116cb61d333658dd667528
parent6901f8f135bbefa7748fec892f25007d744aa39c (diff)
downloadeclipse.platform.swt-0bb2b2e9cf8a52c0c9dba0fd59ed5e92bb2f1746.tar.gz
eclipse.platform.swt-0bb2b2e9cf8a52c0c9dba0fd59ed5e92bb2f1746.tar.xz
eclipse.platform.swt-0bb2b2e9cf8a52c0c9dba0fd59ed5e92bb2f1746.zip
53570v2136b
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
index 6193a365f2..b4b980f455 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/win32/org/eclipse/swt/program/Program.java
@@ -39,7 +39,7 @@ Program () {
* The extension may or may not begin with a '.'.
*
* @param extension the program extension
- * @return the program or nil
+ * @return the program or <code>null</code>
*
* @exception SWTError <ul>
* <li>ERROR_NULL_ARGUMENT when extension is null</li>
@@ -106,17 +106,23 @@ static String getKeyValue (String string, boolean expand) {
String result = null;
int [] lpcbData = new int [1];
if (OS.RegQueryValueEx (phkResult [0], (TCHAR) null, 0, null, null, lpcbData) == 0) {
- /* Use the character encoding for the default locale */
- TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof);
- if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
- if (!OS.IsWinCE && expand) {
- int nSize = OS.ExpandEnvironmentStrings (lpData, null, 0);
- TCHAR lpDst = new TCHAR (0, nSize);
- OS.ExpandEnvironmentStrings (lpData, lpDst, nSize);
- result = lpDst.toString (0, Math.max (0, nSize - 1));
- } else {
- int length = Math.max (0, lpData.length () - 1);
- result = lpData.toString (0, length);
+ result = "";
+ int length = lpcbData [0] / TCHAR.sizeof;
+ if (length != 0) {
+ /* Use the character encoding for the default locale */
+ TCHAR lpData = new TCHAR (0, length);
+ if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
+ if (!OS.IsWinCE && expand) {
+ length = OS.ExpandEnvironmentStrings (lpData, null, 0);
+ if (length != 0) {
+ TCHAR lpDst = new TCHAR (0, length);
+ OS.ExpandEnvironmentStrings (lpData, lpDst, length);
+ result = lpDst.toString (0, Math.max (0, length - 1));
+ }
+ } else {
+ length = Math.max (0, lpData.length () - 1);
+ result = lpData.toString (0, length);
+ }
}
}
}

Back to the top