[haiku-commits] BRANCH xyzzy-github.x86_64 - src/kits/interface src/kits/app headers/os/interface

  • From: xyzzy-github.x86_64 <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 10 Aug 2012 17:49:20 +0200 (CEST)

added 1 changeset to branch 'refs/remotes/xyzzy-github/x86_64'
old head: 6d796a84bd484ccc4fb072a29c663b660180ae51
new head: ac4525b2a5a2f3fa3805efaf0c61f88fe1ff1e30

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

ac4525b: Changed BRegion to use int32 instead of long.
  
  There is no need for fCount and fDataSize to be long, not going to have
  more than 2^32 rectangles in a region. Thanks Axel for pointing that
  out.

                                      [ Alex Smith <alex@xxxxxxxxxxxxxxxx> ]

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

Commit:      ac4525b2a5a2f3fa3805efaf0c61f88fe1ff1e30

Author:      Alex Smith <alex@xxxxxxxxxxxxxxxx>
Date:        Fri Aug 10 15:22:51 2012 UTC

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

4 files changed, 10 insertions(+), 10 deletions(-)
headers/os/interface/Region.h |    6 +++---
src/kits/app/LinkReceiver.cpp |    2 +-
src/kits/app/ServerLink.cpp   |    4 ++--
src/kits/interface/Region.cpp |    8 ++++----

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

diff --git a/headers/os/interface/Region.h b/headers/os/interface/Region.h
index 55d8252..b7747f7 100644
--- a/headers/os/interface/Region.h
+++ b/headers/os/interface/Region.h
@@ -85,7 +85,7 @@ private:
                                                                BRegion(const 
clipping_rect& rect);
 
                        void                            
_AdoptRegionData(BRegion& region);
-                       bool                            _SetSize(long newSize);
+                       bool                            _SetSize(int32 newSize);
 
                        clipping_rect           _Convert(const BRect& rect) 
const;
                        clipping_rect           _ConvertToInternal(const BRect& 
rect) const;
@@ -93,8 +93,8 @@ private:
                                                                        const 
clipping_rect& rect) const;
 
 private:
-                       long                            fCount;
-                       long                            fDataSize;
+                       int32                           fCount;
+                       int32                           fDataSize;
                        clipping_rect           fBounds;
                        clipping_rect*          fData;
 };
diff --git a/src/kits/app/LinkReceiver.cpp b/src/kits/app/LinkReceiver.cpp
index 91f42fb..4928500 100644
--- a/src/kits/app/LinkReceiver.cpp
+++ b/src/kits/app/LinkReceiver.cpp
@@ -443,7 +443,7 @@ err:
 status_t
 LinkReceiver::ReadRegion(BRegion* region)
 {
-       status_t status = Read(&region->fCount, sizeof(long));
+       status_t status = Read(&region->fCount, sizeof(int32));
        if (status >= B_OK)
                status = Read(&region->fBounds, sizeof(clipping_rect));
        if (status >= B_OK) {
diff --git a/src/kits/app/ServerLink.cpp b/src/kits/app/ServerLink.cpp
index 2c1b2af..ea7664a 100644
--- a/src/kits/app/ServerLink.cpp
+++ b/src/kits/app/ServerLink.cpp
@@ -62,7 +62,7 @@ ServerLink::SetTo(port_id sender, port_id receiver)
 status_t
 ServerLink::ReadRegion(BRegion* region)
 {
-       fReceiver->Read(&region->fCount, sizeof(long));
+       fReceiver->Read(&region->fCount, sizeof(int32));
        if (region->fCount > 0) {
                fReceiver->Read(&region->fBounds, sizeof(clipping_rect));
                if (!region->_SetSize(region->fCount))
@@ -78,7 +78,7 @@ ServerLink::ReadRegion(BRegion* region)
 status_t
 ServerLink::AttachRegion(const BRegion& region)
 {
-       fSender->Attach(&region.fCount, sizeof(long));
+       fSender->Attach(&region.fCount, sizeof(int32));
        if (region.fCount > 0) {
                fSender->Attach(&region.fBounds, sizeof(clipping_rect));
                return fSender->Attach(region.fData,
diff --git a/src/kits/interface/Region.cpp b/src/kits/interface/Region.cpp
index d44529e..d2d0604 100644
--- a/src/kits/interface/Region.cpp
+++ b/src/kits/interface/Region.cpp
@@ -330,9 +330,9 @@ BRegion::PrintToStream() const
 {
        Frame().PrintToStream();
 
-       for (long i = 0; i < fCount; i++) {
+       for (int32 i = 0; i < fCount; i++) {
                clipping_rect *rect = &fData[i];
-               printf("data[%ld] = BRect(l:%" B_PRId32 ".0, t:%" B_PRId32
+               printf("data[%" B_PRId32 "] = BRect(l:%" B_PRId32 ".0, t:%" 
B_PRId32
                        ".0, r:%" B_PRId32 ".0, b:%" B_PRId32 ".0)\n",
                        i, rect->left, rect->top, rect->right - 1, rect->bottom 
- 1);
        }
@@ -361,7 +361,7 @@ BRegion::OffsetBy(int32 x, int32 y)
 
        if (fCount > 0) {
                if (fData != &fBounds) {
-                       for (long i = 0; i < fCount; i++)
+                       for (int32 i = 0; i < fCount; i++)
                                offset_rect(fData[i], x, y);
                }
 
@@ -545,7 +545,7 @@ BRegion::_AdoptRegionData(BRegion& region)
                able to hold.
 */
 bool
-BRegion::_SetSize(long newSize)
+BRegion::_SetSize(int32 newSize)
 {
        // we never shrink the size
        newSize = max_c(fDataSize, newSize);


Other related posts:

  • » [haiku-commits] BRANCH xyzzy-github.x86_64 - src/kits/interface src/kits/app headers/os/interface - xyzzy-github . x86_64