SCR: Improve validity testing of settings on Mac Screensaver control panel.

This commit is contained in:
Charlie Fenton 2015-03-09 01:16:08 -07:00
parent ab59d88af4
commit 38adc14676
1 changed files with 4 additions and 0 deletions

View File

@ -552,24 +552,28 @@ print_to_log_file(" Entered closeSheetSave");
gBlankingTime = [ mBlankingTimeString intValue ]; gBlankingTime = [ mBlankingTimeString intValue ];
scanner = [ NSScanner scannerWithString:mBlankingTimeString]; scanner = [ NSScanner scannerWithString:mBlankingTimeString];
if (![ scanner scanInt:&period ]) goto Bad; if (![ scanner scanInt:&period ]) goto Bad;
if (![ scanner isAtEnd ]) goto Bad;
if ((period < 0) || (period > 999)) goto Bad; if ((period < 0) || (period > 999)) goto Bad;
gBlankingTime = period; gBlankingTime = period;
mDefaultPeriodString = [ mDefaultPeriodTextField stringValue ]; mDefaultPeriodString = [ mDefaultPeriodTextField stringValue ];
scanner2 = [ scanner initWithString:mDefaultPeriodString]; scanner2 = [ scanner initWithString:mDefaultPeriodString];
if (![ scanner2 scanInt:&period ]) goto Bad; if (![ scanner2 scanInt:&period ]) goto Bad;
if (![ scanner2 isAtEnd ]) goto Bad;
if ((period < 0) || (period > 999)) goto Bad; if ((period < 0) || (period > 999)) goto Bad;
setGFXDefaultPeriod((double)(period * 60)); setGFXDefaultPeriod((double)(period * 60));
mSciencePeriodString = [ mSciencePeriodTextField stringValue ]; mSciencePeriodString = [ mSciencePeriodTextField stringValue ];
scanner2 = [ scanner initWithString:mSciencePeriodString]; scanner2 = [ scanner initWithString:mSciencePeriodString];
if (![ scanner2 scanInt:&period ]) goto Bad; if (![ scanner2 scanInt:&period ]) goto Bad;
if (![ scanner2 isAtEnd ]) goto Bad;
if ((period < 0) || (period > 999)) goto Bad; if ((period < 0) || (period > 999)) goto Bad;
setGFXSciencePeriod((double)(period * 60)); setGFXSciencePeriod((double)(period * 60));
mChangePeriodString = [ mChangePeriodTextField stringValue ]; mChangePeriodString = [ mChangePeriodTextField stringValue ];
scanner2 = [ scanner initWithString:mChangePeriodString]; scanner2 = [ scanner initWithString:mChangePeriodString];
if (![ scanner2 scanInt:&period ]) goto Bad; if (![ scanner2 scanInt:&period ]) goto Bad;
if (![ scanner2 isAtEnd ]) goto Bad;
if ((period < 0) || (period > 999)) goto Bad; if ((period < 0) || (period > 999)) goto Bad;
setGGFXChangePeriod((double)(period * 60)); setGGFXChangePeriod((double)(period * 60));