Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ class IE extends WebBrowser {
};

NativeGetCookie = () -> {
TCHAR url = new TCHAR (0, CookieUrl, true);
TCHAR cookieData = new TCHAR (0, 8192);
TCHAR url = new TCHAR (CookieUrl, true);
TCHAR cookieData = new TCHAR (8192);
int[] size = new int[] {cookieData.length ()};
if (!OS.InternetGetCookie (url, null, cookieData, size)) {
/* original cookieData size was not large enough */
size[0] /= TCHAR.sizeof;
cookieData = new TCHAR (0, size[0]);
cookieData = new TCHAR (size[0]);
if (!OS.InternetGetCookie (url, null, cookieData, size)) return;
}
String allCookies = cookieData.toString (0, size[0]);
Expand All @@ -179,8 +179,8 @@ class IE extends WebBrowser {
};

NativeSetCookie = () -> {
TCHAR url = new TCHAR (0, CookieUrl, true);
TCHAR value = new TCHAR (0, CookieValue, true);
TCHAR url = new TCHAR (CookieUrl, true);
TCHAR value = new TCHAR (CookieValue, true);
CookieResult = OS.InternetSetCookie (url, null, value);
};

Expand All @@ -191,18 +191,18 @@ class IE extends WebBrowser {
* IE releases prior to IE10). Check this value in order to determine
* version-specific features that can be enabled.
*/
TCHAR key = new TCHAR (0, "Software\\Microsoft\\Internet Explorer", true); //$NON-NLS-1$
TCHAR key = new TCHAR ("Software\\Microsoft\\Internet Explorer", true); //$NON-NLS-1$
long [] phkResult = new long [1];
if (OS.RegOpenKeyEx (OS.HKEY_LOCAL_MACHINE, key, 0, OS.KEY_READ, phkResult) == 0) {
int [] lpcbData = new int [1];
TCHAR buffer = new TCHAR (0, "svcVersion", true); //$NON-NLS-1$
TCHAR buffer = new TCHAR ("svcVersion", true); //$NON-NLS-1$
int result = OS.RegQueryValueEx (phkResult [0], buffer, 0, null, (TCHAR) null, lpcbData);
if (result != 0) {
buffer = new TCHAR (0, "Version", true); //$NON-NLS-1$
buffer = new TCHAR ("Version", true); //$NON-NLS-1$
result = OS.RegQueryValueEx (phkResult [0], buffer, 0, null, (TCHAR) null, lpcbData);
}
if (result == 0) {
TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof);
TCHAR lpData = new TCHAR (lpcbData [0] / TCHAR.sizeof);
result = OS.RegQueryValueEx (phkResult [0], buffer, 0, null, lpData, lpcbData);
if (result == 0) {
String versionString = lpData.toString (0, lpData.strlen ());
Expand Down Expand Up @@ -231,19 +231,19 @@ class IE extends WebBrowser {
* If it is detected in the registry to be Shell.Explorer.1 then change the progId that
* will be embedded to explicitly specify Shell.Explorer.2.
*/
key = new TCHAR (0, "Shell.Explorer\\CLSID", true); //$NON-NLS-1$
key = new TCHAR ("Shell.Explorer\\CLSID", true); //$NON-NLS-1$
phkResult = new long [1];
if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult) == 0) {
int [] lpcbData = new int [1];
int result = OS.RegQueryValueEx (phkResult [0], null, 0, null, (TCHAR) null, lpcbData);
if (result == 0) {
TCHAR lpData = new TCHAR (0, lpcbData [0] / TCHAR.sizeof);
TCHAR lpData = new TCHAR (lpcbData [0] / TCHAR.sizeof);
result = OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData);
if (result == 0) {
String clsid = lpData.toString (0, lpData.strlen ());
if (clsid.equals (CLSID_SHELLEXPLORER1)) {
/* Shell.Explorer.1 is the default, ensure that Shell.Explorer.2 is available */
key = new TCHAR (0, "Shell.Explorer.2", true); //$NON-NLS-1$
key = new TCHAR ("Shell.Explorer.2", true); //$NON-NLS-1$
long [] phkResult2 = new long [1];
if (OS.RegOpenKeyEx (OS.HKEY_CLASSES_ROOT, key, 0, OS.KEY_READ, phkResult2) == 0) {
/* specify that Shell.Explorer.2 is to be used */
Expand Down Expand Up @@ -322,14 +322,14 @@ else if (IEVersion >= 8) {

if (version != -1) {
long[] key = new long[1];
final TCHAR subkey = new TCHAR(0, "Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true); //$NON-NLS-1$
final TCHAR subkey = new TCHAR("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true); //$NON-NLS-1$
if (OS.RegCreateKeyEx(OS.HKEY_CURRENT_USER, subkey, 0, null, OS.REG_OPTION_VOLATILE, OS.KEY_WRITE | OS.KEY_QUERY_VALUE, 0, key, null) == 0) {
TCHAR lpszFile = new TCHAR(0, OS.MAX_PATH);
TCHAR lpszFile = new TCHAR(OS.MAX_PATH);
OS.GetModuleFileName(0, lpszFile, lpszFile.length());
String path = lpszFile.toString(0, lpszFile.strlen());
int index = path.lastIndexOf(SEPARATOR_OS);
String executable = index != -1 ? path.substring(index + 1) : path;
final TCHAR lpValueName = new TCHAR(0, executable, true);
final TCHAR lpValueName = new TCHAR(executable, true);
/*
* Program name & IE version entry is added to the Windows
* registry and same gets deleted during the dispose cycle.
Expand Down Expand Up @@ -496,8 +496,8 @@ else if (IEVersion >= 8) {
* case is detected and the string is changed to be a proper url string.
*/
if (url1.indexOf(":/") == -1 && url1.indexOf(":\\") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
TCHAR filePath1 = new TCHAR(0, url1, true);
TCHAR urlResult1 = new TCHAR(0, OS.INTERNET_MAX_URL_LENGTH);
TCHAR filePath1 = new TCHAR(url1, true);
TCHAR urlResult1 = new TCHAR(OS.INTERNET_MAX_URL_LENGTH);
int[] size1 = new int[] {urlResult1.length()};
if (OS.UrlCreateFromPath(filePath1, urlResult1, size1, 0) == COM.S_OK) {
url1 = urlResult1.toString(0, size1[0]);
Expand Down Expand Up @@ -580,8 +580,8 @@ else if (IEVersion >= 8) {
* case is detected and the string is changed to be a proper url string.
*/
if (url2.indexOf(":/") == -1 && url2.indexOf(":\\") != -1) { //$NON-NLS-1$ //$NON-NLS-2$
TCHAR filePath2 = new TCHAR(0, url2, true);
TCHAR urlResult2 = new TCHAR(0, OS.INTERNET_MAX_URL_LENGTH);
TCHAR filePath2 = new TCHAR(url2, true);
TCHAR urlResult2 = new TCHAR(OS.INTERNET_MAX_URL_LENGTH);
int[] size2 = new int[] {urlResult2.length()};
if (OS.UrlCreateFromPath(filePath2, urlResult2, size2, 0) == COM.S_OK) {
url2 = urlResult2.toString(0, size2[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,11 @@ int Authenticate (long hwnd, long szUsername, long szPassword) {
authenticationListener.authenticate (event);
if (!event.doit) return COM.E_ACCESSDENIED;
if (event.user != null && event.password != null) {
TCHAR user = new TCHAR (0, event.user, true);
TCHAR user = new TCHAR (event.user, true);
int size = user.length () * TCHAR.sizeof;
long userPtr = OS.CoTaskMemAlloc (size);
OS.MoveMemory (userPtr, user, size);
TCHAR password = new TCHAR (0, event.password, true);
TCHAR password = new TCHAR (event.password, true);
size = password.length () * TCHAR.sizeof;
long passwordPtr = OS.CoTaskMemAlloc (size);
OS.MoveMemory (passwordPtr, password, size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Clipboard(Display display) {
DND.error(SWT.ERROR_THREAD_INVALID_ACCESS);
}
this.display = display;
TCHAR chFormatName = new TCHAR(0, "Preferred DropEffect", true); //$NON-NLS-1$
TCHAR chFormatName = new TCHAR("Preferred DropEffect", true); //$NON-NLS-1$
CFSTR_PREFERREDDROPEFFECT = OS.RegisterClipboardFormat(chFormatName);
createCOMInterfaces();
this.AddRef();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class DragSource extends Widget {

static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$
static final int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect"); //$NON-NLS-1$
static final TCHAR WindowClass = new TCHAR (0, "#32770", true);
static final TCHAR WindowClass = new TCHAR ("#32770", true);

private class COMIDropSource extends COMObject {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private long generateCidaFromFilepaths(String[] fileNames) {
int[] pidlSizes = new int[n];
int pidlSizeSum = 2; // initialize with 2 for the empty (but double null terminated) parent pidl
for (int i = 0; i < n; i++) {
TCHAR szfileName = new TCHAR(0, fileNames[i], true);
TCHAR szfileName = new TCHAR(fileNames[i], true);
long [] ppv = new long [1];
int hr = COM.PathToPIDL(szfileName.chars, ppv);
if (hr != OS.S_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Image getDragSourceImage(DragSourceEvent event) {
if (dragSourceImage != null) dragSourceImage.dispose();
dragSourceImage = null;
SHDRAGIMAGE shdi = new SHDRAGIMAGE();
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR (0, "ShellGetDragImage", true)); //$NON-NLS-1$
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR ("ShellGetDragImage", true)); //$NON-NLS-1$
if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, shdi) != 0) {
if ((control.getStyle() & SWT.MIRRORED) != 0) {
event.offsetX = shdi.sizeDragImage.cx - shdi.ptOffset.x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static int registerType(String formatName) {
// Look name up in the registry
// If name is not in registry, add it and return assigned value.
// If name already exists in registry, return its assigned value
TCHAR chFormatName = new TCHAR(0, formatName, true);
TCHAR chFormatName = new TCHAR(formatName, true);
return OS.RegisterClipboardFormat(chFormatName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Image getDragSourceImage(DragSourceEvent event) {
if (dragSourceImage != null) dragSourceImage.dispose();
dragSourceImage = null;
SHDRAGIMAGE shdi = new SHDRAGIMAGE();
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR (0, "ShellGetDragImage", true)); //$NON-NLS-1$
int DI_GETDRAGIMAGE = OS.RegisterWindowMessage (new TCHAR ("ShellGetDragImage", true)); //$NON-NLS-1$
if (OS.SendMessage (control.handle, DI_GETDRAGIMAGE, 0, shdi) != 0) {
if ((control.getStyle() & SWT.MIRRORED) != 0) {
event.offsetX = shdi.sizeDragImage.cx - shdi.ptOffset.x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,17 @@ public static String findProgramID (String extension) {

if (extension.charAt (0) != '.') extension = "." + extension; //$NON-NLS-1$

TCHAR extensionKey = new TCHAR(0, extension, true);
TCHAR extensionKey = new TCHAR(extension, true);
String result = getKeyValue(extensionKey);
if (result != null) {
// look for "<programID>\NotInsertable"
TCHAR notInsertableKey = new TCHAR(0, result+"\\NotInsertable", true); //$NON-NLS-1$
TCHAR notInsertableKey = new TCHAR(result+"\\NotInsertable", true); //$NON-NLS-1$
if (getKeyExists(notInsertableKey)) return ""; //$NON-NLS-1$
// look for "<programID>\Insertable"
TCHAR insertableKey = new TCHAR(0, result+"\\Insertable", true); //$NON-NLS-1$
TCHAR insertableKey = new TCHAR(result+"\\Insertable", true); //$NON-NLS-1$
if (getKeyExists(insertableKey)) return result;
// look for "<programID>\protocol\StdFileEditing\server"
TCHAR serverKey = new TCHAR(0, result+"\\protocol\\StdFileEditing\\server", true); //$NON-NLS-1$
TCHAR serverKey = new TCHAR(result+"\\protocol\\StdFileEditing\\server", true); //$NON-NLS-1$
if (getKeyExists(serverKey)) return result;
}

Expand All @@ -402,7 +402,7 @@ static String getKeyValue (TCHAR key) {
if (length == 0) {
result = "";
} else {
TCHAR lpData = new TCHAR (0, length);
TCHAR lpData = new TCHAR (length);
if (OS.RegQueryValueEx (phkResult [0], null, 0, null, lpData, lpcbData) == 0) {
length = Math.max(0, lpData.length () - 1);
result = lpData.toString (0, length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ void onFocusOut(Event e) {
OS.GetGUIThreadInfo(threadId, lpgui1);
objIOleInPlaceObject.UIDeactivate();
if (SWT_RESTORECARET == 0) {
SWT_RESTORECARET = OS.RegisterWindowMessage (new TCHAR (0, "SWT_RESTORECARET", true));
SWT_RESTORECARET = OS.RegisterWindowMessage (new TCHAR ("SWT_RESTORECARET", true));
}
if (lpgui1.hwndCaret != 0) {
GUITHREADINFO lpgui2 = new GUITHREADINFO();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ public class OS extends C {
public static final int COLOR_WINDOWFRAME = 0x6;
public static final int COLOR_WINDOWTEXT = 0x8;
public static final int COMPLEXREGION = 0x3;
public static final int CP_ACP = 0x0;
public static final int CP_UTF8 = 65001;
public static final int CP_DROPDOWNBUTTON = 1;
public static final int CPS_COMPLETE = 0x1;
Expand Down Expand Up @@ -2130,8 +2129,8 @@ public static final int[] readRegistryDwords(int hkeyLocation, String key, Strin
Objects.requireNonNull(key, "key");
Objects.requireNonNull(valueName, "valueName");
long[] phkResult = new long[1];
TCHAR regKey = new TCHAR(0, key, true);
TCHAR lpValueName = new TCHAR(0, valueName, true);
TCHAR regKey = new TCHAR(key, true);
TCHAR lpValueName = new TCHAR(valueName, true);
if (OS.RegOpenKeyEx(hkeyLocation, regKey, 0, OS.KEY_READ, phkResult) != 0) {
return null; // Registry entry not found
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@
import java.util.Arrays;

/**
* This class implements the conversions between unicode characters
* and the <em>platform supported</em> representation for characters.
* <p>
* Note that unicode characters which can not be found in the platform
* encoding will be converted to an arbitrary platform specific character.
* </p>
* A char[] buffer wrapper with optional null-terminator support,
* used to pass Java strings to Win32 Unicode (W) APIs via JNI.
*
* @jniclass flags=no_gen
*/
Expand All @@ -30,15 +26,15 @@ public class TCHAR {

public final static int sizeof = 2;

public TCHAR (int codePage, int length) {
public TCHAR (int length) {
chars = new char [length];
}

public TCHAR (int codePage, char ch, boolean terminate) {
this (codePage, terminate ? new char [] {ch, '\0'} : new char [] {ch}, false);
public TCHAR (char ch, boolean terminate) {
this (terminate ? new char [] {ch, '\0'} : new char [] {ch}, false);
}

public TCHAR (int codePage, char [] chars, boolean terminate) {
public TCHAR (char [] chars, boolean terminate) {
int charCount = chars.length;
if (terminate) {
if (charCount == 0 || (charCount > 0 && chars [charCount - 1] != 0)) {
Expand All @@ -50,8 +46,8 @@ public TCHAR (int codePage, char [] chars, boolean terminate) {
this.chars = chars;
}

public TCHAR (int codePage, String string, boolean terminate) {
this (codePage, getChars (string, terminate), false);
public TCHAR (String string, boolean terminate) {
this (getChars (string, terminate), false);
}

static char [] getChars (String string, boolean terminate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ protected void create(DeviceData data) {
this.actualHeightInPoints = bestMatch.heightInPoints;

// Create printer DC for "Microsoft Print to PDF"
TCHAR driver = new TCHAR(0, "WINSPOOL", true);
TCHAR deviceName = new TCHAR(0, PDF_PRINTER_NAME, true);
TCHAR driver = new TCHAR("WINSPOOL", true);
TCHAR deviceName = new TCHAR(PDF_PRINTER_NAME, true);

// Get printer settings
long[] hPrinter = new long[1];
Expand Down Expand Up @@ -305,14 +305,14 @@ private void ensureJobStarted() {
long hHeap = OS.GetProcessHeap();

// Set output filename
TCHAR buffer = new TCHAR(0, filename, true);
TCHAR buffer = new TCHAR(filename, true);
int byteCount = buffer.length() * TCHAR.sizeof;
long lpszOutput = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
OS.MoveMemory(lpszOutput, buffer, byteCount);
di.lpszOutput = lpszOutput;

// Set document name
TCHAR docName = new TCHAR(0, "SWT PDF Document", true);
TCHAR docName = new TCHAR("SWT PDF Document", true);
int docByteCount = docName.length() * TCHAR.sizeof;
long lpszDocName = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, docByteCount);
OS.MoveMemory(lpszDocName, docName, docByteCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @noextend This class is not intended to be subclassed by clients.
*/
public class PrintDialog extends Dialog {
static final TCHAR DialogClass = new TCHAR (0, "#32770", true);
static final TCHAR DialogClass = new TCHAR ("#32770", true);
PrinterData printerData = new PrinterData();

/**
Expand Down Expand Up @@ -335,7 +335,7 @@ public PrinterData open() {
}
if (success) {
/* Initialize PRINTDLG DEVNAMES for the specified printer. */
TCHAR buffer = new TCHAR(0, printerData.name, true);
TCHAR buffer = new TCHAR(printerData.name, true);
int size = buffer.length() * TCHAR.sizeof;
short[] offsets = new short[4]; // DEVNAMES (4 offsets)
int offsetsSize = offsets.length * 2; // 2 bytes each
Expand Down
Loading
Loading