[haiku-commits] BRANCH midar-github.master - src/system/libroot/posix/glibc/stdio-common src/servers/app src/kits/app src/apps/icon-o-matic/shape headers/os/support

  • From: midar-github.master <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 25 Nov 2012 14:00:55 +0100 (CET)

added 2 changesets to branch 'refs/remotes/midar-github/master'
old head: 285f1d0b9ca4f4ee9caf1823cbc25e23bea817ae
new head: 9e7c4b1954922f7f4ff1f31ccce02afaedb424f6
overview: https://github.com/Midar/haiku/compare/285f1d0...9e7c4b1

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

edaf1d6: StackOrHeapArray: Add cast operator.

9e7c4b1: Improve nested function emulation hack.

                                     [ Jonathan Schleifer <js@xxxxxxxxxxx> ]

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

7 files changed, 33 insertions(+), 38 deletions(-)
headers/os/support/StackOrHeapArray.h            |  7 +---
src/apps/fontdemo/FontDemoView.cpp               |  3 +-
src/apps/icon-o-matic/shape/PathManipulator.cpp  |  2 +-
src/kits/app/ServerLink.cpp                      |  7 ++--
src/kits/support/ArchivingManagers.cpp           |  4 +--
src/servers/app/ServerApp.cpp                    | 11 +++---
.../libroot/posix/glibc/stdio-common/printf_fp.c | 37 +++++++++++---------

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

Commit:      edaf1d6d3772389ac7cc2a4dace6414d2af71f1c
Author:      Jonathan Schleifer <js@xxxxxxxxxxx>
Date:        Sun Nov 25 12:29:22 2012 UTC

StackOrHeapArray: Add cast operator.

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

diff --git a/headers/os/support/StackOrHeapArray.h 
b/headers/os/support/StackOrHeapArray.h
index a231a95..af40bf0 100644
--- a/headers/os/support/StackOrHeapArray.h
+++ b/headers/os/support/StackOrHeapArray.h
@@ -29,12 +29,7 @@ public:
                return fData != NULL;
        }
 
-       Type& operator[](size_t index)
-       {
-               return fData[index];
-       }
-
-       Type* operator()()
+       operator Type*()
        {
                return fData;
        }
diff --git a/src/apps/fontdemo/FontDemoView.cpp 
b/src/apps/fontdemo/FontDemoView.cpp
index da27677..ec1ab54 100644
--- a/src/apps/fontdemo/FontDemoView.cpp
+++ b/src/apps/fontdemo/FontDemoView.cpp
@@ -105,8 +105,7 @@ FontDemoView::_DrawView(BView* view)
        if (OutLineLevel())
                fFont.GetGlyphShapes(fString, size, fShapes);
        else
-               fFont.GetBoundingBoxesAsGlyphs(fString, size, B_SCREEN_METRIC,
-                       boundBoxes());
+               fFont.GetBoundingBoxesAsGlyphs(fString, size, B_SCREEN_METRIC, 
boundBoxes);
 
        float escapementArray[size];
        //struct escapement_delta escapeDeltas[size];
diff --git a/src/apps/icon-o-matic/shape/PathManipulator.cpp 
b/src/apps/icon-o-matic/shape/PathManipulator.cpp
index 32002d5..81f3f75 100644
--- a/src/apps/icon-o-matic/shape/PathManipulator.cpp
+++ b/src/apps/icon-o-matic/shape/PathManipulator.cpp
@@ -1716,7 +1716,7 @@ PathManipulator::_Nudge(BPoint direction)
                                                           
&points[i].connected);
                }
 
-               fNudgeCommand = new NudgePointsCommand(fPath, indices, 
points(), count);
+               fNudgeCommand = new NudgePointsCommand(fPath, indices, points, 
count);
 
                fNudgeCommand->SetNewTranslation(fNudgeOffset);
                fNudgeCommand->Redo();
diff --git a/src/kits/app/ServerLink.cpp b/src/kits/app/ServerLink.cpp
index 855ea6c..bdfd651 100644
--- a/src/kits/app/ServerLink.cpp
+++ b/src/kits/app/ServerLink.cpp
@@ -15,7 +15,6 @@
 
 #include <stdlib.h>
 #include <string.h>
-
 #include <new>
 
 #include <Gradient.h>
@@ -100,13 +99,13 @@ ServerLink::ReadShape(BShape* shape)
 
        BStackOrHeapArray<uint32, 64> opList(opCount);
        if (opCount > 0)
-               fReceiver->Read(opList(), opCount * sizeof(uint32));
+               fReceiver->Read(opList, opCount * sizeof(uint32));
 
        BStackOrHeapArray<BPoint, 64> ptList(ptCount);
        if (ptCount > 0)
-               fReceiver->Read(ptList(), ptCount * sizeof(BPoint));
+               fReceiver->Read(ptList, ptCount * sizeof(BPoint));
 
-       shape->SetData(opCount, ptCount, opList(), ptList());
+       shape->SetData(opCount, ptCount, opList, ptList);
        return B_OK;
 }
 
diff --git a/src/kits/support/ArchivingManagers.cpp 
b/src/kits/support/ArchivingManagers.cpp
index 1a0051d..1524d24 100644
--- a/src/kits/support/ArchivingManagers.cpp
+++ b/src/kits/support/ArchivingManagers.cpp
@@ -8,13 +8,11 @@
 
 #include "ArchivingManagers.h"
 
