fix warnings caused by sprintf()
note : %hhu is C99, old mingw32 compiler complains about it
This commit is contained in:
parent
b5751ebda8
commit
848ec95e92
@ -1855,9 +1855,7 @@ void Display_modes_list(short list_start, short cursor_position)
|
|||||||
else
|
else
|
||||||
text_color=MC_White;
|
text_color=MC_White;
|
||||||
}
|
}
|
||||||
Num2str(Video_mode[current_mode].Width,str,4);
|
snprintf(str, sizeof(str), "%4hu %4hu", Video_mode[current_mode].Width, Video_mode[current_mode].Height);
|
||||||
str[4]=' ';
|
|
||||||
Num2str(Video_mode[current_mode].Height,str+5,4);
|
|
||||||
|
|
||||||
if(Video_mode[current_mode].Fullscreen == 0)
|
if(Video_mode[current_mode].Fullscreen == 0)
|
||||||
memcpy(str+9," Window ",20);
|
memcpy(str+9," Window ",20);
|
||||||
@ -1915,7 +1913,7 @@ void Button_Resolution(int btn)
|
|||||||
short list_start;
|
short list_start;
|
||||||
short cursor_position;
|
short cursor_position;
|
||||||
short temp;
|
short temp;
|
||||||
char str[5];
|
char str[8];
|
||||||
T_Special_button * input_width_button, * input_button_height;
|
T_Special_button * input_width_button, * input_button_height;
|
||||||
T_Dropdown_button * pixel_button;
|
T_Dropdown_button * pixel_button;
|
||||||
static const char *pixel_ratio_labels[PIXEL_MAX] ={
|
static const char *pixel_ratio_labels[PIXEL_MAX] ={
|
||||||
@ -4197,7 +4195,7 @@ void Button_Airbrush(int btn)
|
|||||||
|
|
||||||
void Refresh_airbrush_settings(byte selected_color, byte update_slider)
|
void Refresh_airbrush_settings(byte selected_color, byte update_slider)
|
||||||
{
|
{
|
||||||
char str[3];
|
char str[4];
|
||||||
|
|
||||||
if (update_slider)
|
if (update_slider)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -48,6 +48,10 @@
|
|||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------- Menu dans lequel on tagge des couleurs (genre Stencil) ----------
|
//---------- Menu dans lequel on tagge des couleurs (genre Stencil) ----------
|
||||||
void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_cancel, const char *help_section, word close_shortcut)
|
void Menu_tag_colors(char * window_title, byte * table, byte * mode, byte can_cancel, const char *help_section, word close_shortcut)
|
||||||
{
|
{
|
||||||
@ -1052,12 +1056,12 @@ void Button_Grid_menu(void)
|
|||||||
|
|
||||||
Print_in_window(11,26, "X:",MC_Dark,MC_Light);
|
Print_in_window(11,26, "X:",MC_Dark,MC_Light);
|
||||||
input_x_button = Window_set_input_button(29,24,3); // 3
|
input_x_button = Window_set_input_button(29,24,3); // 3
|
||||||
Num2str(chosen_X,str,3);
|
Num2str(MIN(chosen_X, 999), str, 3);
|
||||||
Window_input_content(input_x_button,str);
|
Window_input_content(input_x_button,str);
|
||||||
|
|
||||||
Print_in_window(11,47, "Y:",MC_Dark,MC_Light);
|
Print_in_window(11,47, "Y:",MC_Dark,MC_Light);
|
||||||
input_y_button = Window_set_input_button(29,45,3); // 4
|
input_y_button = Window_set_input_button(29,45,3); // 4
|
||||||
Num2str(chosen_Y,str,3);
|
Num2str(MIN(chosen_Y, 999), str, 3);
|
||||||
Window_input_content(input_y_button,str);
|
Window_input_content(input_y_button,str);
|
||||||
|
|
||||||
Print_in_window(77,26,"dX:",MC_Dark,MC_Light);
|
Print_in_window(77,26,"dX:",MC_Dark,MC_Light);
|
||||||
@ -1086,7 +1090,7 @@ void Button_Grid_menu(void)
|
|||||||
switch (clicked_button)
|
switch (clicked_button)
|
||||||
{
|
{
|
||||||
case 3 :
|
case 3 :
|
||||||
Num2str(chosen_X,str,3);
|
Num2str(MIN(chosen_X, 999), str, 3);
|
||||||
Readline(31,26,str,3,INPUT_TYPE_INTEGER);
|
Readline(31,26,str,3,INPUT_TYPE_INTEGER);
|
||||||
chosen_X=atoi(str);
|
chosen_X=atoi(str);
|
||||||
// On corrige les dimensions
|
// On corrige les dimensions
|
||||||
@ -1108,7 +1112,7 @@ void Button_Grid_menu(void)
|
|||||||
Display_cursor();
|
Display_cursor();
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
Num2str(chosen_Y,str,3);
|
Num2str(MIN(chosen_Y, 999), str, 3);
|
||||||
Readline(31,47,str,3,INPUT_TYPE_INTEGER);
|
Readline(31,47,str,3,INPUT_TYPE_INTEGER);
|
||||||
chosen_Y=atoi(str);
|
chosen_Y=atoi(str);
|
||||||
// On corrige les dimensions
|
// On corrige les dimensions
|
||||||
@ -1235,7 +1239,7 @@ void Button_Smooth_menu(void)
|
|||||||
word x,y,i,j;
|
word x,y,i,j;
|
||||||
byte chosen_matrix[3][3];
|
byte chosen_matrix[3][3];
|
||||||
T_Special_button * matrix_input[3][3];
|
T_Special_button * matrix_input[3][3];
|
||||||
char str[3];
|
char str[4];
|
||||||
|
|
||||||
Open_window(142,109,"Smooth");
|
Open_window(142,109,"Smooth");
|
||||||
|
|
||||||
|
|||||||
@ -1179,7 +1179,7 @@ void Fill_general(byte fill_color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Affichage d'un point pour une preview en xor
|
// Affichage d'un point pour une preview en xor
|
||||||
void Pixel_figure_preview_xor(short x_pos,short y_pos,byte color)
|
void Pixel_figure_preview_xor(word x_pos,word y_pos,byte color)
|
||||||
{
|
{
|
||||||
(void)color; // unused
|
(void)color; // unused
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ void Replace(byte New_color);
|
|||||||
|
|
||||||
void Pixel_figure_preview (word x_pos,word y_pos,byte color);
|
void Pixel_figure_preview (word x_pos,word y_pos,byte color);
|
||||||
void Pixel_figure_preview_auto(word x_pos,word y_pos);
|
void Pixel_figure_preview_auto(word x_pos,word y_pos);
|
||||||
void Pixel_figure_preview_xor(short x_pos,short y_pos,byte color);
|
void Pixel_figure_preview_xor(word x_pos,word y_pos,byte color);
|
||||||
void Pixel_figure_preview_xorback(word x_pos,word y_pos,byte color);
|
void Pixel_figure_preview_xorback(word x_pos,word y_pos,byte color);
|
||||||
void Pixel_figure_in_brush(word x_pos,word y_pos,byte color);
|
void Pixel_figure_in_brush(word x_pos,word y_pos,byte color);
|
||||||
|
|
||||||
|
|||||||
@ -400,17 +400,11 @@ void Pre_load(T_IO_Context *context, short width, short height, long file_size,
|
|||||||
if (context->Original_width != 0)
|
if (context->Original_width != 0)
|
||||||
{
|
{
|
||||||
if (context->Original_width < 10000 && context->Original_height < 10000)
|
if (context->Original_width < 10000 && context->Original_height < 10000)
|
||||||
{
|
snprintf(str, sizeof(str), "%4hux%4hu", context->Original_width, context->Original_height);
|
||||||
Num2str(context->Original_width,str,4);
|
|
||||||
Num2str(context->Original_height,str+5,4);
|
|
||||||
str[4]='x';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ((width<10000) && (height<10000))
|
else if ((width<10000) && (height<10000))
|
||||||
{
|
{
|
||||||
Num2str(width,str,4);
|
snprintf(str, sizeof(str), "%4hux%4hu", width, height);
|
||||||
Num2str(height,str+5,4);
|
|
||||||
str[4]='x';
|
|
||||||
}
|
}
|
||||||
Print_in_window(101,59,str,MC_Black,MC_Light);
|
Print_in_window(101,59,str,MC_Black,MC_Light);
|
||||||
snprintf(str, sizeof(str), "%2dbpp", bpp);
|
snprintf(str, sizeof(str), "%2dbpp", bpp);
|
||||||
|
|||||||
@ -134,7 +134,7 @@ void Atari_Memory_free(unsigned long *stRam,unsigned long *ttRam);
|
|||||||
#else
|
#else
|
||||||
unsigned long Memory_free(void);
|
unsigned long Memory_free(void);
|
||||||
#endif
|
#endif
|
||||||
#define Num2str(a,b,c) sprintf(b,"%*lu",c,(long)(a))
|
#define Num2str(a,b,c) snprintf(b,sizeof(b),"%*lu",(int)c,(unsigned long)(a))
|
||||||
|
|
||||||
#define Dec2str(a,b,c) sprintf(b,"%.*f",c,(double)(a))
|
#define Dec2str(a,b,c) sprintf(b,"%.*f",c,(double)(a))
|
||||||
|
|
||||||
|
|||||||
@ -207,9 +207,7 @@ void Set_blue(byte color, short new_color, T_Palette palette)
|
|||||||
void Format_component(byte value, char *str)
|
void Format_component(byte value, char *str)
|
||||||
// Formate une chaine de 4 caractères+\0 : "nnn "
|
// Formate une chaine de 4 caractères+\0 : "nnn "
|
||||||
{
|
{
|
||||||
Num2str(value,str,3);
|
snprintf(str, 5, "%3u ", (unsigned)value);
|
||||||
str[3]=' ';
|
|
||||||
str[4]='\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spread_colors(short start,short end,T_Palette palette)
|
void Spread_colors(short start,short end,T_Palette palette)
|
||||||
@ -1013,11 +1011,11 @@ int Window_Histogram(unsigned char block_start, unsigned char block_end, dword*
|
|||||||
// When changing hovered color, update the info area
|
// When changing hovered color, update the info area
|
||||||
if (new_hovered_color!=hovered_color)
|
if (new_hovered_color!=hovered_color)
|
||||||
{
|
{
|
||||||
char str[12];
|
char str[20];
|
||||||
|
|
||||||
hovered_color=new_hovered_color;
|
hovered_color=new_hovered_color;
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
if (hovered_color==-1)
|
if (hovered_color < 0)
|
||||||
{
|
{
|
||||||
Window_rectangle(6+6*8,17,3*8,7,MC_Light);
|
Window_rectangle(6+6*8,17,3*8,7,MC_Light);
|
||||||
Update_window_area(6+6*8,17,3*8,7);
|
Update_window_area(6+6*8,17,3*8,7);
|
||||||
@ -1413,9 +1411,7 @@ void Button_Palette(int btn)
|
|||||||
block_end=temp_color;
|
block_end=temp_color;
|
||||||
|
|
||||||
// Affichage du n° de la couleur sélectionnée
|
// Affichage du n° de la couleur sélectionnée
|
||||||
Num2str(block_start,str ,3);
|
snprintf(str, sizeof(str), "%3hu\x1a%3hu", block_start, block_end); // 0x1a : flèche vers la droite
|
||||||
Num2str(block_end ,str+4,3);
|
|
||||||
str[3]=26; // Flèche vers la droite
|
|
||||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||||
|
|
||||||
// Affichage des jauges
|
// Affichage des jauges
|
||||||
@ -1430,9 +1426,7 @@ void Button_Palette(int btn)
|
|||||||
block_end=first_color;
|
block_end=first_color;
|
||||||
|
|
||||||
// Affichage du n° de la couleur sélectionnée
|
// Affichage du n° de la couleur sélectionnée
|
||||||
Num2str(block_start,str ,3);
|
snprintf(str, sizeof(str), "%3hu\x1a%3hu", block_start, block_end); // 0x1a : flèche vers la droite
|
||||||
Num2str(block_end ,str+4,3);
|
|
||||||
str[3]=26; // Flèche vers la droite
|
|
||||||
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
Print_in_window(COLOR_X,COLOR_Y,str,MC_Black,MC_Light);
|
||||||
|
|
||||||
// Affichage des jauges
|
// Affichage des jauges
|
||||||
@ -1844,9 +1838,7 @@ void Button_Palette(int btn)
|
|||||||
if (block_start!=block_end)
|
if (block_start!=block_end)
|
||||||
{
|
{
|
||||||
// Cas d'un bloc multi-couleur
|
// Cas d'un bloc multi-couleur
|
||||||
Num2str(block_start,str ,3);
|
snprintf(str, sizeof(str), "%3hu\x1a%3hu", block_start, block_end); // 0x1a : flèche vers la droite
|
||||||
Num2str(block_end ,str+4,3);
|
|
||||||
str[3]=26; // Flèche vers la droite
|
|
||||||
// Affichage dans le block de visu du bloc (dégradé) en cours
|
// Affichage dans le block de visu du bloc (dégradé) en cours
|
||||||
Display_grad_block_in_window(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,block_start,block_end);
|
Display_grad_block_in_window(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,block_start,block_end);
|
||||||
}
|
}
|
||||||
@ -1899,9 +1891,7 @@ void Button_Palette(int btn)
|
|||||||
if (block_start!=block_end)
|
if (block_start!=block_end)
|
||||||
{
|
{
|
||||||
// Cas d'un bloc multi-couleur
|
// Cas d'un bloc multi-couleur
|
||||||
Num2str(block_start,str ,3);
|
snprintf(str, sizeof(str), "%3hu\x1a%3hu", block_start, block_end); // 0x1a : flèche vers la droite
|
||||||
Num2str(block_end ,str+4,3);
|
|
||||||
str[3]=26; // Flèche vers la droite
|
|
||||||
// Affichage dans le block de visu du bloc (dégradé) en cours
|
// Affichage dans le block de visu du bloc (dégradé) en cours
|
||||||
Display_grad_block_in_window(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,block_start,block_end);
|
Display_grad_block_in_window(FGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,block_start,block_end);
|
||||||
}
|
}
|
||||||
@ -2908,7 +2898,7 @@ void Button_Secondary_palette(int btn)
|
|||||||
T_Scroller_button * lines_slider;
|
T_Scroller_button * lines_slider;
|
||||||
T_Scroller_button * rgb_scale_slider;
|
T_Scroller_button * rgb_scale_slider;
|
||||||
T_Scroller_button * gamma_slider;
|
T_Scroller_button * gamma_slider;
|
||||||
char str[4];
|
char str[8];
|
||||||
byte palette_vertical = Config.Palette_vertical;
|
byte palette_vertical = Config.Palette_vertical;
|
||||||
byte palette_cols, palette_lines;
|
byte palette_cols, palette_lines;
|
||||||
word rgb_scale;
|
word rgb_scale;
|
||||||
|
|||||||
@ -608,13 +608,13 @@ void Display_layerbar(void)
|
|||||||
}
|
}
|
||||||
if (Menu_bars[MENUBAR_ANIMATION].Visible)
|
if (Menu_bars[MENUBAR_ANIMATION].Visible)
|
||||||
{
|
{
|
||||||
char str[9];
|
char str[24];
|
||||||
// Rest of horizontal line
|
// Rest of horizontal line
|
||||||
Draw_bar_remainder(MENUBAR_ANIMATION, Menu_bars[MENUBAR_ANIMATION].Skin_width);
|
Draw_bar_remainder(MENUBAR_ANIMATION, Menu_bars[MENUBAR_ANIMATION].Skin_width);
|
||||||
// Frame# background rectangle
|
// Frame# background rectangle
|
||||||
// Block((Menu_bars[MENUBAR_ANIMATION].Skin_width)*Menu_factor_X,(0+Menu_bars[MENUBAR_ANIMATION].Top)*Menu_factor_Y+Menu_Y,8*8*Menu_factor_X,8*Menu_factor_Y,MC_Light);
|
// Block((Menu_bars[MENUBAR_ANIMATION].Skin_width)*Menu_factor_X,(0+Menu_bars[MENUBAR_ANIMATION].Top)*Menu_factor_Y+Menu_Y,8*8*Menu_factor_X,8*Menu_factor_Y,MC_Light);
|
||||||
// Frame #/#
|
// Frame #/#
|
||||||
snprintf(str, 8, "%3d/%3d", Main.current_layer+1, Main.backups->Pages->Nb_layers);
|
snprintf(str, sizeof(str), "%3d/%3d", Main.current_layer+1, Main.backups->Pages->Nb_layers);
|
||||||
Print_general((59)*Menu_factor_X,(Menu_bars[MENUBAR_ANIMATION].Top+3)*Menu_factor_Y+Menu_Y,str,MC_Black,MC_Light);
|
Print_general((59)*Menu_factor_X,(Menu_bars[MENUBAR_ANIMATION].Top+3)*Menu_factor_Y+Menu_Y,str,MC_Black,MC_Light);
|
||||||
Update_rect(
|
Update_rect(
|
||||||
(59)*Menu_factor_X,
|
(59)*Menu_factor_X,
|
||||||
@ -1077,9 +1077,9 @@ void Print_coordinates(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Num2str((dword)Paintbrush_X,temp,4);
|
Num2str(Paintbrush_X,temp,4);
|
||||||
Print_in_menu(temp,2);
|
Print_in_menu(temp,2);
|
||||||
Num2str((dword)Paintbrush_Y,temp,4);
|
Num2str(Paintbrush_Y,temp,4);
|
||||||
Print_in_menu(temp,11);
|
Print_in_menu(temp,11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user