1
0
Fork 0

More snprintf conversions

This commit is contained in:
James Turner 2023-01-09 15:04:07 +00:00
parent 01b93cb8a0
commit 36df4c38de
2 changed files with 6 additions and 6 deletions

View file

@ -694,17 +694,17 @@ std::string FGCom::computePhoneNumber(const double& freq, const std::string& ica
char tmp[5];
/*Convert ICAO to ASCII */
sprintf( tmp, "%4s", icao.c_str() );
snprintf(tmp, 5, "%4s", icao.c_str());
/*Built the phone number */
sprintf( exten,
snprintf(exten, 32,
"%02d%02d%02d%02d%02d%06d",
01,
tmp[0],
tmp[1],
tmp[1],
tmp[2],
tmp[3],
(int) (freq * 1000 + 0.5) );
(int)(freq * 1000 + 0.5));
exten[16] = '\0';
snprintf( phoneNumber,

View file

@ -66,9 +66,9 @@ bool FGGarmin::gen_message()
// $PGRMZ,AAAA.A,F,T*XX
if (mMetric)
sprintf( nmea, "$PGRMZ,%.1f,M,3", altitude_ft * SG_FEET_TO_METER );
snprintf(nmea, 256, "$PGRMZ,%.1f,M,3", altitude_ft * SG_FEET_TO_METER);
else
sprintf( nmea, "$PGRMZ,%.1f,F,3", altitude_ft );
snprintf(nmea, 256, "$PGRMZ,%.1f,F,3", altitude_ft);
add_with_checksum(nmea, 256);
}