Fix various compiler warnings

This commit is contained in:
rdb
2024-10-14 12:05:27 +02:00
parent 51e469d065
commit 52a7224d6e
6 changed files with 28 additions and 28 deletions
+2 -2
View File
@@ -679,7 +679,7 @@ write(std::ostream &out, int indent_level) const {
int total_digits = num_decimals + 4;
static const int max_digits = 32; // totally arbitrary
nassertv(total_digits <= max_digits);
char format_str[16];
char format_str[26];
sprintf(format_str, "%%%d.%df", total_digits, num_decimals);
indent(out, indent_level) << get_name() << ":\n";
@@ -708,7 +708,7 @@ timeline(std::ostream &out) const {
int total_digits = num_decimals + 4;
static const int max_digits = 32; // totally arbitrary
nassertv(total_digits <= max_digits);
char format_str[16];
char format_str[26];
sprintf(format_str, "%%%d.%df", total_digits, num_decimals);
int extra_indent_level = 0;
+7 -7
View File
@@ -1954,7 +1954,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -1977,7 +1977,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -2005,7 +2005,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -2034,7 +2034,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -2057,7 +2057,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -2086,7 +2086,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
@@ -2107,7 +2107,7 @@ fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler,
{
const TextureAttrib *texattrib;
if (_target_rs->get_attrib(texattrib)) {
size_t si = 0;
int si = 0;
for (int i = 0; i < texattrib->get_num_on_stages(); ++i) {
TextureStage *stage = texattrib->get_on_stage(i);
TextureStage::Mode mode = stage->get_mode();
+1 -1
View File
@@ -809,7 +809,7 @@ convert_primitive(const GeomVertexData *vertex_data,
// Check for a texture.
const TextureAttrib *ta;
if (net_state->get_attrib(ta)) {
for (size_t i = 0; i < ta->get_num_on_stages(); ++i) {
for (size_t i = 0; i < (size_t)ta->get_num_on_stages(); ++i) {
TextureStage *tex_stage = ta->get_on_stage(i);
EggTexture *egg_tex = get_egg_texture(ta->get_on_texture(tex_stage));
+1 -1
View File
@@ -1756,7 +1756,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
<< " is bound to image unit " << binding << "\n";
}
if (binding >= _glsl_img_inputs.size()) {
if (binding >= (GLint)_glsl_img_inputs.size()) {
_glsl_img_inputs.resize(binding + 1);
}
+16 -16
View File
@@ -427,14 +427,14 @@ calc_r_c(int &r, int &c, int n) const {
c = 0;
int i = row._row_start;
while (i < n - 1) {
if (_text_string[i]._character != text_soft_hyphen_key &&
_text_string[i]._character != text_soft_break_key) {
if (_text_string[i]._character != (char32_t)text_soft_hyphen_key &&
_text_string[i]._character != (char32_t)text_soft_break_key) {
++c;
}
++i;
}
if (_text_string[n - 1]._character != text_soft_hyphen_key &&
_text_string[n - 1]._character != text_soft_break_key) {
if (_text_string[n - 1]._character != (char32_t)text_soft_hyphen_key &&
_text_string[n - 1]._character != (char32_t)text_soft_break_key) {
++c;
if (_text_string[n - 1]._character == '\n') {
is_real_char = false;
@@ -478,8 +478,8 @@ calc_index(int r, int c) const {
// we have to scan past them to get n precisely.
int n = row._row_start;
while (c > 0) {
if (_text_string[n]._character != text_soft_hyphen_key &&
_text_string[n]._character != text_soft_break_key) {
if (_text_string[n]._character != (char32_t)text_soft_hyphen_key &&
_text_string[n]._character != (char32_t)text_soft_break_key) {
--c;
}
++n;
@@ -797,13 +797,13 @@ scan_wtext(TextAssembler::TextString &output_string,
const wstring::const_iterator &send,
TextAssembler::ComputedProperties *current_cprops) {
while (si != send) {
if ((*si) == text_push_properties_key) {
if ((*si) == (wchar_t)text_push_properties_key) {
// This indicates a nested properties structure. Pull off the name of
// the TextProperties structure, which is everything until the next
// text_push_properties_key.
wstring wname;
++si;
while (si != send && (*si) != text_push_properties_key) {
while (si != send && (*si) != (wchar_t)text_push_properties_key) {
wname += (*si);
++si;
}
@@ -834,20 +834,20 @@ scan_wtext(TextAssembler::TextString &output_string,
}
}
} else if ((*si) == text_pop_properties_key) {
} else if ((*si) == (wchar_t)text_pop_properties_key) {
// This indicates the undoing of a previous push_properties_key. We
// simply return to the previous level.
++si;
return;
} else if ((*si) == text_embed_graphic_key) {
} else if ((*si) == (wchar_t)text_embed_graphic_key) {
// This indicates an embedded graphic. Pull off the name of the
// TextGraphic structure, which is everything until the next
// text_embed_graphic_key.
wstring graphic_wname;
++si;
while (si != send && (*si) != text_embed_graphic_key) {
while (si != send && (*si) != (wchar_t)text_embed_graphic_key) {
graphic_wname += (*si);
++si;
}
@@ -979,7 +979,7 @@ wordwrap_text() {
}
if (isspacew(_text_string[q]._character) ||
_text_string[q]._character == text_soft_break_key) {
_text_string[q]._character == (char32_t)text_soft_break_key) {
if (!last_was_space) {
any_spaces = true;
// We only care about logging whether there is a soft-hyphen
@@ -996,7 +996,7 @@ wordwrap_text() {
// A soft hyphen character is not printed, but marks a point at which we
// might hyphenate a word if we need to.
if (_text_string[q]._character == text_soft_hyphen_key) {
if (_text_string[q]._character == (char32_t)text_soft_hyphen_key) {
if (wordwrap_width > 0.0f) {
// We only consider this as a possible hyphenation point if (a) it
// is not the very first character, and (b) there is enough room for
@@ -1103,8 +1103,8 @@ wordwrap_text() {
}
for (size_t pi = p; pi < q; pi++) {
if (_text_string[pi]._character != text_soft_hyphen_key &&
_text_string[pi]._character != text_soft_break_key) {
if (_text_string[pi]._character != (char32_t)text_soft_hyphen_key &&
_text_string[pi]._character != (char32_t)text_soft_break_key) {
_text_block.back()._string.push_back(_text_string[pi]);
} else {
_text_block.back()._got_soft_hyphens = true;
@@ -1547,7 +1547,7 @@ assemble_row(TextAssembler::TextRow &row,
xpos = (floor(xpos / tab_width) + 1.0f) * tab_width;
prev_char = -1;
} else if (character == text_soft_hyphen_key) {
} else if (character == (char32_t)text_soft_hyphen_key) {
// And so is the 'soft-hyphen' key character.
} else if (graphic != nullptr) {
+1 -1
View File
@@ -106,7 +106,7 @@ get_scores(int subdiv, int across, double ratio,
*/
void IsoPlacer::
place(int count, pvector<double> &iso_points) {
int i;
//int i;
/*
// Count up the average curvature.