Set naptype properly; protect nap() index from out-of-range values.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7341 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-11-27 16:38:39 +00:00
parent 4838d97370
commit 5da4ae6363
3 changed files with 15 additions and 10 deletions

View File

@ -236,10 +236,10 @@ contains
integer, intent(in) :: nsum
integer, intent(in) :: minsync
integer i,nft,nap(-1:11)
integer i,nft,iirc,nap(-1:11)
logical is_deep,is_average
character decoded*22,csync*2,cflags*3
data nap/-1,0,2,4,2,4,5,2,4,6,5,6,6/
data nap/-1,0,2,3,2,3,4,2,3,6,4,6,6/
if(width.eq.-9999.0) stop !Silence compiler warning
!$omp critical(decode_results)
@ -249,16 +249,17 @@ contains
if(ft.ge.80) then !QRA64 mode
nft=ft-100
iirc=max(-1,min(nft,11))
csync=': '
if(sync.ge.float(minsync) .or. nft.ge.0) csync=':*'
if(nft.lt.0) then
write(*,1009) params%nutc,snr,dt,freq,csync,decoded
else
write(*,1009) params%nutc,snr,dt,freq,csync,decoded,nap(nft),nft
write(*,1009) params%nutc,snr,dt,freq,csync,decoded,nap(iirc),nft
1009 format(i4.4,i4,f5.1,i5,1x,a2,1x,a22,i2,i3)
endif
write(13,1011) params%nutc,nint(sync),snr,dt,float(freq),drift, &
decoded,nap(nft),nft
decoded,nap(iirc),nft
1011 format(i4.4,i4,i5,f6.2,f8.0,i4,3x,a22,' QRA64',i3)
go to 100
endif

View File

@ -45,7 +45,7 @@ void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype,
10 [CQ/QRZ HisCall _ ] 68 5 Optional
11 [CQ/QRZ HisCall Grid] 68 ? Optional
*/
static int nc1z=-1;
float EbNodBEstimated;
int err=0;
int nSubmode=*ns0;

View File

@ -19,8 +19,8 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
integer dat4(12) !Decoded message (as 12 integers)
integer dat4x(12)
integer nap(0:11)
data nap/0,2,4,2,4,5,2,4,6,5,6,6/
data nc1z/-1/,nc2z/-1/,ng2z/-1/
data nap/0,2,3,2,3,4,2,3,6,4,6,6/
data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/
save
call timer('qra64a ',0)
@ -43,7 +43,8 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
nFadingModel=1
maxaptype=4
if(iand(ndepth,64).ne.0) maxaptype=5
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z) then
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. &
maxaptype.ne.maxaptypez) then
do naptype=0,maxaptype
if(naptype.eq.2 .and. maxaptype.eq.4) cycle
call qra64_dec(s3,nc1,nc2,ng2,naptype,1,nSubmode,b90, &
@ -52,7 +53,9 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
nc1z=nc1
nc2z=nc2
ng2z=ng2
maxaptypez=maxaptype
endif
naptype=maxaptype
maxf1=0
call timer('sync64 ',0)
@ -94,11 +97,12 @@ subroutine qra64a(dd,npts,nutc,nf1,nf2,nfqso,ntol,mode64,minsync,ndepth, &
if(abs(snr2).gt.30.) snr2=-30.0
if(irc.eq.0) go to 10
if(irc.lt.0) cycle
if(irc.gt.0 .and. nap(irc).le.napmin) then
iirc=max(0,min(irc,11))
if(irc.gt.0 .and. nap(iirc).le.napmin) then
dat4x=dat4
b90x=b90
snr2x=snr2
napmin=nap(irc)
napmin=nap(iirc)
irckeep=irc
endif
enddo