Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package bitwise for openSUSE:Factory checked 
in at 2023-08-28 17:13:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bitwise (Old)
 and      /work/SRC/openSUSE:Factory/.bitwise.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bitwise"

Mon Aug 28 17:13:05 2023 rev:4 rq:1105899 version:0.50

Changes:
--------
--- /work/SRC/openSUSE:Factory/bitwise/bitwise.changes  2021-11-02 
19:19:52.191116422 +0100
+++ /work/SRC/openSUSE:Factory/.bitwise.new.1766/bitwise.changes        
2023-08-28 17:13:06.520112022 +0200
@@ -1,0 +2,13 @@
+Mon Aug 21 12:37:13 UTC 2023 - Andrea Manzini <[email protected]>
+
+- Update to version 0.50
+  * Enhancements:
+    + Add r command to reverse endianess 
+    + Allow shortening of commands 
+  * Bug Fixes:
+    + Disable mouse events in interactive command mode
+    + Fix backward key not working in some terminals
+    + Fix divide by zero crash
+    + Fit bit function overflow 
+
+-------------------------------------------------------------------

Old:
----
  bitwise-0.43.tar.gz

New:
----
  bitwise-0.50.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bitwise.spec ++++++
--- /var/tmp/diff_new_pack.6yItXx/_old  2023-08-28 17:13:08.236173646 +0200
+++ /var/tmp/diff_new_pack.6yItXx/_new  2023-08-28 17:13:08.280175226 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package bitwise
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 # Copyright (c) 2020-2021, Martin Hauke <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -18,9 +18,9 @@
 
 
 Name:           bitwise
-Version:        0.43
+Version:        0.50
 Release:        0
-Summary:        Interactive bitwise operation in ncurses
+Summary:        Interactive bit-wise operation in ncurses
 License:        GPL-3.0-or-later
 Group:          Productivity/Scientific/Math
 URL:            https://github.com/mellowcandle/bitwise
@@ -43,7 +43,7 @@
  * Bitwise operations such as NOT, OR, AND, XOR, and shifts.
 
 %prep
-%setup -q
+%autosetup
 
 %build
 autoreconf -fiv

++++++ bitwise-0.43.tar.gz -> bitwise-0.50.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/README.md new/bitwise-0.50/README.md
--- old/bitwise-0.43/README.md  2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/README.md  2023-07-20 22:23:10.000000000 +0200
@@ -22,14 +22,14 @@
 
![Demo](https://github.com/mellowcandle/bitwise/raw/master/resources/bitwise.gif
 "Bitwise demo2")
 
 ## Usage
-_bitwise_ can be used both Interactively and in command line mode.
+_bitwise_ can be used both interactively and in command line mode.
 
 ### Command line calculator mode
 In command line mode, bitwise will calculate the given expression and will 
output the result in all bases including binary representation.
 
-_bitwise_ detects the base by the preface of the input (_0x/0X_ for 
hexadecimal, leading _0_ for octal, _b_ for binary, and the rest is decimal).
+_bitwise_ detects the base by the prefix of the input (_0x/0X_ for 
hexadecimal, leading _0_ for octal, _b_ for binary, and the rest is decimal).
 
-**NEW** Bitwise now support parsing IPv4 addresses, it will also output the 
possible IPv4 address in both Network and reveresed byte order.
+**NEW** Bitwise now support parsing IPv4 addresses, it will also output the 
possible IPv4 address in both Network and reversed byte order.
 
 ### Examples:
 
@@ -53,7 +53,7 @@
 Leave the program by pressing <kbd> q </kbd>.
 
 ##### Binary specific movement
-You can toggle a bit bit using the <kbd> space </kbd> key.
+You can toggle a bit using the <kbd> space </kbd> key.
 You can jump a byte forward using <kbd> w </kbd> and backwards one byte using 
<kbd> b </kbd>.
 
 #### Bitwise operation in interactive mode
@@ -62,12 +62,16 @@
 
 Reducing or extending the bit width interactively is also very easy, just use:
 <kbd> ! </kbd> for 8bit, <kbd> @ </kbd>  for 16Bit, <kbd> $ </kbd> for 32Bit 
and <kbd> * </kbd> for 64Bit.
-When changing the bit width, the number is *masked* with the new width, so you 
might lost precision, use with care.
+When changing the bit width, the number is *masked* with the new width, so you 
might lose precision, use with care.
 
 ##### NOT:
 
 Press <kbd> ~ </kbd> to perform the NOT operator.
 
+##### Reversing Endianness:
+
+Press <kbd> r </kbd> to reverse the endianness.
+
 ##### Shifts
 
 Press <kbd> < </kbd> and <kbd> > </kbd> to perform the left or right shift.
