8225032: Fix some C++ conformance issues in AWT Windows code

Reviewed-by: prr, serb
This commit is contained in:
Andrew Luo 2019-05-30 17:14:06 -07:00 committed by Sergey Bylokhov
parent 312d66471a
commit 7202c3b943
3 changed files with 5 additions and 5 deletions

View File

@ -337,7 +337,7 @@ class JavaStringBuffer
protected:
LPWSTR m_pStr;
jsize m_dwSize;
LPWSTR getNonEmptyString() {
LPCWSTR getNonEmptyString() {
return (NULL==m_pStr)
? L""
: m_pStr;
@ -378,9 +378,9 @@ public:
m_pStr = (LPWSTR)SAFE_SIZE_ARRAY_REALLOC(safe_Realloc, m_pStr, m_dwSize+1, sizeof(WCHAR) );
}
//we are in UNICODE now, so LPWSTR:=:LPTSTR
operator LPWSTR() { return getNonEmptyString(); }
operator LPCWSTR() { return getNonEmptyString(); }
operator LPARAM() { return (LPARAM)getNonEmptyString(); }
void *GetData() { return (void *)getNonEmptyString(); }
const void *GetData() { return (const void *)getNonEmptyString(); }
jsize GetSize() { return m_dwSize; }
};

View File

@ -449,7 +449,7 @@ public:
static void JavaKeyToWindowsKey(UINT javaKey, UINT *windowsKey, UINT *modifiers, UINT originalWindowsKey);
static void UpdateDynPrimaryKeymap(UINT wkey, UINT jkeyLegacy, jint keyLocation, UINT modifiers);
INLINE static void AwtComponent::JavaKeyToWindowsKey(UINT javaKey,
INLINE static void JavaKeyToWindowsKey(UINT javaKey,
UINT *windowsKey, UINT *modifiers)
{
JavaKeyToWindowsKey(javaKey, windowsKey, modifiers, IGNORE_KEY);

View File

@ -130,7 +130,7 @@ BOOL AwtPrintControl::FindPrinter(jstring printerName, LPBYTE pPrinterEnum,
DWORD cbBuf = *pcbBuf, dummyWord = 0;
JavaStringBuffer printerNameBuf(env, printerName);
LPTSTR lpcPrinterName = (LPTSTR)printerNameBuf;
LPCTSTR lpcPrinterName = (LPCTSTR)printerNameBuf;
DASSERT(lpcPrinterName != NULL);
// For NT, first do a quick check of all remote and local printers.