From 41cdc22a5ba4f7c2d747c37957ed2b2705eb3758 Mon Sep 17 00:00:00 2001 From: Tobias Badertscher Date: Sat, 23 Apr 2016 18:18:32 +0200 Subject: [PATCH] Add const specifier for not changed variables. --- ugui.c | 26 +++++++++++++------------- ugui.h | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ugui.c b/ugui.c index 02b2a04..ae89dd6 100644 --- a/ugui.c +++ b/ugui.c @@ -1,14 +1,14 @@ /* -------------------------------------------------------------------------------- */ -/* -- µGUI - Generic GUI module (C)Achim Döbler, 2015 -- */ +/* -- µGUI - Generic GUI module (C)Achim Döbler, 2015 -- */ /* -------------------------------------------------------------------------------- */ -// µGUI is a generic GUI module for embedded systems. +// µGUI is a generic GUI module for embedded systems. // This is a free software that is open for education, research and commercial // developments under license policy of following terms. // -// Copyright (C) 2015, Achim Döbler, all rights reserved. +// Copyright (C) 2015, Achim Döbler, all rights reserved. // URL: http://www.embeddedlightning.com/ // -// * The µGUI module is a free software and there is NO WARRANTY. +// * The µGUI module is a free software and there is NO WARRANTY. // * No restriction on use. You can use, modify and redistribute it for // personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. // * Redistributions of source code must retain the above copyright notice. @@ -27,7 +27,7 @@ // for giving valuable suggestions regarding real-time os support. // // Samuel Kleiser -// for reporting bugs and giving examples how to improve µGUI. +// for reporting bugs and giving examples how to improve µGUI. /* -------------------------------------------------------------------------------- */ /* -- REVISION HISTORY -- */ /* -------------------------------------------------------------------------------- */ @@ -4936,7 +4936,7 @@ void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ) } } -void UG_PutString( UG_S16 x, UG_S16 y, char* str ) +void UG_PutString( UG_S16 x, UG_S16 y, const char* str ) { UG_S16 xp,yp; UG_U8 cw; @@ -4973,7 +4973,7 @@ void UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc ) _UG_PutChar(chr,x,y,fc,bc,&gui->font); } -void UG_ConsolePutString( char* str ) +void UG_ConsolePutString( const char* str ) { char chr; UG_U8 cw; @@ -5323,9 +5323,9 @@ void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const for( i=0;ip[index++]; - color = (((fc & 0xFF) * b + (bc & 0xFF) * (256 - b)) >> 8) & 0xFF |//Blue component - (((fc & 0xFF00) * b + (bc & 0xFF00) * (256 - b)) >> 8) & 0xFF00|//Green component - (((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 - b)) >> 8) & 0xFF0000; //Red component + color = ((((fc & 0xFF) * b + (bc & 0xFF) * (256 - b)) >> 8) & 0xFF) | //Blue component + ((((fc & 0xFF00) * b + (bc & 0xFF00) * (256 - b)) >> 8) & 0xFF00) | //Green component + ((((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 - b)) >> 8) & 0xFF0000); //Red component push_pixel(color); } index += font->char_width - actual_char_width; @@ -5372,9 +5372,9 @@ void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const for( i=0;ip[index++]; - color = (((fc & 0xFF) * b + (bc & 0xFF) * (256 - b)) >> 8) & 0xFF |//Blue component - (((fc & 0xFF00) * b + (bc & 0xFF00) * (256 - b)) >> 8) & 0xFF00|//Green component - (((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 - b)) >> 8) & 0xFF0000; //Red component + color = ((((fc & 0xFF) * b + (bc & 0xFF) * (256 - b)) >> 8) & 0xFF) |//Blue component + ((((fc & 0xFF00) * b + (bc & 0xFF00) * (256 - b)) >> 8) & 0xFF00) |//Green component + ((((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 - b)) >> 8) & 0xFF0000); //Red component gui->pset(xo,yo,color); xo++; } diff --git a/ugui.h b/ugui.h index 628eaec..872126a 100644 --- a/ugui.h +++ b/ugui.h @@ -895,9 +895,9 @@ void UG_DrawCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c ); void UG_FillCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c ); void UG_DrawArc( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_U8 s, UG_COLOR c ); void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ); -void UG_PutString( UG_S16 x, UG_S16 y, char* str ); +void UG_PutString( UG_S16 x, UG_S16 y, const char* str ); void UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc ); -void UG_ConsolePutString( char* str ); +void UG_ConsolePutString( const char* str ); void UG_ConsoleSetArea( UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye ); void UG_ConsoleSetForecolor( UG_COLOR c ); void UG_ConsoleSetBackcolor( UG_COLOR c );