[haiku-commits] haiku: hrev50057 - src/bin/addattr data/system/data/licenses src/kits/interface src/tests/kits/storage

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 28 Jan 2016 01:47:46 +0100 (CET)

hrev50057 adds 5 changesets to branch 'master'
old head: de4b1dede1d53ff01585d2bd9087ebafdbb8e582
new head: 00bb5b5957b27c7d1ac389a309a8a8688c178c48
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=00bb5b5957b2+%5Ede4b1dede1d5

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

a83b9383fafd: Zlib license: Make it generic like the other licenses.
  
  Fixes #12619.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

7beac31fbc0e: addattr: Fix some deficiencies.
  
  The addattr didn't quite match its help text, wrt the kinds of values one can
  use for type codes. Aside from the list of named types (which isn't actually
  quite complete compared to the choices in the source) the help said one can
  enter "numeric values", and gives both hex and decimal examples.
  
  However, trying a hex value didn't work -- only decimal numbers were accepted.
  This turned out to be because the sscanf format option is "%u" (actually
  B_SCNu32) which only handles decimal. It has to be B_SCNi32 (which means it
  would be allowed to enter a negative value -- just not very sensible...) The
  other example entry given is " 'ABCD' ", which apparently is meant to indicate
  that one can enter 'FourCC' direct type-code representations, but of course
  that wouldn't work as shown because the shell strips off the quotes. Escaping
  the quotes -- \'ABCD\' -- or adding a second layer -- "'ABCD'" -- does work
  but is not obvious. (I can't think of any other command line that requires
  such a convention.)
  
  I have added another option: "-c ABCD". The current way can
  still work, but the new option should be fairly evident to anyone.
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>
  Fixes #12562.

                                [ Pete Goodeve <pete.goodeve@xxxxxxxxxxxx> ]

220f79d835ee: Deskbar TimeView Text Render Fix
  
  Erroneous use of SetLowUIColor(ViewUIColor()) when the old API was more
  appropriate resulted in the tint value being ignored which resulted in some
  text rendering issues with certain color combinations and LCD subpixel 
aliasing.
  
  Fixes ticket# 12596
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

                                        [ looncraz <looncraz@xxxxxxxxxxxx> ]

3e08f2160607: MenuField Low Color (for frame)
  
  BMenuField's frame is drawn from the LowColor() which is adopted from its
  parent.  However, we should be adopting the parent's view color for our low
  color, otherwise we sometimes end up with a miscolored border (most often 
white).
  
  This was not noticed earlier as most views have matching view and low colors.
  
  Fixes ticket #12603
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

                                        [ looncraz <looncraz@xxxxxxxxxxxx> ]

00bb5b5957b2: unitests: fix the symlink to the resources directory
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

                                  [ Kostadin Damyanov <maxmight@xxxxxxxxx> ]

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

5 files changed, 80 insertions(+), 50 deletions(-)
data/system/data/licenses/Zlib   | 40 +++++++++-------------
src/apps/deskbar/TimeView.cpp    |  2 +-
src/bin/addattr/main.cpp         | 65 +++++++++++++++++++++++++-----------
src/kits/interface/MenuField.cpp | 19 +++++++++--
src/tests/kits/storage/Jamfile   |  4 +--

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

Commit:      a83b9383fafdc5f633366ae32bd23f197515c91e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a83b9383fafd
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Thu Jan 28 00:25:10 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12619

Zlib license: Make it generic like the other licenses.

Fixes #12619.

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

diff --git a/data/system/data/licenses/Zlib b/data/system/data/licenses/Zlib
index 125f989..4c850a1 100644
--- a/data/system/data/licenses/Zlib
+++ b/data/system/data/licenses/Zlib
@@ -1,29 +1,19 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.3, July 18th, 2005
+The Zlib License
 
