From f5c245ceb81fb0af09fd816d6dc4e08f0b81f9d3 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 27 Aug 2020 14:35:26 +0300 Subject: [PATCH] ci: fix `v build-examples` too --- examples/sokol/sounds/wav_player.v | 12 +++---- examples/ws/client.v | 53 ------------------------------ 2 files changed, 6 insertions(+), 59 deletions(-) delete mode 100644 examples/ws/client.v diff --git a/examples/sokol/sounds/wav_player.v b/examples/sokol/sounds/wav_player.v index a13c052ae5..addfd7fb94 100644 --- a/examples/sokol/sounds/wav_player.v +++ b/examples/sokol/sounds/wav_player.v @@ -126,10 +126,10 @@ fn read_wav_file_samples(fpath string) ?[]f32 { mut offset := u32(0) rh := &RIFFHeader(pbytes) // eprintln('rh: $rh') - if rh.riff != [`R`, `I`, `F`, `F`]!! { + if rh.riff != [byte(`R`), `I`, `F`, `F`]!! { return error('WAV should start with `RIFF`') } - if rh.form_type != [`W`, `A`, `V`, `E`]!! { + if rh.form_type != [byte(`W`), `A`, `V`, `E`]!! { return error('WAV should have `WAVE` form type') } if rh.file_size + 8 != bytes.len { @@ -147,15 +147,15 @@ fn read_wav_file_samples(fpath string) ?[]f32 { // eprintln('ch: $ch') // eprintln('p: $pbytes | offset: $offset | bytes.len: $bytes.len') // //////// - if ch.chunk_type == [`L`, `I`, `S`, `T`]!! { + if ch.chunk_type == [byte(`L`), `I`, `S`, `T`]!! { continue } // - if ch.chunk_type == [`i`, `d`, `3`, ` `]!! { + if ch.chunk_type == [byte(`i`), `d`, `3`, ` `]!! { continue } // - if ch.chunk_type == [`f`, `m`, `t`, ` `]!! { + if ch.chunk_type == [byte(`f`), `m`, `t`, ` `]!! { // eprintln('`fmt ` chunk') rf = &RIFFFormat(&ch.chunk_data) // eprintln('fmt riff format: $rf') @@ -171,7 +171,7 @@ fn read_wav_file_samples(fpath string) ?[]f32 { continue } // - if ch.chunk_type == [`d`, `a`, `t`, `a`]!! { + if ch.chunk_type == [byte(`d`), `a`, `t`, `a`]!! { if rf == 0 { return error('`data` chunk should be after `fmt ` chunk') } diff --git a/examples/ws/client.v b/examples/ws/client.v deleted file mode 100644 index 044c3875a8..0000000000 --- a/examples/ws/client.v +++ /dev/null @@ -1,53 +0,0 @@ -module main - -import net.websocket -import time - -fn main() { - //URLs working for testing, reply the same sent messages - ws_test('ws://echo.websocket.org') - ws_test('wss://echo.websocket.org') -} - -fn ws_test(uri string) { - println('connecting to $uri ...') - mut ws := websocket.new(uri) - ws.subscriber.subscribe('on_open', on_open) - ws.subscriber.subscribe('on_message', on_message) - ws.subscriber.subscribe('on_error', on_error) - ws.subscriber.subscribe('on_close', on_close) - ws.connect() - // Needs another thread, generates an infinite loop for listen - go ws.listen() - for i := 0; i < 10; i++ { - text := 'a'.repeat(i) - println(text) - // Send a text to the server - ws.write(text.str, text.len, .text_frame) - // Only for test purposes, to give time to receive message - time.sleep_ms(100) - } - // Only for test purposes, to give time to receive message - time.sleep_ms(100) -} - -fn on_open(ws &websocket.Client, x, y voidptr) { - println('websocket opened.') -} - -fn on_message(ws &websocket.Client, msg &websocket.Message, x voidptr) { - typ := msg.opcode - if typ == .text_frame { - println('Message: ${cstring_to_vstring(msg.payload)}') - } else { - println('Binary message: $msg') - } -} - -fn on_close(ws &websocket.Client, x, y voidptr) { - println('websocket closed.') -} - -fn on_error(ws &websocket.Client, x, y voidptr) { - println('we have an error.') -}