comparison Discovery/Src/show_logbook.c @ 632:2586f7b734f4

Warnings: Solved warnings related to possible problems with string length in combination with sprintf usage
author Ideenmodellierer
date Tue, 23 Feb 2021 21:55:52 +0100
parents a594a778c883
children 269e57ac4e56
comparison
equal deleted inserted replaced
631:49a662df8210 632:2586f7b734f4
133 { 133 {
134 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]"); 134 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"[m]");
135 } 135 }
136 136
137 // winsmal.left = wintemp.left - 48; 137 // winsmal.left = wintemp.left - 48;
138 char msg[3]; 138 char msg[10];
139 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5; 139 float deltaline = ((float)(wintemp.bottom - wintemp.top))/5;
140 for(int i = 1; i<=5; i++) 140 for(int i = 1; i<=5; i++)
141 { 141 {
142 winsmal.top = wintemp.top + deltaline * i - 14; 142 winsmal.top = wintemp.top + deltaline * i - 14;
143 winsmal.bottom = winsmal.top + 16; 143 winsmal.bottom = winsmal.top + 16;
144 144
145 // winsmal.right = wintemp.left - 2; 145 // winsmal.right = wintemp.left - 2;
146 snprintf(msg,5,"%i",unit_depth_integer(i * vstep)); 146 snprintf(msg,10,"%i",unit_depth_integer(i * vstep));
147 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); 147 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg);
148 } 148 }
149 149
150 //vertical (Time) ******************************************************************* 150 //vertical (Time) *******************************************************************
151 //--- calc time lines and labels -- 151 //--- calc time lines and labels --
175 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"min"); 175 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,"min");
176 for(int i = 1; i<=lines; i++) 176 for(int i = 1; i<=lines; i++)
177 { 177 {
178 winsmal.left= wintemp.left + vdeltaline * i - 15; 178 winsmal.left= wintemp.left + vdeltaline * i - 15;
179 winsmal.right = winsmal.left + 30; 179 winsmal.right = winsmal.left + 30;
180 snprintf(msg,5,"%3i",i * timestep); 180 snprintf(msg,10,"%3i",i * timestep);
181 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg); 181 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_GasSensor1,msg);
182 } 182 }
183 winsmal.left = wintemp.left;// - 9; 183 winsmal.left = wintemp.left;// - 9;
184 winsmal.top = wintemp.top - 40; 184 winsmal.top = wintemp.top - 40;
185 winsmal.right = winsmal.left + 60; 185 winsmal.right = winsmal.left + 60;
783 &minVal, &maxVal, &newTop, &newBottom, 783 &minVal, &maxVal, &newTop, &newBottom,
784 &step, &maxValTop); 784 &step, &maxValTop);
785 785
786 // temperature in 1/10 �C 786 // temperature in 1/10 �C
787 int deltaline = (1 + wintemp.bottom - wintemp.top)/5; 787 int deltaline = (1 + wintemp.bottom - wintemp.top)/5;
788 char msg[3]; 788 char msg[15];
789 int tmp = maxValTop; 789 int tmp = maxValTop;
790 int converted; 790 int converted;
791 for(int i = 1; i<=5; i++) 791 for(int i = 1; i<=5; i++)
792 { 792 {
793 tmp -= step; 793 tmp -= step;
800 //if(tmp < 0) 800 //if(tmp < 0)
801 //break; 801 //break;
802 winsmal.top = wintemp.top + deltaline * i - 14; 802 winsmal.top = wintemp.top + deltaline * i - 14;
803 winsmal.bottom = winsmal.top + 16; 803 winsmal.bottom = winsmal.top + 16;
804 if((converted >= 0) && (converted < 100)) 804 if((converted >= 0) && (converted < 100))
805 snprintf(msg,2,"%1i",converted); 805 snprintf(msg,15,"%1i",converted);
806 else 806 else
807 snprintf(msg,3,"%2i",converted); 807 snprintf(msg,15,"%2i",converted);
808 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg); 808 Gfx_write_label_var(hgfx, winsmal.left, winsmal.right,winsmal.top, &FontT24,CLUT_LogbookTemperature,msg);
809 } 809 }
810 810
811 811
812 //--- print temperature graph --- 812 //--- print temperature graph ---