-  Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
+Copyright (c) <year> <copyright holders>
 
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
 
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
 
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  Jean-loup Gailly        Mark Adler
-  jloup@xxxxxxxx          madler@xxxxxxxxxxxxxxxxxx
-
-
-  The data format used by the zlib library is described by RFCs (Request for
-  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
-  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-*/
\ No newline at end of file
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software. If you use this software
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.

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

Commit:      7beac31fbc0e6cf29ada2dd64dcd6548677f000b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=7beac31fbc0e
Author:      Pete Goodeve <pete.goodeve@xxxxxxxxxxxx>
Date:        Thu Jan 28 00:38:09 2016 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Jan 28 00:38:09 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12562

addattr: Fix some deficiencies.

The addattr didn't quite match its help text, wrt the kinds of values one can
use for type codes. Aside from the list of named types (which isn't actually
quite complete compared to the choices in the source) the help said one can
enter "numeric values", and gives both hex and decimal examples.

However, trying a hex value didn't work -- only decimal numbers were accepted.
This turned out to be because the sscanf format option is "%u" (actually
B_SCNu32) which only handles decimal. It has to be B_SCNi32 (which means it
would be allowed to enter a negative value -- just not very sensible...) The
other example entry given is " 'ABCD' ", which apparently is meant to indicate
that one can enter 'FourCC' direct type-code representations, but of course
that wouldn't work as shown because the shell strips off the quotes. Escaping
the quotes -- \'ABCD\' -- or adding a second layer -- "'ABCD'" -- does work
but is not obvious. (I can't think of any other command line that requires
such a convention.)

I have added another option: "-c ABCD". The current way can
still work, but the new option should be fairly evident to anyone.

Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Fixes #12562.

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

diff --git a/src/bin/addattr/main.cpp b/src/bin/addattr/main.cpp
index d1994ac..1f03d40 100644
--- a/src/bin/addattr/main.cpp
+++ b/src/bin/addattr/main.cpp
@@ -90,12 +90,14 @@ typeForString(const char* string, type_code* _result)
                }
        }
 
-       // type didn't show up - in this case, we parse the string
-       // as number and use it directly as type code
+       // type didn't show up - in this case, we try to parse
+       // the string as number and use it directly as type code
 
-       if (sscanf(string, "%" B_SCNu32, _result) == 1)
+       if (sscanf(string, "%" B_SCNi32, _result) == 1)
                return B_OK;
 
