OSDN Git Service

Fix check for pointer/value by using bit-shift instead of a cast
authorKimmo Varis <kimmov@gmail.com>
Fri, 22 Sep 2006 18:57:08 +0000 (18:57 +0000)
committerKimmo Varis <kimmov@gmail.com>
Fri, 22 Sep 2006 18:57:08 +0000 (18:57 +0000)
Src/Changes.txt
Src/GhostTextBuffer.h
Src/editlib/ccrystaltextbuffer.h

index 7fb396b..e74e1b5 100644 (file)
@@ -17,6 +17,9 @@ Add new items to top.
   Src: DiffList.cpp
  Some SPECIAL_ITEM_POS cleanups
   Src: DirActions.cpp DirDoc.cpp DirView.cpp DirView.h
+ Fix check for pointer/value by using bit-shift instead of a cast
+  Src: GhostTextBuffer.h
+  Src/editlib: ccrystaltextbuffer.h
 
 2006-09-21 WinMerge experimental release 2.5.7.1 (SVN revision 3600)
 
index 35000da..d392897 100644 (file)
@@ -176,8 +176,10 @@ public :
 
                LPCTSTR GetText () const
                {
-                       // see the m_szText/m_pszText definition about the use of HIWORD
-                       if (HIWORD ((DWORD) m_pszText) != 0)
+                       // See the m_szText/m_pszText definition
+                       // Check if m_pszText is a pointer by removing bits having
+                       // possible char value
+                       if (((INT_PTR)m_pszText >> 16) != 0)
                                return m_pszText;
                        return m_szText;
                };
index 38cb527..048b474 100644 (file)
@@ -211,8 +211,10 @@ public :
 
         LPCTSTR GetText () const
         {
-          // see the m_szText/m_pszText definition about the use of HIWORD
-          if (HIWORD ((DWORD) m_pszText) != 0)
+          // See the m_szText/m_pszText definition
+          // Check if m_pszText is a pointer by removing bits having
+          // possible char value
+          if (((INT_PTR)m_pszText >> 16) != 0)
             return m_pszText;
           return m_szText;
         };