handle null byte in meta string

main
Jean-Michel Friedt 2024-06-08 16:03:48 +02:00
parent 82c50c8e04
commit ea3249dc9b
2 changed files with 10 additions and 25 deletions

View File

@ -46,7 +46,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [544, 16.0] coordinate: [424, 8.0]
rotation: 0 rotation: 0
state: true state: true
- name: enc_subtype - name: enc_subtype
@ -76,7 +76,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [384, 292.0] coordinate: [384, 332.0]
rotation: 0 rotation: 0
state: enabled state: enabled
- name: enc_type - name: enc_type
@ -106,25 +106,9 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [248, 292.0] coordinate: [248, 332.0]
rotation: 0 rotation: 0
state: enabled state: enabled
- name: meta_str
id: variable_qtgui_entry
parameters:
comment: ''
entry_signal: editingFinished
gui_hint: 2,0,1,1
label: META
type: string
value: Hello!
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [288, 16.0]
rotation: 0
state: true
- name: mode - name: mode
id: variable_qtgui_chooser id: variable_qtgui_chooser
parameters: parameters:
@ -152,7 +136,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [16, 292.0] coordinate: [16, 332.0]
rotation: 0 rotation: 0
state: enabled state: enabled
- name: samp_rate - name: samp_rate
@ -180,7 +164,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [408, 16.0] coordinate: [288, 8.0]
rotation: 0 rotation: 0
state: true state: true
- name: type_val - name: type_val
@ -210,7 +194,7 @@ blocks:
bus_sink: false bus_sink: false
bus_source: false bus_source: false
bus_structure: null bus_structure: null
coordinate: [120, 292.0] coordinate: [120, 332.0]
rotation: 0 rotation: 0
state: enabled state: enabled
- name: blocks_file_sink_0 - name: blocks_file_sink_0
@ -296,13 +280,15 @@ blocks:
affinity: '' affinity: ''
alias: '' alias: ''
can: '0' can: '0'
comment: '' comment: 'since Meta can be a byte array, it cannot be fed with a QT GUI Entry
string but must be a "\x00" string in the Encoder block'
debug: 'False' debug: 'False'
dst_id: dst_str dst_id: dst_str
encr_subtype: enc_subtype encr_subtype: enc_subtype
encr_type: enc_type encr_type: enc_type
maxoutbuf: '0' maxoutbuf: '0'
meta: meta_str meta: '"\x00\x00abcde"'
minoutbuf: '0' minoutbuf: '0'
mode: mode mode: mode
src_id: src_str src_id: src_str

View File

@ -104,7 +104,6 @@ void m17_coder_impl::set_meta(std::string meta)
} }
else else
{c=meta.data(); {c=meta.data();
printf("%d %d --- ",meta.size(),meta.length());
if (meta.size()<14) length=meta.size(); else length=14; if (meta.size()<14) length=meta.size(); else length=14;
printf("%d bytes: ",length); printf("%d bytes: ",length);
for (int i=0;i<length;i++) for (int i=0;i<length;i++)