From 7690cbfbaf547f6875dbc20550409b943c5a776a Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 14 Apr 2026 19:26:16 +0300 Subject: [PATCH] all: fix more ci issues - fix &string interpolation defaulting to 's' format instead of 'p' (pointer) - fix PeekNamedPipe cross-compilation by adding C fn declarations in fd.c.v - fix Vec2/3/4 eq_epsilon triggering spurious Vec2[f64] instantiation --- vlib/math/vec/vec2.v | 4 ++-- vlib/math/vec/vec3.v | 2 +- vlib/math/vec/vec4.v | 2 +- vlib/os/fd.c.v | 5 +++++ vlib/v/checker/str.v | 3 +++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vlib/math/vec/vec2.v b/vlib/math/vec/vec2.v index 02f56fed6..eb8f8ca17 100644 --- a/vlib/math/vec/vec2.v +++ b/vlib/math/vec/vec2.v @@ -4,7 +4,7 @@ module vec import math -pub const vec_epsilon = f64(10e-7) +pub const vec_epsilon = 10e-7 // Vec2[T] is a generic struct representing a vector in 2D space. pub struct Vec2[T] { @@ -307,7 +307,7 @@ pub fn (v Vec2[T]) eq(u Vec2[T]) bool { // eq_epsilon returns a bool indicating if the two vectors are equal within the module `vec_epsilon` const. pub fn (v Vec2[T]) eq_epsilon(u Vec2[T]) bool { - return v.eq_approx[T, f64](u, vec_epsilon) + return v.eq_approx[T, T](u, T(vec_epsilon)) } // eq_approx returns whether these vectors are approximately equal within `tolerance`. diff --git a/vlib/math/vec/vec3.v b/vlib/math/vec/vec3.v index 9e8c794e6..e78c8f8ea 100644 --- a/vlib/math/vec/vec3.v +++ b/vlib/math/vec/vec3.v @@ -281,7 +281,7 @@ pub fn (v Vec3[T]) eq(u Vec3[T]) bool { // eq_epsilon returns a bool indicating if the two vectors are equal within the module `vec_epsilon` const. pub fn (v Vec3[T]) eq_epsilon(u Vec3[T]) bool { - return v.eq_approx[T, f64](u, vec_epsilon) + return v.eq_approx[T, T](u, T(vec_epsilon)) } // eq_approx returns whether these vectors are approximately equal within `tolerance`. diff --git a/vlib/math/vec/vec4.v b/vlib/math/vec/vec4.v index 25570f128..6bd7cea4a 100644 --- a/vlib/math/vec/vec4.v +++ b/vlib/math/vec/vec4.v @@ -297,7 +297,7 @@ pub fn (v Vec4[T]) eq(u Vec4[T]) bool { // eq_epsilon returns a bool indicating if the two vectors are equal within the module `vec_epsilon` const. pub fn (v Vec4[T]) eq_epsilon(u Vec4[T]) bool { - return v.eq_approx[T, f64](u, vec_epsilon) + return v.eq_approx[T, T](u, T(vec_epsilon)) } // eq_approx returns whether these vectors are approximately equal within `tolerance`. diff --git a/vlib/os/fd.c.v b/vlib/os/fd.c.v index fcdc99dd1..c0a0984a4 100644 --- a/vlib/os/fd.c.v +++ b/vlib/os/fd.c.v @@ -87,6 +87,11 @@ $if !windows { fn C.ioctl(fd i32, request u64, args ...voidptr) i32 } +$if windows { + fn C._get_osfhandle(fd int) voidptr + fn C.PeekNamedPipe(hNamedPipe voidptr, lpBuffer voidptr, nBufferSize i32, lpBytesRead voidptr, lpTotalBytesAvail voidptr, lpBytesLeftThisMessage voidptr) bool +} + // These are C macros, but from the V's point of view, can be treated as C functions: fn C.FD_ZERO(fdset &C.fd_set) fn C.FD_SET(fd i32, fdset &C.fd_set) diff --git a/vlib/v/checker/str.v b/vlib/v/checker/str.v index 67a41f296..10d37a9ec 100644 --- a/vlib/v/checker/str.v +++ b/vlib/v/checker/str.v @@ -42,6 +42,9 @@ fn (mut c Checker) get_default_fmt(ftyp ast.Type, typ ast.Type) u8 { } fn (mut c Checker) get_string_inter_default_fmt(_ ast.Expr, ftyp ast.Type, typ ast.Type) u8 { + if ftyp.nr_muls() > 0 && ftyp.idx() in [ast.string_type_idx, ast.bool_type_idx] { + return `p` + } return c.get_default_fmt(ftyp, typ) } -- 2.39.5