@@ -86,11 +90,11 @@
 * Refer to a specific bit by using the function _BIT(x)_.
 
 ###### commands
-* _help_ - Show the help screen.
-* _clear_ - Clear the history window.
-* _width_ [8 | 16 | 32 | 64] - Set the required width mask
-* _output_ [decimal | hex | octal | binary | all] - Set the default output for 
results.
-* _q_ - Exit
+* _h(elp)_ - Show the help screen.
+* _c(lear)_ - Clear the history window.
+* _w(idth)_ [8 | 16 | 32 | 64] - Set the required width mask
+* _o(utput)_ [dec(imal) | hex(adecimal) | oct(al) | bin(ary) | all] - Set the 
default output for results.
+* _q(uit)_ - Exit
 
 ## Integration with other software
 ### Vim
@@ -129,6 +133,14 @@
 sudo xbps-install -S bitwise
 `
 
+#### Fedora Linux
+
+bitwise is available in the [official 
repository](https://src.fedoraproject.org/rpms/bitwise)
+
+```
+sudo dnf install bitwise
+```
+
 #### Buildroot / Yocto
 Bitwise is available both in Buildroot and in Yocto, please refer to the 
documentation on how to add those to your target image.
 
@@ -145,7 +157,7 @@
 ```
 
 ### Windows
