[haiku-commits] haiku: hrev47795 - in src: servers/registrar tests/kits/interface/picture kits/shared

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 2 Sep 2014 10:16:08 +0200 (CEST)

hrev47795 adds 4 changesets to branch 'master'
old head: 90520f9b43eb2e11829fdf27c269b22f421b8e63
new head: ab280d4400aa59d810903fdc31daa80512ec1523
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ab280d4+%5E90520f9

----------------------------------------------------------------------------

b367d3a: registrar ClipboardHandler: Style fixes.

dc83a48: Make TargetLibstdc++ work for libbe_test target
  
  Needed for the test_app_server.
  The logic here may need some improvements, but I'm not sure how to find
  the right library name in all cases. I fixed at least the x86_gcc2 case
  here.

e94bd48: Fix "strict aliasing rules" warnings
  
  Treated as errors when trying to build the test_app_server for x86_64.

ab280d4: Fix SVGView test build (missing strings.h include)

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

5 files changed, 72 insertions(+), 58 deletions(-)
build/jam/SystemLibraryRules                     |   4 +
headers/os/interface/GraphicsDefs.h              |   4 +-
src/kits/shared/SHA256.cpp                       |   4 +-
src/servers/registrar/ClipboardHandler.cpp       | 116 ++++++++++---------
src/tests/kits/interface/picture/SVGViewView.cpp |   2 +

############################################################################

Commit:      b367d3a77c82d510f1ba2795e4c5b4e58b54809f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b367d3a
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Sep  2 07:47:53 2014 UTC

registrar ClipboardHandler: Style fixes.

----------------------------------------------------------------------------

diff --git a/src/servers/registrar/ClipboardHandler.cpp 
b/src/servers/registrar/ClipboardHandler.cpp
index f134b4b..52f8def 100644
--- a/src/servers/registrar/ClipboardHandler.cpp
+++ b/src/servers/registrar/ClipboardHandler.cpp
@@ -17,10 +17,12 @@
 #include <map>
 #include <string>
 
+
 using std::map;
 using std::string;
 using namespace BPrivate;
 
+
 /*!
        \class ClipboardHandler
        \brief Handles all clipboard related requests.
@@ -28,6 +30,7 @@ using namespace BPrivate;
 
 struct ClipboardHandler::ClipboardMap : map<string, Clipboard*> {};
 
+
 // constructor
 /*!    \brief Creates and initializes a ClipboardHandler.
 */
@@ -37,18 +40,19 @@ ClipboardHandler::ClipboardHandler()
 {
 }
 
+
 // destructor
 /*!    \brief Frees all resources associate with this object.
 */
 ClipboardHandler::~ClipboardHandler()
 {
        for (ClipboardMap::iterator it = fClipboards->begin();
-                it != fClipboards->end();
-                ++it) {
+               it != fClipboards->end();
+               ++it)
                delete it->second;
-       }
 }
 
