OpenJDK / jdk / hs
changeset 7772:bf119e738928
6999766: Changes to correct c/c++ language issues for use of parfait
Reviewed-by: uta, amenkov
author | dav |
---|---|
date | Tue, 28 Dec 2010 17:13:13 +0300 |
parents | 9d852846c077 |
children | d714591bc2f0 |
files | jdk/src/windows/native/sun/windows/Devices.h jdk/src/windows/native/sun/windows/awt.h jdk/src/windows/native/sun/windows/awt_Debug.cpp jdk/src/windows/native/sun/windows/awt_Debug.h jdk/src/windows/native/sun/windows/awt_DesktopProperties.cpp jdk/src/windows/native/sun/windows/awt_TextArea.h jdk/src/windows/native/sun/windows/awt_Toolkit.h |
diffstat | 7 files changed, 53 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/src/windows/native/sun/windows/Devices.h Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/Devices.h Tue Dec 28 17:13:13 2010 +0300 @@ -54,7 +54,7 @@ InstanceAccess& operator=(const InstanceAccess&); InstanceAccess* operator&(); }; -friend InstanceAccess; +friend class InstanceAccess; private: Devices(int numElements);
--- a/jdk/src/windows/native/sun/windows/awt.h Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt.h Tue Dec 28 17:13:13 2010 +0300 @@ -173,7 +173,7 @@ // Platform encoding is Unicode (UTF-16), re-define JNU_ functions // to proper JNI functions. -#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<jchar*>(x), static_cast<jsize>(_tcslen(x))) +#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<const jchar*>(x), static_cast<jsize>(_tcslen(x))) #define JNU_GetStringPlatformChars(env, x, y) reinterpret_cast<LPCWSTR>(env->GetStringChars(x, y)) #define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast<const jchar*>(y))
--- a/jdk/src/windows/native/sun/windows/awt_Debug.cpp Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt_Debug.cpp Tue Dec 28 17:13:13 2010 +0300 @@ -47,12 +47,21 @@ return ptr; } +void * operator new[](size_t size, const char * filename, int linenumber) { + void * ptr = DMem_AllocateBlock(size, filename, linenumber); + if (ptr == NULL) { + throw std::bad_alloc(); + } + + return ptr; +} + #if _MSC_VER >= 1200 void operator delete(void *ptr, const char*, int) { DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!"); } #endif -void operator delete(void *ptr) { +void operator delete(void *ptr) throw() { DMem_FreeBlock(ptr); }
--- a/jdk/src/windows/native/sun/windows/awt_Debug.h Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt_Debug.h Tue Dec 28 17:13:13 2010 +0300 @@ -48,11 +48,14 @@ }; extern void * operator new(size_t size, const char * filename, int linenumber); + extern void * operator new[](size_t size, const char * filename, int linenumber); + #if _MSC_VER >= 1200 /* VC 6.0 is more strict about enforcing matching placement new & delete */ extern void operator delete(void *ptr, const char*, int); #endif - extern void operator delete(void *ptr); + + extern void operator delete(void *ptr) throw(); extern void DumpClipRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist); extern void DumpUpdateRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
--- a/jdk/src/windows/native/sun/windows/awt_DesktopProperties.cpp Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt_DesktopProperties.cpp Tue Dec 28 17:13:13 2010 +0300 @@ -650,7 +650,7 @@ } void AwtDesktopProperties::SetStringProperty(LPCTSTR propName, LPTSTR value) { - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setStringPropertyID, key, JNU_NewStringPlatform(GetEnv(), value)); @@ -658,7 +658,7 @@ } void AwtDesktopProperties::SetIntegerProperty(LPCTSTR propName, int value) { - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setIntegerPropertyID, key, (jint)value); @@ -666,7 +666,7 @@ } void AwtDesktopProperties::SetBooleanProperty(LPCTSTR propName, BOOL value) { - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setBooleanPropertyID, key, value ? JNI_TRUE : JNI_FALSE); @@ -674,7 +674,7 @@ } void AwtDesktopProperties::SetColorProperty(LPCTSTR propName, DWORD value) { - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setColorPropertyID, key, GetRValue(value), GetGValue(value), @@ -726,7 +726,7 @@ style |= java_awt_Font_ITALIC; } - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setFontPropertyID, key, fontName, style, pointSize); @@ -744,7 +744,7 @@ jint pointSize; jint style; - fontName = JNU_NewStringPlatform(GetEnv(), const_cast<LPWSTR>(font.lfFaceName)); + fontName = JNU_NewStringPlatform(GetEnv(), font.lfFaceName); #if 0 HDC hdc; @@ -767,7 +767,7 @@ style |= java_awt_Font_ITALIC; } - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setFontPropertyID, key, fontName, style, pointSize); @@ -776,8 +776,8 @@ } void AwtDesktopProperties::SetSoundProperty(LPCTSTR propName, LPCTSTR winEventName) { - jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName)); - jstring event = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(winEventName)); + jstring key = JNU_NewStringPlatform(GetEnv(), propName); + jstring event = JNU_NewStringPlatform(GetEnv(), winEventName); GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setSoundPropertyID, key, event);
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.h Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt_TextArea.h Tue Dec 28 17:13:13 2010 +0300 @@ -41,9 +41,6 @@ class AwtTextArea : public AwtTextComponent { - // inner classes - class OleCallback; - public: /* java.awt.TextArea fields ids */ @@ -89,36 +86,11 @@ static void _ReplaceText(void *param); protected: - INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; } - void EditSetSel(CHARRANGE &cr); - void EditGetSel(CHARRANGE &cr); - LONG EditGetCharFromPos(POINT& pt); - private: - // RichEdit 1.0 control generates EN_CHANGE notifications not only - // on text changes, but also on any character formatting change. - // This flag is true when the latter case is detected. - BOOL m_bIgnoreEnChange; - - // RichEdit 1.0 control undoes a character formatting change - // if it is the latest. We don't create our own undo buffer, - // but just prohibit undo in case if the latest operation - // is a formatting change. - BOOL m_bCanUndo; - - HWND m_hEditCtrl; - static WNDPROC sm_pDefWindowProc; - - LONG m_lHDeltaAccum; - LONG m_lVDeltaAccum; - - - static OleCallback sm_oleCallback; /***************************************************************** * Inner class OleCallback declaration. */ - - class AwtTextArea::OleCallback : public IRichEditOleCallback { + class OleCallback : public IRichEditOleCallback { public: OleCallback(); @@ -143,7 +115,32 @@ CHARRANGE FAR * pchrg, HMENU FAR * phmenu); private: ULONG m_refs; // Reference count - }; + };//OleCallback class + + INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; } + void EditSetSel(CHARRANGE &cr); + void EditGetSel(CHARRANGE &cr); + LONG EditGetCharFromPos(POINT& pt); + private: + // RichEdit 1.0 control generates EN_CHANGE notifications not only + // on text changes, but also on any character formatting change. + // This flag is true when the latter case is detected. + BOOL m_bIgnoreEnChange; + + // RichEdit 1.0 control undoes a character formatting change + // if it is the latest. We don't create our own undo buffer, + // but just prohibit undo in case if the latest operation + // is a formatting change. + BOOL m_bCanUndo; + + HWND m_hEditCtrl; + static WNDPROC sm_pDefWindowProc; + + LONG m_lHDeltaAccum; + LONG m_lVDeltaAccum; + + + static OleCallback sm_oleCallback; };
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.h Mon Dec 27 18:45:39 2010 +0300 +++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.h Tue Dec 28 17:13:13 2010 +0300 @@ -110,7 +110,7 @@ private: const CriticalSection& critSec; }; - friend Lock; + friend class Lock; private: CRITICAL_SECTION rep;