-NCurses doesn't support windows. You can use the windows subsystem for Linux 
as a workaround.
+NCurses doesn't support Windows. You can use the Windows Subsystem for Linux 
as a workaround.
 
 ### Nix
 ```
@@ -188,7 +200,7 @@
 ``` make check ```
 
 ### Contribution
-* Instal prerequisites 
+* Install prerequisites
 * Fork the repo
 * Run ```./bootstrap.sh```
 * Follow the building from source section.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/bitwise.1 new/bitwise-0.50/bitwise.1
--- old/bitwise-0.43/bitwise.1  2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/bitwise.1  2023-07-20 22:23:10.000000000 +0200
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.10.
-.TH BITWISE "1" "November 2021" "bitwise v0.43" "User Commands"
+.TH BITWISE "1" "July 2023" "bitwise v0.50" "User Commands"
 .SH NAME
 bitwise \- Terminal based bit manipulator in ncurses
 .SH SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/configure.ac 
new/bitwise-0.50/configure.ac
--- old/bitwise-0.43/configure.ac       2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/configure.ac       2023-07-20 22:23:10.000000000 +0200
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.69])
-AC_INIT([bitwise], [v0.43], [[email protected]])
+AC_INIT([bitwise], [v0.50], [[email protected]])
 AC_CONFIG_SRCDIR([src/misc.c])
 AC_CONFIG_HEADERS([inc/config.h])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/inc/shunting-yard.h 
new/bitwise-0.50/inc/shunting-yard.h
--- old/bitwise-0.43/inc/shunting-yard.h        2021-11-01 10:16:20.000000000 
+0100
+++ new/bitwise-0.50/inc/shunting-yard.h        2023-07-20 22:23:10.000000000 
+0200
@@ -19,6 +19,7 @@
        ERROR_FUNCTION_ARGUMENTS,
        ERROR_UNDEFINED_CONSTANT,
        ERROR_WRONG_ARGUMENTS,
+       ERROR_DIVIDE_BY_ZERO,
 } Status;
 
 // Calculates the result of a mathematical expression.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/src/cmd.c new/bitwise-0.50/src/cmd.c
--- old/bitwise-0.43/src/cmd.c  2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/src/cmd.c  2023-07-20 22:23:10.000000000 +0200
@@ -10,6 +10,7 @@
 #define MAX_TOKENS 4
 
 static int cmd_clear(char **argv, int argc);
+static int cmd_quit(char **argv, int argc);
 static int cmd_help(char **argv, int argc);
 static int cmd_set_width(char **argv, int argc);
 static int cmd_set_output(char **argv, int argc);
@@ -23,9 +24,15 @@
 
 static struct cmd cmds[] = {
        {"clear", 0, 0, cmd_clear},
+       {"c", 0, 0, cmd_clear},
        {"help", 0, 0, cmd_help},
-       {"width", 1, 1, cmd_set_width},
-       {"output", 1, 1, cmd_set_output},
+       {"h", 0, 0, cmd_help},
+       {"quit", 0, 0, cmd_quit},
+       {"q", 0, 0, cmd_quit},
+       {"width ", 1, 1, cmd_set_width},
+       {"w ", 1, 1, cmd_set_width},
+       {"output ", 1, 1, cmd_set_output},
+       {"o ", 1, 1, cmd_set_output},
 };
 
 static int get_cmd(const char *cmd_name)
@@ -34,8 +41,19 @@
 
        for (i = 0; i < ARRAY_SIZE(cmds); i++) {
                LOG("comparing %s to command %s\n", cmd_name, cmds[i].name);
-               if (!strncmp(cmds[i].name, cmd_name, strlen(cmds[i].name)))
-                       return i;
+               if (cmds[i].max_args == 0) {
+                       /* These commands do not have arguments, compare exact 
*/
+                       if (!strcmp(cmds[i].name, cmd_name))
+                               return i;
+               } else {
+                       /*
+                        * Commands with arguments end with a trailing space,
+                        * compare just the beginning of the command including
+                        * the space
+                        */
+                       if (!strncmp(cmds[i].name, cmd_name, 
strlen(cmds[i].name)))
+                               return i;
+               }
        }
 
        return -1;
@@ -73,6 +91,9 @@
        case ERROR_WRONG_ARGUMENTS:
                message = "Wrong arguments";
                break;
+       case ERROR_DIVIDE_BY_ZERO:
+               message = "Divide by zero";
+               break;
        default:
                message = "Unknown error";
        }
@@ -83,15 +104,27 @@
        wrefresh(cmd_win);
 }
 
-static int is_whitespace(const char *string)
+/* Remove trailing and leading white spaces, and NULL if all-white */
+static char *trim_whitespace(char *str)
 {
+       char *str_end = &str[strlen(str) - 1];
        size_t i;
 
-       for (i = 0; i < strlen(string); i++)
-               if (!isspace(string[i]))
-                       return false;
+       /* Remove leding white characters */
+       while (isspace(str[0]))
+               str++;
+
+       /* There are only white characters */
+       if (str[0] == '\0')
+               return NULL;
 
-       return true;
+       /*  There is at least one non-white character, find the last one */
+       while (isspace(str_end[0]))
+               str_end--;
+
+       str_end[1] = '\0';
+
+       return str;
 }
 
 static int parse_cmd(char *cmdline)
@@ -102,7 +135,8 @@
        int rc = 0;
        uint64_t result;
 
-       if (is_whitespace(cmdline))
+       cmdline = trim_whitespace(cmdline);
+       if (!cmdline)
                return 0;
 
        LOG("got command: %s\n", cmdline);
@@ -146,6 +180,10 @@
                        return -1;
                } else {
                        char result_string[256];
+                       if (result > MASK(g_width)) {
+                               result &= MASK(g_width);
+                               append_to_history("Overflow!", 
TYPE_OUTPUT_ERROR);
+                       }
                        g_val = result;
 
                        if (g_output == CMD_OUTPUT_ALL) {
@@ -201,9 +239,6 @@
                return;
        }
 
-       if (strcmp("q", line) == 0)
-               g_leave_req = true;
-
        if (*line)
                add_history(line);
 
@@ -265,6 +300,10 @@
                if (new_char == ERR) {
                        LOG("IT's a real escape\n");
                        active_win = last_win;
+
+                       // Re-enable mouse events
+                       mousemask(BUTTON1_CLICKED, NULL);
+
                        if (active_win == FIELDS_WIN) {
                                set_active_field(false);
                                form_driver(form, REQ_END_LINE);
@@ -318,6 +357,13 @@
        return 0;
 }
 
+static int cmd_quit(char **argv, int argc)
+{
+       LOG("%s: argc %d\n", __func__, argc);
+       g_leave_req = true;
+       return 0;
+}
+
 static int cmd_set_width(char **argv, int argc)
 {
        LOG("%s: argc %d\n", __func__, argc);
@@ -341,13 +387,13 @@
 static int cmd_set_output(char **argv, int argc)
 {
        LOG("%s: argc %d\n", __func__, argc);
-       if (!strcmp("hex", argv[0]))
+       if (!strcmp("hexadecimal", argv[0]) || !strcmp("hex", argv[0]))
                g_output = CMD_OUTPUT_HEXADECIMAL;
-       else if (!strcmp("decimal", argv[0]))
+       else if (!strcmp("decimal", argv[0]) || !strcmp("dec", argv[0]))
                g_output = CMD_OUTPUT_DECIMAL;
-       else if (!strcmp("octal", argv[0]))
+       else if (!strcmp("octal", argv[0]) || !strcmp("oct", argv[0]))
                g_output = CMD_OUTPUT_OCTAL;
-       else if (!strcmp("binary", argv[0]))
+       else if (!strcmp("binary", argv[0]) || !strcmp("bin", argv[0]))
                g_output = CMD_OUTPUT_BINARY;
        else if (!strcmp("all", argv[0]))
                g_output = CMD_OUTPUT_ALL;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/src/help.c new/bitwise-0.50/src/help.c
--- old/bitwise-0.43/src/help.c 2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/src/help.c 2023-07-20 22:23:10.000000000 +0200
@@ -18,6 +18,7 @@
                                       "'@'  Set bit width to 16bit.\n" \
                                       "'$'  Set bit width to 32bit.\n" \
                                       "'*'  Set bit width to 64bit.\n" \
+                                      "'r'  Reverse the endianness\n" \
                                       "':'  Switch to command mode.\n" \
                                       "'q'  Exit back to shell.\n";
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/src/interactive.c 
new/bitwise-0.50/src/interactive.c
--- old/bitwise-0.43/src/interactive.c  2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/src/interactive.c  2023-07-20 22:23:10.000000000 +0200
@@ -480,7 +480,9 @@
                wrefresh(fields_win);
                break;
        case KEY_BACKSPACE:
+       case KEY_DC:
        case 127:
+       case 8:
                LOG("Backspace\n");
                form_driver(form, REQ_DEL_CHAR);
                form_driver(form, REQ_DEL_PREV);
@@ -491,7 +493,7 @@
                wrefresh(fields_win);
                break;
        default:
-               LOG("default char\n");
+               LOG("default char: %d\n", ch);
 
                tmp_field = current_field(form);
                cur_base = field_userptr(tmp_field);
@@ -649,7 +651,6 @@
                        }
                        break;
 
-                               
                case KEY_F(1):
                        unpaint_screen();
                        show_help();
@@ -696,6 +697,21 @@
                        g_val = ~g_val & MASK(g_width);
                        paint_screen();
                        break;
+               case 'r':
+                       unpaint_screen();
+                       switch (g_width) {
+                               case 16:
+                                       g_val = __builtin_bswap16(g_val);
+                                       break;
+                               case 32:
+                                       g_val = __builtin_bswap32(g_val);
+                                       break;
+                               case 64:
+                                       g_val = __builtin_bswap64(g_val);
+                                       break;
+                       }
+                       paint_screen();
+                       break;
                case '>':
                        unpaint_screen();
                        g_val = g_val >> 1;
@@ -720,6 +736,9 @@
                        } else if (last_win == BINARY_WIN)
                                position_binary_curser(bit_pos, -1);
 
+                       // Stop handling of mouse events
+                       mousemask(0, NULL);
+
                        curs_set(1);
                        keypad(stdscr, FALSE);
                        intrflush(NULL, FALSE);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/src/main.c new/bitwise-0.50/src/main.c
--- old/bitwise-0.43/src/main.c 2021-11-01 10:16:20.000000000 +0100
+++ new/bitwise-0.50/src/main.c 2023-07-20 22:23:10.000000000 +0200
@@ -66,13 +66,13 @@
        if (g_width < 64)
                printf("%sRadix64: %s%s\n", color_green, color_blue, l64a(val));
 
-       if (val >= UINT_MAX) {
-               printf("%sIPv4: %s%s\n", color_green, color_blue, "Value to big 
to be a valid IPv4 address");
+       if (val > UINT_MAX) {
+               printf("%sIPv4: %s%s\n", color_green, color_blue, "Value too 
big to be a valid IPv4 address");
        } else {
                ip_addr.s_addr = val;
                printf("%sIPv4 (Network byte order - Big): %s %s\n", 
color_green, color_blue, inet_ntoa(ip_addr));
                ip_addr.s_addr = bswap_32(val);
-               printf("%sIPv4 (Reverwsed byte order - Little): %s %s\n", 
color_green, color_blue, inet_ntoa(ip_addr));
+               printf("%sIPv4 (Reversed byte order - Little): %s %s\n", 
color_green, color_blue, inet_ntoa(ip_addr));
        }
 
        printf("%sASCII: %s", color_green, color_blue);
@@ -226,6 +226,8 @@
                free(expression);
                if (!g_width)
                        set_width_by_val(val);
+               if (val > MASK(g_width))
+                       fprintf(stderr, "%sExpression overflowed!\n", 
color_red);
                val &= MASK(g_width);
                if (!interactive)
                        return print_conversions(val, si);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bitwise-0.43/src/shunting-yard.c 
new/bitwise-0.50/src/shunting-yard.c
--- old/bitwise-0.43/src/shunting-yard.c        2021-11-01 10:16:20.000000000 
+0100
+++ new/bitwise-0.50/src/shunting-yard.c        2023-07-20 22:23:10.000000000 
+0200
@@ -346,6 +346,8 @@
                x = x * y;
                break;
        case '/':
+               if (y == 0)
+                       return ERROR_DIVIDE_BY_ZERO;
                x = x / y;
                break;
        case '%':
@@ -409,7 +411,7 @@
        uint64_t x = pop_num(operands);
 
        if (strcasecmp(function, "bit") == 0)
-               x = 1 << x;
+               x = BIT(x);
        else
                return ERROR_UNDEFINED_FUNCTION;
 

Reply via email to