Skip to content

Commit

Permalink
all: ~500 more byte=>u8
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Apr 15, 2022
1 parent ae6a25f commit fbb9e65
Show file tree
Hide file tree
Showing 148 changed files with 545 additions and 495 deletions.
6 changes: 3 additions & 3 deletions cmd/tools/vast/cjson.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fn C.cJSON_CreateNull() &C.cJSON

// fn C.cJSON_CreateNumber() &C.cJSON
// fn C.cJSON_CreateString() &C.cJSON
fn C.cJSON_CreateRaw(&byte) &C.cJSON
fn C.cJSON_CreateRaw(&u8) &C.cJSON

fn C.cJSON_IsInvalid(voidptr) bool

Expand All @@ -45,13 +45,13 @@ fn C.cJSON_IsObject(voidptr) bool

fn C.cJSON_IsRaw(voidptr) bool

fn C.cJSON_AddItemToObject(voidptr, &byte, voidptr)
fn C.cJSON_AddItemToObject(voidptr, &u8, voidptr)

fn C.cJSON_AddItemToArray(voidptr, voidptr)

fn C.cJSON_Delete(voidptr)

fn C.cJSON_Print(voidptr) &byte
fn C.cJSON_Print(voidptr) &u8

[inline]
fn create_object() &C.cJSON {
Expand Down
2 changes: 1 addition & 1 deletion examples/sokol/01_cubes/cube.v
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn destroy_texture(sg_img gfx.Image) {
}

// Use only if usage: .dynamic is enabled
fn update_text_texture(sg_img gfx.Image, w int, h int, buf &byte) {
fn update_text_texture(sg_img gfx.Image, w int, h int, buf &u8) {
sz := w * h * 4
mut tmp_sbc := gfx.ImageData{}
tmp_sbc.subimage[0][0] = gfx.Range{
Expand Down
2 changes: 1 addition & 1 deletion examples/sokol/06_obj_viewer/modules/obj/rend.v
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import stbi
/******************************************************************************
* Texture functions
******************************************************************************/
pub fn create_texture(w int, h int, buf &byte) gfx.Image {
pub fn create_texture(w int, h int, buf &u8) gfx.Image {
sz := w * h * 4
mut img_desc := gfx.ImageDesc{
width: w
Expand Down
8 changes: 4 additions & 4 deletions examples/sokol/particles/modules/particle/color.v
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module particle
// * Color
pub struct Color {
mut:
r byte
g byte
b byte
a byte
r u8
g u8
b u8
a u8
}
2 changes: 1 addition & 1 deletion examples/sokol/sounds/melody.v
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn graphics_frame(mut state AppState) {
}

[inline]
fn (mut state AppState) bsample(idx int) byte {
fn (mut state AppState) bsample(idx int) u8 {
return u8(127 + state.frames[(state.gframe + idx) & 2047] * 128)
}

Expand Down
18 changes: 9 additions & 9 deletions examples/sokol/sounds/wav_player.v
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ struct RIFFChunkHeader {
}

struct RIFFFormat {
format_tag u16 // PCM = 1; Values other than 1 indicate some form of compression.
nchannels u16 // Nc ; 1 = mono ; 2 = stereo
sample_rate u32 // F
avg_bytes_per_second u32 // F * M*Nc
nblock_align u16 // M*Nc
bits_per_sample u16 // 8 * M
cbsize u16 // Size of the extension: 22
valid_bits_per_sample u16 // at most 8*M
channel_mask u32 // Speaker position mask
format_tag u16 // PCM = 1; Values other than 1 indicate some form of compression.
nchannels u16 // Nc ; 1 = mono ; 2 = stereo
sample_rate u32 // F
avg_bytes_per_second u32 // F * M*Nc
nblock_align u16 // M*Nc
bits_per_sample u16 // 8 * M
cbsize u16 // Size of the extension: 22
valid_bits_per_sample u16 // at most 8*M
channel_mask u32 // Speaker position mask
sub_format [16]u8 // GUID
}

Expand Down
2 changes: 1 addition & 1 deletion examples/viewer/view.v
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn destroy_texture(sg_img gfx.Image) {
}

// Use only if: .dynamic is enabled
fn update_text_texture(sg_img gfx.Image, w int, h int, buf &byte) {
fn update_text_texture(sg_img gfx.Image, w int, h int, buf &u8) {
sz := w * h * 4
mut tmp_sbc := gfx.ImageData{}
tmp_sbc.subimage[0][0] = gfx.Range{
Expand Down
4 changes: 2 additions & 2 deletions vlib/arrays/arrays_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ fn test_copy() {
}

fn test_can_copy_bits() {
assert can_copy_bits<byte>()
assert can_copy_bits<u8>()
assert can_copy_bits<int>()
assert can_copy_bits<voidptr>()
assert can_copy_bits<&byte>()
assert can_copy_bits<&u8>()
// autofree needs to intercept assign
assert !can_copy_bits<string>()
assert !can_copy_bits<[]int>()
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/array.v
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ pub fn (mut a array) reverse_in_place() {
mut tmp_value := malloc(a.element_size)
for i in 0 .. a.len / 2 {
vmemcpy(tmp_value, &u8(a.data) + i * a.element_size, a.element_size)
vmemcpy(&u8(a.data) + i * a.element_size, &u8(a.data) +
(a.len - 1 - i) * a.element_size, a.element_size)
vmemcpy(&u8(a.data) + i * a.element_size, &u8(a.data) + (a.len - 1 - i) * a.element_size,
a.element_size)
vmemcpy(&u8(a.data) + (a.len - 1 - i) * a.element_size, tmp_value, a.element_size)
}
free(tmp_value)
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/int.v
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module builtin
// ----- value to string functions -----
//

//type u8 = byte
// type u8 = byte
type byte = u8
type i32 = int

Expand Down
14 changes: 7 additions & 7 deletions vlib/builtin/int_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,21 @@ fn test_bin() {
fn test_oct() {
x1 := 0o12
assert x1 == 10
x2 := 00000o350
x2 := 0o350
assert x2 == 232
x3 := 000o00073
x3 := 0o00073
assert x3 == 59
x4 := 00000000
x4 := 0
assert x4 == 0
x5 := 00000195
x5 := 195
assert x5 == 195
x6 := -0o744
assert x6 == -484
x7 := -000o000042
x7 := -0o000042
assert x7 == -34
x8 := -0000112
x8 := -112
assert x8 == -112
x9 := -000
x9 := -0
assert x9 == 0
}

Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/js/map_test.js.v
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn test_various_map_value() {
mut m9 := map[string]bool{}
m9['test'] = true
assert m9['test'] == true
mut m10 := map[string]byte{}
mut m10 := map[string]u8{}
m10['test'] = u8(0)
assert m10['test'] == u8(0)
mut m11 := map[string]f32{}
Expand Down Expand Up @@ -762,7 +762,7 @@ fn test_in_map_literal() {
}

fn test_byte_keys() {
mut m := map[byte]byte{}
mut m := map[u8]u8{}
byte_max := u8(255)
for i in u8(0) .. byte_max {
m[i] = i
Expand Down
4 changes: 2 additions & 2 deletions vlib/builtin/js/string_test.js.v
Original file line number Diff line number Diff line change
Expand Up @@ -783,11 +783,11 @@ fn test_double_quote_inter() {
assert '$a $b' == '1 2'
}

fn foo(b byte) byte {
fn foo(b u8) u8 {
return b - 10
}

fn filter(b byte) bool {
fn filter(b u8) bool {
return b != `a`
}

Expand Down
Loading

0 comments on commit fbb9e65

Please sign in to comment.