Move from sentinel-terminated pointers to sentinel-terminated slices globally ([+:0] -> [:0]) (#203)

This commit is contained in:
Nikolas 2025-02-24 16:44:40 +01:00
parent 4d452b2bcd
commit bc82c6ebd7
Failed to generate hash of commit
6 changed files with 209 additions and 209 deletions

View file

@ -836,7 +836,7 @@ pub fn rlGetGlTextureFormats(format: i32, glInternalFormat: *u32, glFormat: *u32
}
/// Get name string for pixel format
pub fn rlGetPixelFormatName(format: u32) [*:0]const u8 {
pub fn rlGetPixelFormatName(format: u32) [:0]const u8 {
return std.mem.span(cdef.rlGetPixelFormatName(@as(c_uint, format)));
}
@ -856,7 +856,7 @@ pub fn rlReadTexturePixels(id: u32, width: i32, height: i32, format: i32) *anyop
}
/// Read screen pixel data (color buffer)
pub fn rlReadScreenPixels(width: i32, height: i32) [*:0]u8 {
pub fn rlReadScreenPixels(width: i32, height: i32) [:0]u8 {
return std.mem.span(cdef.rlReadScreenPixels(@as(c_int, width), @as(c_int, height)));
}
@ -881,12 +881,12 @@ pub fn rlUnloadFramebuffer(id: u32) void {
}
/// Load shader from code strings
pub fn rlLoadShaderCode(vsCode: [*:0]const u8, fsCode: [*:0]const u8) u32 {
pub fn rlLoadShaderCode(vsCode: [:0]const u8, fsCode: [:0]const u8) u32 {
return @as(u32, cdef.rlLoadShaderCode(@as([*c]const u8, @ptrCast(vsCode)), @as([*c]const u8, @ptrCast(fsCode))));
}
/// Compile custom shader and return shader id (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)
pub fn rlCompileShader(shaderCode: [*:0]const u8, ty: i32) u32 {
pub fn rlCompileShader(shaderCode: [:0]const u8, ty: i32) u32 {
return @as(u32, cdef.rlCompileShader(@as([*c]const u8, @ptrCast(shaderCode)), @as(c_int, ty)));
}
@ -901,12 +901,12 @@ pub fn rlUnloadShaderProgram(id: u32) void {
}
/// Get shader location uniform
pub fn rlGetLocationUniform(shaderId: u32, uniformName: [*:0]const u8) i32 {
pub fn rlGetLocationUniform(shaderId: u32, uniformName: [:0]const u8) i32 {
return @as(i32, cdef.rlGetLocationUniform(@as(c_uint, shaderId), @as([*c]const u8, @ptrCast(uniformName))));
}
/// Get shader location attribute
pub fn rlGetLocationAttrib(shaderId: u32, attribName: [*:0]const u8) i32 {
pub fn rlGetLocationAttrib(shaderId: u32, attribName: [:0]const u8) i32 {
return @as(i32, cdef.rlGetLocationAttrib(@as(c_uint, shaderId), @as([*c]const u8, @ptrCast(attribName))));
}