+#include <syslog.h>
 #include <typeinfo>
 
 #include <StackOrHeapArray.h>
 
-#include <syslog.h>
-
-
 namespace BPrivate {
 namespace Archiving {
        const char* kArchivableField = "_managed_archivable";
diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp
index 806afc6..4e410f7 100644
--- a/src/servers/app/ServerApp.cpp
+++ b/src/servers/app/ServerApp.cpp
@@ -22,12 +22,11 @@
 
 #include "ServerApp.h"
 
+#include <new>
 #include <stdio.h>
 #include <string.h>
 #include <syslog.h>
 
-#include <new>
-
 #include <AppDefs.h>
 #include <Autolock.h>
 #include <Debug.h>
@@ -1880,7 +1879,7 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                }
 
                                fLink.StartMessage(B_OK);
-                               fLink.Attach(widthArray(), numStrings * 
sizeof(float));
+                               fLink.Attach(widthArray, numStrings * 
sizeof(float));
                        } else
                                fLink.StartMessage(B_BAD_VALUE);
 
@@ -2508,9 +2507,9 @@ ServerApp::_DispatchMessage(int32 code, 
BPrivate::LinkReceiver& link)
                                font.SetFlags(flags);
 
                                if 
(font.GetBoundingBoxesForStrings(stringArray, lengthArray,
-                                       numStrings, rectArray(), mode, 
deltaArray) == B_OK) {
+                                       numStrings, rectArray, mode, 
deltaArray) == B_OK) {
                                        fLink.StartMessage(B_OK);
-                                       fLink.Attach(rectArray(), numStrings * 
sizeof(BRect));
+                                       fLink.Attach(rectArray, numStrings * 
sizeof(BRect));
                                        success = true;
                                }
                        }
@@ -3276,7 +3275,7 @@ ServerApp::_CreateWindow(int32 code, 
BPrivate::LinkReceiver& link,
        // 7) int32 BHandler token of the window
        // 8) port_id window's reply port
        // 9) port_id window's looper port
-       // 10) const char* title
+       // 10) const char * title
 
        BRect frame;
        int32 bitmapToken;

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

Commit:      9e7c4b1954922f7f4ff1f31ccce02afaedb424f6
Author:      Jonathan Schleifer <js@xxxxxxxxxxx>
Date:        Sun Nov 25 12:55:37 2012 UTC

Improve nested function emulation hack.

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

diff --git a/src/system/libroot/posix/glibc/stdio-common/printf_fp.c 
b/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
index 7009741..d22c731 100644
--- a/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
+++ b/src/system/libroot/posix/glibc/stdio-common/printf_fp.c
@@ -38,7 +38,6 @@
 #include <limits.h>
 #include <math.h>
 #include <printf.h>
-#include <setjmp.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -202,13 +201,13 @@ __printf_fp (FILE *fp,
   int wide = info->wide;
 
   wchar_t hack_digit_ret;
-  jmp_buf hack_digit_caller;
+  int hack_digit_callee;
 
   while (0)
     {
       mp_limb_t hi;
-hack_digit:
 
+hack_digit:
       if (expsign != 0 && type == 'f' && exponent-- > 0)
        hi = 0;
       else if (scalesize == 0)
@@ -247,7 +246,13 @@ hack_digit:
 
       hack_digit_ret = L'0' + hi;
 hack_digit_end:
-      longjmp(hack_digit_caller, 1);
+      switch (hack_digit_callee)
+        {
+         case 1: goto hack_digit_callee1;
+         case 2: goto hack_digit_callee2;
+         case 3: goto hack_digit_callee3;
+         default: abort();
+       }
     }
 
 
@@ -891,10 +896,10 @@ hack_digit_end:
        while (intdig_no < intdig_max)
          {
            ++intdig_no;
-           if (setjmp(hack_digit_caller))
-             *wcp++ = hack_digit_ret;
-           else
-             goto hack_digit;
+           hack_digit_callee = 1;
+           goto hack_digit;
+hack_digit_callee1:
+           *wcp++ = hack_digit_ret;
          }
        significant = 1;
        if (info->alt
@@ -916,10 +921,10 @@ hack_digit_end:
           || (fracdig_no < fracdig_max && (fracsize > 1 || frac[0] != 0)))
       {
        ++fracdig_no;
-       if (setjmp(hack_digit_caller))
-         *wcp++ = hack_digit_ret;
-       else
-         goto hack_digit;
+       hack_digit_callee = 2;
+       goto hack_digit;
+hack_digit_callee2:
+       *wcp++ = hack_digit_ret;
        if (*wcp != L'0')
          significant = 1;
        else if (significant == 0)
@@ -932,10 +937,10 @@ hack_digit_end:
       }
 
     /* Do rounding.  */
-    if (setjmp(hack_digit_caller))
-      digit = hack_digit_ret;
-    else
-      goto hack_digit;
+    hack_digit_callee = 3;
+    goto hack_digit;
+hack_digit_callee3:
+    digit = hack_digit_ret;
     if (digit > L'4')
       {
        wchar_t *wtp = wcp;


Other related posts: