[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master afce542 1/2: * src/*, graph/*: s/unsigned int/s
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master afce542 1/2: * src/*, graph/*: s/unsigned int/size_t/ where appropriate. |
Date: |
Thu, 5 Nov 2020 23:43:14 -0500 (EST) |
branch: master
commit afce542e31ecb8f8079effecc8c63faacbe74766
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
* src/*, graph/*: s/unsigned int/size_t/ where appropriate.
---
ChangeLog | 4 ++++
graph/grfill.c | 4 ++--
graph/grswizzle.c | 10 +++++-----
graph/x11/grx11.c | 2 +-
src/ftdiff.c | 10 +++++-----
src/ftgamma.c | 2 +-
6 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cd0ec6e..ae45744 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2020-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
+ * src/*, graph/*: s/unsigned int/size_t/ where appropriate.
+
+2020-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
+
* graph/*.*: s/0/NULL/ where appropriate.
2020-11-04 Alexei Podtelezhnikov <apodtele@gmail.com>
diff --git a/graph/grfill.c b/graph/grfill.c
index 9ffeb9f..2256f5d 100644
--- a/graph/grfill.c
+++ b/graph/grfill.c
@@ -71,7 +71,7 @@ gr_fill_hline_8( unsigned char* line,
int width,
grColor color )
{
- memset( line+x, color.value, (unsigned int)width );
+ memset( line+x, color.value, (size_t)width );
}
static void
@@ -99,7 +99,7 @@ gr_fill_hline_24( unsigned char* line,
line += 3*x;
if (r == g && g == b)
- memset( line, r, (unsigned int)(width*3) );
+ memset( line, r, (size_t)(width*3) );
else
{
for ( ; width > 0; width--, line += 3 )
diff --git a/graph/grswizzle.c b/graph/grswizzle.c
index 8ae2a13..18b6f15 100644
--- a/graph/grswizzle.c
+++ b/graph/grswizzle.c
@@ -104,7 +104,7 @@ copy_line_generic( unsigned char* from,
if (x+width < buff_width)
width += 1;
- memcpy( to, from, (unsigned int)( width * pix_bytes ) );
+ memcpy( to, from, (size_t)width * (size_t)pix_bytes );
}
@@ -175,7 +175,7 @@ filter_rect_generic( unsigned char* read_buff,
read_buff += y*read_pitch + pix_bytes*x;
write_buff += y*write_pitch + pix_bytes*x;
- memset( temp_lines, 0, (unsigned int)(3 * pix_bytes * ( width + 2 ) ) );
+ memset( temp_lines, 0, (size_t)(3 * pix_bytes * ( width + 2 ) ) );
lines[0] = (unsigned char*) temp_lines;
lines[1] = lines[0] + pix_bytes*(width+2);
@@ -218,7 +218,7 @@ filter_rect_generic( unsigned char* read_buff,
/* process last line */
if (y+height == buff_height)
- memset( lines[2], 0, (unsigned int)( ( width + 2 ) * pix_bytes ) );
+ memset( lines[2], 0, (size_t)( ( width + 2 ) * pix_bytes ) );
else
copy_line_generic( read_buff + read_pitch, lines[2],
x, width, buff_width, pix_bytes );
@@ -549,7 +549,7 @@ gr_swizzle_generic( unsigned char* read_buff,
{
unsigned char* temp_lines;
unsigned char temp_local[ 2048 ];
- unsigned int temp_size;
+ size_t temp_size;
if ( height <= 0 || width <= 0 )
return;
@@ -564,7 +564,7 @@ gr_swizzle_generic( unsigned char* read_buff,
* working 'lines', each of them having width+2 pixels. the first
* and last pixels being always 0
*/
- temp_size = (unsigned int)( ( width + 2 ) * 3 * pixbytes );
+ temp_size = (size_t)( ( width + 2 ) * 3 * pixbytes );
if ( temp_size <= sizeof ( temp_local ) )
{
/* try to use stack allocation, which is a lot faster than malloc */
diff --git a/graph/x11/grx11.c b/graph/x11/grx11.c
index a982a42..cc6d167 100644
--- a/graph/x11/grx11.c
+++ b/graph/x11/grx11.c
@@ -472,7 +472,7 @@
for ( ; h > 0; h-- )
{
- memcpy( line_write, line_read, (unsigned int)( blit->width * 3 ) );
+ memcpy( line_write, line_read, (size_t)blit->width * 3 );
line_read += blit->src_pitch;
line_write += blit->dst_pitch;
}
diff --git a/src/ftdiff.c b/src/ftdiff.c
index 3bd0cff..e6a9985 100644
--- a/src/ftdiff.c
+++ b/src/ftdiff.c
@@ -1034,7 +1034,7 @@
if ( bit->mode == gr_pixel_mode_gray )
memset( bit->buffer,
display->back_color.value,
- (unsigned int)( pitch * bit->rows ) );
+ (size_t)pitch * (size_t)bit->rows );
else
{
unsigned char* p = bit->buffer;
@@ -1593,18 +1593,18 @@
fprintf( stderr, "could not read textfile '%s'\n", textfile );
else
{
- int tsize;
+ size_t tsize;
fseek( tfile, 0, SEEK_END );
- tsize = ftell( tfile );
+ tsize = (size_t)ftell( tfile );
fseek( tfile, 0, SEEK_SET );
- text = (char*)malloc( (unsigned int)( tsize + 1 ) );
+ text = (char*)malloc( tsize + 1 );
if ( text )
{
- if ( !fread( text, (unsigned int)tsize, 1, tfile ) )
+ if ( !fread( text, tsize, 1, tfile ) )
{
fprintf( stderr, "read error\n" );
text = (char *)default_text;
diff --git a/src/ftgamma.c b/src/ftgamma.c
index de75687..846f203 100644
--- a/src/ftgamma.c
+++ b/src/ftgamma.c
@@ -227,7 +227,7 @@
memset( display->bitmap->buffer,
100,
- (unsigned int)( pitch * display->bitmap->rows ) );
+ (size_t)pitch * (size_t)display->bitmap->rows );
grWriteCellString( display->bitmap, 0, 0, "Gamma grid",
display->fore_color );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master afce542 1/2: * src/*, graph/*: s/unsigned int/size_t/ where appropriate.,
Alexei Podtelezhnikov <=