+
 // MessageReceived
 /*!    \brief Overrides the super class version to handle the clipboard 
specific
                   messages.
@@ -64,32 +68,32 @@ ClipboardHandler::MessageReceived(BMessage *message)
                {
                        status_t result = B_BAD_VALUE;
 
-                       if (message->FindString("name", &name) == B_OK) {
-                               if (_GetClipboard(name))
-                                       result = B_OK;
-                       }
+                       if (message->FindString("name", &name) == B_OK) {
+                               if (_GetClipboard(name))
+                                       result = B_OK;
+                       }
 
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", result);
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                case B_REG_GET_CLIPBOARD_COUNT:
                {
                        status_t result = B_BAD_VALUE;
 
-                       if (message->FindString("name", &name) == B_OK) {
-                               if (Clipboard *clipboard = _GetClipboard(name)) 
{
+                       if (message->FindString("name", &name) == B_OK) {
+                               if (Clipboard *clipboard = _GetClipboard(name)) 
{
                                        reply.AddInt32("count", 
clipboard->Count());
-                                       result = B_OK;
-                               }
-                       }
+                                       result = B_OK;
+                               }
+                       }
 
                        reply.AddInt32("result", result);
                        reply.what = B_REG_RESULT;
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                case B_REG_CLIPBOARD_START_WATCHING:
@@ -97,17 +101,17 @@ ClipboardHandler::MessageReceived(BMessage *message)
                        status_t result = B_BAD_VALUE;
 
                        BMessenger target;
-                       if (message->FindString("name", &name) == B_OK
-                               && message->FindMessenger("target", &target) == 
B_OK) {
-                               Clipboard *clipboard = _GetClipboard(name);
-                               if (clipboard && clipboard->AddWatcher(target))
-                                       result = B_OK;
-                       }
+                       if (message->FindString("name", &name) == B_OK
+                               && message->FindMessenger("target", &target) == 
B_OK) {
+                               Clipboard *clipboard = _GetClipboard(name);
+                               if (clipboard && clipboard->AddWatcher(target))
+                                       result = B_OK;
+                       }
 
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", result);
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                case B_REG_CLIPBOARD_STOP_WATCHING:
@@ -115,37 +119,37 @@ ClipboardHandler::MessageReceived(BMessage *message)
                        status_t result = B_BAD_VALUE;
 
                        BMessenger target;
-                       if (message->FindString("name", &name) == B_OK
-                               && message->FindMessenger("target", &target) == 
B_OK) {
-                               Clipboard *clipboard = _GetClipboard(name);
-                               if (clipboard && 
clipboard->RemoveWatcher(target))
-                                       result = B_OK;
-                       }
+                       if (message->FindString("name", &name) == B_OK
+                               && message->FindMessenger("target", &target) == 
B_OK) {
+                               Clipboard *clipboard = _GetClipboard(name);
+                               if (clipboard && 
clipboard->RemoveWatcher(target))
+                                       result = B_OK;
+                       }
 
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", result);
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                case B_REG_DOWNLOAD_CLIPBOARD:
                {
                        status_t result = B_BAD_VALUE;
 
-                       if (message->FindString("name", &name) == B_OK) {
-                               Clipboard *clipboard = _GetClipboard(name);
-                               if (clipboard) {
+                       if (message->FindString("name", &name) == B_OK) {
+                               Clipboard *clipboard = _GetClipboard(name);
+                               if (clipboard) {
                                        reply.AddMessage("data", 
clipboard->Data());
                                        reply.AddMessenger("data source", 
clipboard->DataSource());
                                        reply.AddInt32("count", 
clipboard->Count());
-                                       result = B_OK;
-                               }
-                       }
+                                       result = B_OK;
+                               }
+                       }
 
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", result);
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                case B_REG_UPLOAD_CLIPBOARD:
@@ -154,31 +158,32 @@ ClipboardHandler::MessageReceived(BMessage *message)
 
                        BMessage data;
                        BMessenger source;
-                       if (message->FindString("name", &name) == B_OK
-                               && message->FindMessenger("data source", 
&source) == B_OK
-                               && message->FindMessage("data", &data) == B_OK) 
{
-                               Clipboard *clipboard = _GetClipboard(name);
-                               if (clipboard) {
-                                       int32 localCount;
-                                       bool failIfChanged;
-                                       if (message->FindInt32("count", 
&localCount) == B_OK
-                                               && message->FindBool("fail if 
changed", &failIfChanged) == B_OK
-                                               && failIfChanged
-                                               && localCount != 
clipboard->Count()) {
-                                               // atomic support
-                                               result = B_ERROR;
-                                       } else {
-                                               clipboard->SetData(&data, 
source);
+                       if (message->FindString("name", &name) == B_OK
+                               && message->FindMessenger("data source", 
&source) == B_OK
+                               && message->FindMessage("data", &data) == B_OK) 
{
+                               Clipboard *clipboard = _GetClipboard(name);
+                               if (clipboard) {
+                                       int32 localCount;
+                                       bool failIfChanged;
+                                       if (message->FindInt32("count", 
&localCount) == B_OK
+                                               && message->FindBool("fail if 
changed", &failIfChanged)
+                                                       == B_OK
+                                               && failIfChanged
+                                               && localCount != 
clipboard->Count()) {
+                                               // atomic support
+                                               result = B_ERROR;
+                                       } else {
+                                               clipboard->SetData(&data, 
source);
                                                result = 
reply.AddInt32("count", clipboard->Count());
-                                               result = B_OK;
-                                       }
-                               }
-                       }
+                                               result = B_OK;
+                                       }
+                               }
+                       }
 
                        reply.what = B_REG_RESULT;
                        reply.AddInt32("result", result);
                        message->SendReply(&reply);
-                       break;
+                       break;
                }
 
                default:
@@ -187,6 +192,7 @@ ClipboardHandler::MessageReceived(BMessage *message)
        }
 }
 
+
 /*!    \brief Gets the clipboard with the specified name, or adds it, if not 
yet
                   existent.
 

############################################################################

Commit:      dc83a48d25ff67d1aaf0f8be73d4fa4d6fca52ec
URL:         http://cgit.haiku-os.org/haiku/commit/?id=dc83a48
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Sep  2 08:05:02 2014 UTC

Make TargetLibstdc++ work for libbe_test target

Needed for the test_app_server.
The logic here may need some improvements, but I'm not sure how to find
the right library name in all cases. I fixed at least the x86_gcc2 case
here.

----------------------------------------------------------------------------

diff --git a/build/jam/SystemLibraryRules b/build/jam/SystemLibraryRules
index 954c4f0..3ef5e90 100644
--- a/build/jam/SystemLibraryRules
+++ b/build/jam/SystemLibraryRules
@@ -36,6 +36,10 @@ rule TargetLibstdc++ asPath
                        BuildFeatureAttribute gcc_syslibs : libstdc++.so : 
$(flags)
                ] ;
        } else {
+               if $(TARGET_PLATFORM) = libbe_test {
+                       # Use the existing host library
+                       return stdc++.r4 ;
+               }
                # TODO: return libstdc++.so for non-Haiku target platform if 
needed
        }
 }

############################################################################

Commit:      e94bd4810ebb840710f01074399cc79113f9bc7a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e94bd48
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Sep  2 08:12:47 2014 UTC

Fix "strict aliasing rules" warnings

Treated as errors when trying to build the test_app_server for x86_64.

----------------------------------------------------------------------------

diff --git a/headers/os/interface/GraphicsDefs.h 
b/headers/os/interface/GraphicsDefs.h
index db96b95..5e970c0 100644
--- a/headers/os/interface/GraphicsDefs.h
+++ b/headers/os/interface/GraphicsDefs.h
@@ -19,7 +19,9 @@ typedef struct pattern {
 inline bool
 operator==(const pattern& a, const pattern& b)
 {
-       return (*(uint64*)a.data == *(uint64*)b.data);
+       uint64* pa = (uint64*)a.data;
+       uint64* pb = (uint64*)b.data;
+       return (*pa == *pb);
 }
 
 
diff --git a/src/kits/shared/SHA256.cpp b/src/kits/shared/SHA256.cpp
index 60e154d..c3fe936 100644
--- a/src/kits/shared/SHA256.cpp
+++ b/src/kits/shared/SHA256.cpp
@@ -114,8 +114,8 @@ SHA256::Digest()
                }
 
                // write the (big-endian) message size in bits
-               *(uint64*)((uint8*)fBuffer + kChunkSize - 8)
-                       = B_HOST_TO_BENDIAN_INT64((uint64)fMessageSize * 8);
+               uint64* target = (uint64*)((uint8*)fBuffer + kChunkSize - 8);
+               *target = B_HOST_TO_BENDIAN_INT64((uint64)fMessageSize * 8);
 
                _ProcessChunk();
 

############################################################################

Revision:    hrev47795
Commit:      ab280d4400aa59d810903fdc31daa80512ec1523
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ab280d4
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Tue Sep  2 08:14:50 2014 UTC

Fix SVGView test build (missing strings.h include)

----------------------------------------------------------------------------

diff --git a/src/tests/kits/interface/picture/SVGViewView.cpp 
b/src/tests/kits/interface/picture/SVGViewView.cpp
index 3daf810..5164637 100755
--- a/src/tests/kits/interface/picture/SVGViewView.cpp
+++ b/src/tests/kits/interface/picture/SVGViewView.cpp
@@ -8,6 +8,8 @@
 
 
 #include "SVGViewView.h"
+
+#include <strings.h>
 
 
 named_color colors[] = {


Other related posts:

  • » [haiku-commits] haiku: hrev47795 - in src: servers/registrar tests/kits/interface/picture kits/shared - pulkomandy