Skip to content

Commit

Permalink
Fix compiler warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-graj committed Mar 27, 2023
1 parent b1783d7 commit 5f206c6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/entity/earth.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Wojciech Graj
* Copyright (c) 2022-2023 Wojciech Graj
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -82,7 +82,7 @@ void earth_init(void)
idx_obj_init(&obj_earth);
model_init(&model, &obj_earth);

shader_init(&shader, res_shader_earth_vert, res_shader_earth_vert_len, res_shader_earth_frag, res_shader_earth_frag_len, 2, (struct ShaderAttr[]){
shader_init(&shader, (const char *)res_shader_earth_vert, res_shader_earth_vert_len, (const char *)res_shader_earth_frag, res_shader_earth_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});
Expand Down
2 changes: 1 addition & 1 deletion src/entity/satellite.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void satellite_init(void)
vao_attr(&vao_orbits, &vbo_orbits, LOCL_APOS, 3, GL_FLOAT, sizeof(vec3), 0);
vao_attr(&vao_orbits, &vbo_orbit_colors, LOCL_COLOR, 3, GL_FLOAT, sizeof(vec3), 0);

shader_init(&shader, res_shader_satellite_vert, res_shader_satellite_vert_len, res_shader_satellite_frag, res_shader_satellite_frag_len, 2, (struct ShaderAttr[]){
shader_init(&shader, (const char *)res_shader_satellite_vert, res_shader_satellite_vert_len, (const char *)res_shader_satellite_frag, res_shader_satellite_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_COLOR, "in_color" },
});
Expand Down
4 changes: 2 additions & 2 deletions src/entity/sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*n
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Expand Down Expand Up @@ -61,7 +61,7 @@ void sky_init(void)
glm_scale_make(model.scl, (vec3){ 70.f, 70.f, 70.f });
model_transform(&model);

shader_init(&shader, res_shader_sky_vert, res_shader_sky_vert_len, res_shader_sky_frag, res_shader_sky_frag_len, 2, (struct ShaderAttr[]){
shader_init(&shader, (const char *)res_shader_sky_vert, res_shader_sky_vert_len, (const char *)res_shader_sky_frag, res_shader_sky_frag_len, 2, (struct ShaderAttr[]){
{ LOCL_APOS, "in_pos" },
{ LOCL_ATEXCOORD, "in_uv" },
});
Expand Down
6 changes: 3 additions & 3 deletions src/gfx/shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
#include "error_gfx.h"
#include "system.h"

static GLint shader_compile(char *str, unsigned int len, GLenum type);
static GLint shader_compile(const char *str, unsigned int len, GLenum type);

GLint shader_compile(char *str, unsigned int len, GLenum type)
GLint shader_compile(const char *str, unsigned int len, GLenum type)
{
GLuint handle = glCreateShader(type);
glShaderSource(handle, 1, (const GLchar *const *)&str, (const GLint *)&len);
Expand All @@ -33,7 +33,7 @@ GLint shader_compile(char *str, unsigned int len, GLenum type)
return handle;
}

void shader_init(struct Shader *shader, char *vs, unsigned int vs_len, char *fs, unsigned int fs_len, size_t n_vertex_attr, struct ShaderAttr vertex_attr[])
void shader_init(struct Shader *shader, const char *vs, unsigned int vs_len, const char *fs, unsigned int fs_len, size_t n_vertex_attr, struct ShaderAttr vertex_attr[])
{
GLuint vs_handle = shader_compile(vs, vs_len, GL_VERTEX_SHADER);
GLuint fs_handle = shader_compile(fs, fs_len, GL_FRAGMENT_SHADER);
Expand Down
4 changes: 2 additions & 2 deletions src/gfx/shader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Wojciech Graj
* Copyright (c) 2022-2023 Wojciech Graj
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -26,7 +26,7 @@ struct Shader {
GLuint handle;
};

void shader_init(struct Shader *shader, char *vs, unsigned int vs_len, char *fs, unsigned int fs_len, size_t n_vertex_attr, struct ShaderAttr vertex_attr[]);
void shader_init(struct Shader *shader, const char *vs, unsigned int vs_len, const char *fs, unsigned int fs_len, size_t n_vertex_attr, struct ShaderAttr vertex_attr[]);
void shader_deinit(struct Shader *shader);
void shader_bind(struct Shader *shader);

Expand Down
2 changes: 1 addition & 1 deletion src/gfx/texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void texture_init(struct Texture *texture, GLenum unit, GLenum type)
glBindTexture(type, texture->handle);
}

void texture_init_from_image(struct Texture *texture, unsigned char *buffer, unsigned int len, GLenum unit, GLenum type)
void texture_init_from_image(struct Texture *texture, const unsigned char *buffer, unsigned int len, GLenum unit, GLenum type)
{
int width, height, n_channels;
unsigned char *data = stbi_load_from_memory(buffer, len, &width, &height, &n_channels, 0);
Expand Down
4 changes: 2 additions & 2 deletions src/gfx/texture.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Wojciech Graj
* Copyright (c) 2022-2023 Wojciech Graj
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -27,7 +27,7 @@ void textures_init(void);

void texture_init(struct Texture *texture, GLenum unit, GLenum type);

void texture_init_from_image(struct Texture *texture, unsigned char *buffer, unsigned int len, GLenum unit, GLenum type);
void texture_init_from_image(struct Texture *texture, const unsigned char *buffer, unsigned int len, GLenum unit, GLenum type);

void texture_deinit(struct Texture *texture);

Expand Down
4 changes: 2 additions & 2 deletions src/ui/catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ void catalog_init(GtkBuilder *builder)
g_signal_connect(render_select, "toggled", G_CALLBACK(on_column_select_cell_toggled), NULL);

init_col_from_store_col(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_CATNUM]), 1, 5);
init_col_with_data_func(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_NAME]), cell_data_func_str, &OFFSET_NAME, 24);
init_col_with_data_func(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_ID]), cell_data_func_str, &OFFSET_ID, 11);
init_col_with_data_func(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_NAME]), cell_data_func_str, (gpointer)&OFFSET_NAME, 24);
init_col_with_data_func(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_ID]), cell_data_func_str, (gpointer)&OFFSET_ID, 11);
init_col_with_data_func(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_STATUS]), cell_data_func_status, NULL, 21);
init_col_from_store_col(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_SOURCE]), 5, 5);
init_col_from_store_col(gtk_cell_renderer_text_new(), gtk_builder_get_object(builder, column_ids[COL_LAUNCH_DATE]), 2, 10);
Expand Down

0 comments on commit 5f206c6

Please sign in to comment.