+       // if that didn't work, try the string as a char-type-code
+       // enclosed in single quotes
        uchar type[4];
        if (sscanf(string, "'%c%c%c%c'", &type[0], &type[1], &type[2], 
&type[3]) == 4) {
                *_result = (type[0] << 24) | (type[1] << 16) | (type[2] << 8) | 
type[3];
@@ -109,13 +111,17 @@ typeForString(const char* string, type_code* _result)
 void
 usage(int returnValue)
 {
-       fprintf(stderr, "usage: %s [-t type] [ -P ] attr value file1 
[file2...]\n"
-               "   or: %s [-f value-from-file] [-t type] [ -P ] attr file1 
[file2...]\n\n"
+       fprintf(stderr, "usage: %s [-t type|-c code] [ -P ] attr value file1 
[file2...]\n"
+               "   or: %s [-f value-from-file] [-t type|-c code] [ -P ] attr 
file1 [file2...]\n\n"
                "\t-P : Don't resolve links\n"
-               "\tType is one of:\n"
-               "\t\tstring, mime, int, llong, float, double, bool, time, icon, 
raw\n"
-               "\t\tor a numeric value (ie. 0x1234, 42, 'ABCD', ...)\n"
-               "\tThe default is \"string\"\n", kProgramName, kProgramName);
+               "\tThe '-t' and '-c' options are alternatives; use one or the 
other.\n"
+               "\ttype is one of:\n"
+               "\t\tstring, mime, int, int32, uint32, llong, int64, uint64,\n"
+               "\t\tfloat, double, bool, icon, time, raw\n"
+               "\t\tor a numeric value (ie. 0x1234, 42, ...),\n"
+               "\t\tor an escape-quoted type code, eg. \\'MICN\\'\n"
+               "\tThe default is \"string\"\n"
+               "\tcode is a four-char type ID (eg. MICN)\n", kProgramName, 
kProgramName);
 
        exit(returnValue);
 }
@@ -126,9 +132,21 @@ invalidAttrType(const char* attrTypeName)
 {
        fprintf(stderr, "%s: attribute type \"%s\" is not valid\n", 
kProgramName,
                attrTypeName);
-       fprintf(stderr, "\tTry one of: string, mime, int, llong, float, 
double,\n");
-       fprintf(stderr, "\t\tbool, time, icon, raw, or a numeric value (ie. 
0x1234, 42, 'ABCD'"
-               ", ...)\n");
+       fprintf(stderr, "\tTry one of: string, mime, int, llong, float, 
double,\n"
+               "\t\tbool, icon, time, raw, or a numeric value (ie. 0x1234, 42, 
...),\n"
+               "\t\tor a quoted type code, eg.: \\'MICN\\'\n"
+               "\t\tOr enter the actual type code with the '-c' option\n");
+
+       exit(1);
+}
+
+
+void
+invalidTypeCode(const char* attrTypeName)
+{
+       fprintf(stderr, "%s: attribute type code \"%s\" is not valid\n", 
kProgramName,
+               attrTypeName);
+       fprintf(stderr, "\tIt must be exactly four characters\n");
 
        exit(1);
 }
@@ -139,8 +157,8 @@ invalidBoolValue(const char* value)
 {
        fprintf(stderr, "%s: attribute value \"%s\" is not valid\n", 
kProgramName,
                value);
-       fprintf(stderr, "\tBool accepts: 0, f, false, disabled, off,\n");
-       fprintf(stderr, "\t\t1, t, true, enabled, on\n");
+       fprintf(stderr, "\tBool accepts: 0, f, false, disabled, off,\n"
+               "\t\t1, t, true, enabled, on\n");
 
        exit(1);
 }
@@ -155,7 +173,7 @@ main(int argc, char* argv[])
        bool resolveLinks = true;
 
        int c;
-       while ((c = getopt_long(argc, argv, "hf:t:P", kLongOptions, NULL)) != 
-1) {
+       while ((c = getopt_long(argc, argv, "hf:t:c:P", kLongOptions, NULL)) != 
-1) {
                switch (c) {
                        case 0:
                                break;
@@ -170,7 +188,7 @@ main(int argc, char* argv[])
                                                optarg, strerror(status));
                                        return 1;
                                }
-               
+
                                status = file.GetSize(&size);
                                if (status == B_OK) {
                                        if (size == 0) {
@@ -188,12 +206,12 @@ main(int argc, char* argv[])
                                        else
                                                status = B_NO_MEMORY;
                                }
-               
+
                                if (status < B_OK) {
                                        ERR("can't read attribute value: %s\n", 
strerror(status));
                                        return 1;
                                }
-               
+
                                valueFileLength = (size_t)size;
                                break;
                        }
@@ -202,6 +220,15 @@ main(int argc, char* argv[])
                                if (typeForString(optarg, &attrType) != B_OK)
                                        invalidAttrType(optarg);
                                break;
+                       case 'c':
+                               if (strlen(optarg) == 4) {
+                                       // Get the type code directly
+                                       char code[] = "'    '";
+                                       strncpy(code + 1, optarg, 4);
+                                       if (typeForString(code, &attrType) == 
B_OK)
+                                               break;
+                               }
+                               invalidTypeCode(optarg);
                        case 'P':
                                resolveLinks = false;
                                break;
@@ -213,7 +240,7 @@ main(int argc, char* argv[])
                                break;
                }
        }
-       
+
        if (argc - optind < 1)
                usage(1);
        const char* attrName = argv[optind++];

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

Commit:      220f79d835ee716c5ba41a026b466c0695e236be
URL:         http://cgit.haiku-os.org/haiku/commit/?id=220f79d835ee
Author:      looncraz <looncraz@xxxxxxxxxxxx>
Date:        Sun Jan 17 12:20:13 2016 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Jan 28 00:42:13 2016 UTC

Deskbar TimeView Text Render Fix

Erroneous use of SetLowUIColor(ViewUIColor()) when the old API was more
appropriate resulted in the tint value being ignored which resulted in some
text rendering issues with certain color combinations and LCD subpixel aliasing.

Fixes ticket# 12596

Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

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

