Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-12 10:33:21 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-12 10:33:21 +0400
commit0d36225dd1e8ded87949d157fedb07f9d949cb30 (patch)
tree7ee65f80bc76e4d7d1e19c0ac352be957b8b69b1 /source/blender/blenfont
parent7b707fff56209d8997a2d52dde6f38e67be56c31 (diff)
quiet sign conversion warnings and reduce sign conversion for BLI_string, and BLF.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_font.c5
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c15
-rw-r--r--source/blender/blenfont/intern/blf_internal.h4
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h14
4 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index f2c36475870..3a327d6c794 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -58,6 +58,9 @@
#include "blf_internal_types.h"
#include "blf_internal.h"
+#ifdef __GNUC__
+# pragma GCC diagnostic error "-Wsign-conversion"
+#endif
/* freetype2 handle ONLY for this file!. */
static FT_Library ft_lib;
@@ -72,7 +75,7 @@ void blf_font_exit(void)
FT_Done_FreeType(ft_lib);
}
-void blf_font_size(FontBLF *font, int size, int dpi)
+void blf_font_size(FontBLF *font, unsigned int size, unsigned int dpi)
{
GlyphCacheBLF *gc;
FT_Error err;
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index a6b04b24399..d683378c7ce 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -55,8 +55,11 @@
#include "blf_internal_types.h"
#include "blf_internal.h"
+#ifdef __GNUC__
+# pragma GCC diagnostic error "-Wsign-conversion"
+#endif
-GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
+GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, unsigned int size, unsigned int dpi)
{
GlyphCacheBLF *p;
@@ -167,18 +170,18 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
gc->textures = (GLuint *)realloc((void *)gc->textures, sizeof(GLuint) * gc->ntex);
}
- gc->p2_width = blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
+ gc->p2_width = (int)blf_next_p2((unsigned int)((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2)));
if (gc->p2_width > font->max_tex_size)
gc->p2_width = font->max_tex_size;
i = (int)((gc->p2_width - (gc->pad * 2)) / gc->max_glyph_width);
- gc->p2_height = blf_next_p2(((gc->num_glyphs / i) + 1) * gc->max_glyph_height);
+ gc->p2_height = (int)blf_next_p2((unsigned int)(((gc->num_glyphs / i) + 1) * gc->max_glyph_height));
if (gc->p2_height > font->max_tex_size)
gc->p2_height = font->max_tex_size;
tot_mem = gc->p2_width * gc->p2_height;
- buf = (unsigned char *)MEM_callocN(tot_mem, __func__);
+ buf = (unsigned char *)MEM_callocN((size_t)tot_mem, __func__);
glGenTextures(1, &gc->textures[gc->cur_tex]);
glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex]));
@@ -269,8 +272,8 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
}
}
- g->bitmap = (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
- memcpy((void *)g->bitmap, (void *)bitmap.buffer, g->width * g->height);
+ g->bitmap = (unsigned char *)MEM_mallocN((size_t)(g->width * g->height), "glyph bitmap");
+ memcpy((void *)g->bitmap, (void *)bitmap.buffer, (size_t)(g->width * g->height));
}
g->advance = ((float)slot->advance.x) / 64.0f;
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index b1301be46fd..2cb453cdf55 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -50,7 +50,7 @@ struct FontBLF *blf_font_new(const char *name, const char *filename);
struct FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int mem_size);
void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, int mem_size);
-void blf_font_size(struct FontBLF *font, int size, int dpi);
+void blf_font_size(struct FontBLF *font, unsigned int size, unsigned int dpi);
void blf_font_draw(struct FontBLF *font, const char *str, size_t len);
void blf_font_draw_ascii(struct FontBLF *font, const char *str, size_t len);
int blf_font_draw_mono(struct FontBLF *font, const char *str, size_t len, int cwidth);
@@ -62,7 +62,7 @@ float blf_font_height(struct FontBLF *font, const char *str);
float blf_font_fixed_width(struct FontBLF *font);
void blf_font_free(struct FontBLF *font);
-struct GlyphCacheBLF *blf_glyph_cache_find(struct FontBLF *font, int size, int dpi);
+struct GlyphCacheBLF *blf_glyph_cache_find(struct FontBLF *font, unsigned int size, unsigned int dpi);
struct GlyphCacheBLF *blf_glyph_cache_new(struct FontBLF *font);
void blf_glyph_cache_clear(struct FontBLF *font);
void blf_glyph_cache_free(struct GlyphCacheBLF *gc);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index de6e70e4461..36294bfe3b5 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -36,10 +36,10 @@ typedef struct GlyphCacheBLF {
struct GlyphCacheBLF *prev;
/* font size. */
- int size;
+ unsigned int size;
/* and dpi. */
- int dpi;
+ unsigned int dpi;
/* and the glyphs. */
ListBase bucket[257];
@@ -51,7 +51,7 @@ typedef struct GlyphCacheBLF {
GLuint *textures;
/* size of the array. */
- int ntex;
+ unsigned int ntex;
/* and the last texture, aka. the current texture. */
int cur_tex;
@@ -63,7 +63,7 @@ typedef struct GlyphCacheBLF {
int y_offs;
/* and the space from one to other. */
- unsigned int pad;
+ int pad;
/* and the bigger glyph in the font. */
int max_glyph_width;
@@ -194,16 +194,16 @@ typedef struct FontBLF {
rctf clip_rec;
/* font dpi (default 72). */
- int dpi;
+ unsigned int dpi;
/* font size. */
- int size;
+ unsigned int size;
/* max texture size. */
int max_tex_size;
/* cache current OpenGL texture to save calls into the API */
- int tex_bind_state;
+ unsigned int tex_bind_state;
/* font options. */
int flags;