[moserial] Strip all non hexadecimal characters from input string when hex mode is selected.
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [moserial] Strip all non hexadecimal characters from input string when hex mode is selected.
- Date: Sat, 16 Jan 2021 13:47:24 +0000 (UTC)
commit ee235c573979e6f74ea0155255ec1b2016fd8851
Author: Mictronics <github mictronics de>
Date: Thu Dec 17 17:49:16 2020 +0100
Strip all non hexadecimal characters from input string when hex mode is selected.
src/MainWindow.vala | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index a11b237..0c69160 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -513,7 +513,8 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
}
} else {
try {
- uchar[] h = InputParser.parseHex (s);
+ Regex rex = new Regex("[^0123456789ABCDEFabcdef]");
+ uchar[] h = InputParser.parseHex (rex.replace(s, s.length, 0, ""));
len = h.length;
for (int x = 0; x < len; x++) {
serialConnection.sendByte (h[x]);
@@ -521,7 +522,7 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
outgoingHexTextBuffer.add (h[x]);
insertBufferEnd (outgoingAsciiTextBuffer, "%c".printf (h[x]));
}
- } catch (HexParseError e) {
+ } catch (Error e) {
var errorDialog = new MessageDialog (gtkWindow, DialogFlags.DESTROY_WITH_PARENT,
MessageType.ERROR, ButtonsType.CLOSE, "%s", e.message);
errorDialog.run ();
errorDialog.destroy ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]