diff --git a/src/apps/deskbar/TimeView.cpp b/src/apps/deskbar/TimeView.cpp
index 7c08034..25b54e6 100644
--- a/src/apps/deskbar/TimeView.cpp
+++ b/src/apps/deskbar/TimeView.cpp
@@ -152,7 +152,7 @@ TTimeView::Draw(BRect /*updateRect*/)
        PushState();
 
        SetHighColor(ViewColor());
-       SetLowUIColor(ViewUIColor());
+       SetLowColor(ViewColor());
        FillRect(Bounds());
        SetHighUIColor(B_MENU_ITEM_TEXT_COLOR);
 

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

Commit:      3e08f2160607185a7b85ba93d58537a8086fcca7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=3e08f2160607
Author:      looncraz <looncraz@xxxxxxxxxxxx>
Date:        Sun Jan 17 12:06:36 2016 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Jan 28 00:43:11 2016 UTC

Ticket:      https://dev.haiku-os.org/ticket/12603

MenuField Low Color (for frame)

BMenuField's frame is drawn from the LowColor() which is adopted from its
parent.  However, we should be adopting the parent's view color for our low
color, otherwise we sometimes end up with a miscolored border (most often 
white).

This was not noticed earlier as most views have matching view and low colors.

Fixes ticket #12603

Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

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

diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp
index 3318dad..62aa993 100644
--- a/src/kits/interface/MenuField.cpp
+++ b/src/kits/interface/MenuField.cpp
@@ -428,7 +428,20 @@ void
 BMenuField::AttachedToWindow()
 {
        CALLED();
-       AdoptParentColors();
+
+       // Our low color must match the parent's view color.
+       if (Parent() != NULL) {
+               AdoptParentColors();
+
+               float tint = B_NO_TINT;
+               color_which which = ViewUIColor(&tint);
+
+               if (which == B_NO_COLOR)
+                       SetLowColor(ViewColor());
+               else
+                       SetLowUIColor(which, tint);
+       } else
+               AdoptSystemColors();
 }
 
 
@@ -1065,7 +1078,7 @@ BMenuField::_DrawLabel(BRect updateRect)
                flags |= BControlLook::B_DISABLED;
 
        // save the current low color
-       const rgb_color lowColor = LowColor();
+       PushState();
        rgb_color textColor;
 
        MenuPrivate menuPrivate(fMenuBar);
@@ -1082,7 +1095,7 @@ BMenuField::_DrawLabel(BRect updateRect)
                BAlignment(fAlign, B_ALIGN_MIDDLE), &textColor);
 
        // restore the previous low color
-       SetLowColor(lowColor);
+       PopState();
 }
 
 

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

Revision:    hrev50057
Commit:      00bb5b5957b27c7d1ac389a309a8a8688c178c48
URL:         http://cgit.haiku-os.org/haiku/commit/?id=00bb5b5957b2
Author:      Kostadin Damyanov <maxmight@xxxxxxxxx>
Date:        Fri Jan  8 02:06:00 2016 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Thu Jan 28 00:44:03 2016 UTC

unitests: fix the symlink to the resources directory

Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

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

diff --git a/src/tests/kits/storage/Jamfile b/src/tests/kits/storage/Jamfile
index b09da4a..d9db26b 100644
--- a/src/tests/kits/storage/Jamfile
+++ b/src/tests/kits/storage/Jamfile
@@ -30,9 +30,9 @@ UnitTestLib libstoragetest.so
 
 # To run the tests some test files must be around.
 {
-       local resdir = <storage!kit!test!files>resources ;
+       local resdir = <src!tests!kits!storage>resources ;
        MakeLocate $(resdir) : $(TARGET_UNIT_TEST_DIR) ;
-       RelSymLink $(resdir) : [ FDirName $(SUBDIR) resources ] : false ;
+       RelSymLink $(resdir) : [ FDirName $(HAIKU_TOP) src tests kits storage 
resources ] : false ;
        Depends libstoragetest.so : $(resdir) ;
 }
 


Other related posts:

  • » [haiku-commits] haiku: hrev50057 - src/bin/addattr data/system/data/licenses src/kits/interface src/tests/kits/storage - waddlesplash