@@ -511,45 +511,45 @@ RC RI::ri_oneRxp() // process one report or export for topRxp
511511
512512// topZn and topCol must be called first; buildUnspoolInfo must be called afterwards.
513513{
514- RC rc= RCOK;
514+ RC rc = RCOK;
515515
516516 int isEx = isExport; // 1 for export, 0 for report
517517 const char * exrp = isEx ? " ex" : " rp" ; // to insert in member names in error messages
518518 const char * exrePort = isEx ? " export" : " report" ; // to insert in errmsgs
519519
520- // get field texts for errMsgs. No errmsg (except in returned text) if value out of range.
520+ // get field texts for errMsgs. No errmsg (except in returned text) if value out of range.
521521
522- const char * tyTx = getChoiTx ( RI_RPTY, 1 );
523- const char * whenTy = strtprintf ( " when %sType=%s" , exrp, tyTx);
522+ const char * tyTx = getChoiTx (RI_RPTY, 1 );
523+ const char * whenTy = strtprintf (" when %sType=%s" , exrp, tyTx);
524524
525- // check RQD members set -- else can bomb with FPE
525+ // check RQD members set -- else can bomb with FPE
526526
527- if (CkSet ( RI_RPTY))
527+ if (CkSet (RI_RPTY))
528528 return RCBAD; // if not set, no run, terminate checking this report/export now
529529
530- // recall entry time check function 1) as it has not been called for pre-stuffed default reports entries;
531- // 2) to recheck references (DELETE given after entry?)(if it checks any); and 3) general paranoia.
530+ // recall entry time check function 1) as it has not been called for pre-stuffed default reports entries;
531+ // 2) to recheck references (DELETE given after entry?)(if it checks any); and 3) general paranoia.
532532
533533 if (!errCount ()) // but if already have errors (hence no run), do not recall:
534- // would issue duplicate messages for any errors it detected.
534+ // would issue duplicate messages for any errors it detected.
535535 if (ri_CkF ()) // note this is the ckf for exports as well as reports
536536 return RCBAD; // bad. done with entry.
537537
538- // default start and/or end days of report. Don't set nz b4 other checks as not allowed with some rpt types & freq's.
539- // and, doing here sets dates for monthly default reports.
538+ // default start and/or end days of report. Don't set nz b4 other checks as not allowed with some rpt types & freq's.
539+ // and, doing here sets dates for monthly default reports.
540540
541- if ( rpFreq==C_IVLCH_M // monthly frequency: default days to start and end of run
542- || rpFreq==C_IVLCH_Y ) // annual frequency: this sets dates
541+ if (rpFreq==C_IVLCH_M // monthly frequency: default days to start and end of run
542+ || rpFreq==C_IVLCH_Y) // annual frequency: this sets dates
543543 {
544544 if (!rpDayBeg) rpDayBeg = Topi.tp_begDay ;
545545 if (!rpDayEnd) rpDayEnd = Topi.tp_endDay ;
546546 }
547547 else if (!rpDayEnd) // other frequencies; rpDayBeg is 0 if here and dates not used.
548548 rpDayEnd = rpDayBeg; // end day defaults to start day
549549
550- // disallow condition for types without repeated conditional lines
550+ // disallow condition for types without repeated conditional lines
551551
552- int rpCondGiven = IsSet ( RI_RPCOND); // 1 if rpCond entered by user, 0 if rpCond defaulted (to TRUE).
552+ int rpCondGiven = IsSet (RI_RPCOND); // 1 if rpCond entered by user, 0 if rpCond defaulted (to TRUE).
553553 switch (rpTy)
554554 {
555555 case C_RPTYCH_SUM:
@@ -562,7 +562,7 @@ RC RI::ri_oneRxp() // process one report or export for topRxp
562562 case C_RPTYCH_TUSIZE:
563563 case C_RPTYCH_TULOAD: // 6-95
564564 if (rpCondGiven)
565- rc = oer ( MH_S0548, exrp, exrp, tyTx); // "%sCond may not be given with %sType=%s"
565+ rc = oer (MH_S0548, exrp, exrp, tyTx); // "%sCond may not be given with %sType=%s"
566566 break ;
567567 default :
568568 ;
@@ -574,70 +574,71 @@ RC RI::ri_oneRxp() // process one report or export for topRxp
574574 switch (rpTy)
575575 {
576576 case C_RPTYCH_MTR: // "Meter" report/export requires rp/exMeter
577- rc |= require ( whenTy, RI_MTRI);
578- rc |= disallowN ( whenTy, RI_ZI, RI_AHI, RI_TUI, RI_DHWMTRI, RI_AFMTRI, 0 );
577+ rc |= require (whenTy, RI_MTRI);
578+ rc |= disallowN (whenTy, RI_ZI, RI_AHI, RI_TUI, RI_DHWMTRI, RI_AFMTRI, 0 );
579579 break ;
580580
581581 case C_RPTYCH_DHWMTR: // "DHWMTR" report/export requires rp/exDHWMeter
582- rc |= require ( whenTy, RI_DHWMTRI);
583- rc |= disallowN ( whenTy, RI_ZI, RI_AHI, RI_TUI, RI_MTRI, RI_AFMTRI, 0 );
582+ rc |= require (whenTy, RI_DHWMTRI);
583+ rc |= disallowN (whenTy, RI_ZI, RI_AHI, RI_TUI, RI_MTRI, RI_AFMTRI, 0 );
584584 break ;
585585
586586 case C_RPTYCH_AFMTR: // "AFMTR" report/export requires rp/exAFMeter
587- rc |= require ( whenTy, RI_AFMTRI);
587+ rc |= require (whenTy, RI_AFMTRI);
588588 rc |= disallowN (whenTy, RI_ZI, RI_AHI, RI_TUI, RI_MTRI, RI_DHWMTRI, 0 );
589589 break ;
590590
591591 case C_RPTYCH_AHSIZE: // AH-specific reports
592592 case C_RPTYCH_AHLOAD:
593593 case C_RPTYCH_AH:
594- rc |= require ( whenTy, RI_AHI);
595- rc |= disallowN ( whenTy, RI_ZI, RI_TUI, RI_MTRI, RI_DHWMTRI, 0 );
594+ rc |= require (whenTy, RI_AHI);
595+ rc |= disallowN (whenTy, RI_ZI, RI_TUI, RI_MTRI, RI_DHWMTRI, 0 );
596596 break ;
597597
598598 case C_RPTYCH_TUSIZE: // TU-specific reports
599599 case C_RPTYCH_TULOAD:
600- rc |= require ( whenTy, RI_TUI);
601- rc |= disallowN ( whenTy, RI_ZI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
600+ rc |= require (whenTy, RI_TUI);
601+ rc |= disallowN (whenTy, RI_ZI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
602602 break ;
603603
604604 case C_RPTYCH_ZDD: // zone-specific reports
605605 case C_RPTYCH_ZEB:
606606 case C_RPTYCH_ZST:
607- rc |= require ( whenTy, RI_ZI);
608- rc |= disallowN ( whenTy, RI_TUI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
607+ rc |= require (whenTy, RI_ZI);
608+ rc |= disallowN (whenTy, RI_TUI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
609609 break ;
610610
611611 case C_RPTYCH_SUM: // non- zone -ah -tu -meter reports/exports
612612 case C_RPTYCH_LOG:
613613 case C_RPTYCH_ERR:
614614 case C_RPTYCH_INP:
615615 case C_RPTYCH_UDT:
616- rc |= disallowN ( whenTy, RI_ZI, RI_TUI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
616+ rc |= disallowN (whenTy, RI_ZI, RI_TUI, RI_AHI, RI_MTRI, RI_DHWMTRI, 0 );
617617 break ;
618618
619619 default :
620620 if (!errCount ()) // if other error has occurred, suppress msg: may be consequential
621- rc = oer ( (const char *)MH_S0555, exrp, rpTy); // "cncult:topRp: Internal error: Bad %sType %d"
621+ rc = oer ((const char *)MH_S0555, exrp, rpTy); // "cncult:topRp: Internal error: Bad %sType %d"
622622 }
623623
624- // default/check file reference. Defaulted to rp/exfile in which nested, else default here to "Primary" (supplied by TopStarPrf)
624+ // default/check file reference. Defaulted to rp/exfile in which nested, else default here to "Primary" (supplied by TopStarPrf)
625625
626626 if (!ownTi) // if no file given & not defaulted (note default does not set FsSET bit)
627- { anc<RFI>* fb = isEx ? &XfiB : &RfiB; // ptr to reportfile or exportfile input ratbase
628- if (fb->findRecByNm1 (" Primary" , &ownTi, NULL )) // find first record by name (ancrec.cpp) / if not found
627+ {
628+ anc<RFI>* fb = isEx ? &XfiB : &RfiB; // ptr to reportfile or exportfile input ratbase
629+ if (basAnc::FindRecByName (fb, " Primary" , 0 , nullptr , &ownTi) != RCOK) // find first record by name / if not found
629630 {
630631 if (fb->n ) // if not found, if there are ANY r/xport files,
631632 ownTi = 1 ; // use first one: is probably Primary renamed with ALTER
632633 else // no r/xport files at all
633- rc |= ooer (RI_OWNTI, // issue error once (cul.cpp), no run
634- isEx ? MH_S0556 : MH_S0557 ); // "No exExportfile given" or "No rpReportfile given "
634+ rc |= ooer (RI_OWNTI, MH_S0556, // issue error once (cul.cpp), no run
635+ isEx ? " exExportFile " : " rpReportFile " ); // "exExportFile/rpReportFile 'Primary' not found "
635636 }
636637 }
637- RFI* rfp= NULL ;
638- if (ownTi)
639- if ( ckRefPt ( isEx ? &XfiB : &RfiB, ownTi, isEx ? " exFile" : " rpFile" , NULL , (record **)&rfp ) ) // ck ref
640- return RCBAD;
638+ RFI* rfp = NULL ;
639+ if (! ownTi
640+ || ckRefPt ( isEx ? &XfiB : &RfiB, ownTi, isEx ? " exFile" : " rpFile" , NULL , (record **)&rfp ) ) // ck ref
641+ return RCBAD;
641642
642643// check zone reference or ALL or SUM
643644 int isAll = 0 ; // set nz iff ALL
0 commit comments