Commits
Ville Suoranta authored db2cb69df41 Merge
478 478 | |
479 479 | |
480 480 | static void cpgsbox(float* blc, float* trc, char *idents, char *opt, |
481 481 | int labctl, int labden, int *ci, int *gcode, |
482 482 | double tiklen, int ng1, double *grid1, int ng2, |
483 483 | double *grid2, int doeq, S_fp nlfunc, int nlc, int nli, |
484 484 | int nld, char *nlcprm, int *nliprm, double *nldprm, |
485 485 | int nc, int &ic, double *cache, int &ierr) { |
486 486 | int idents_len=80, opt_len=1, nlcprm_len = 1; |
487 487 | |
488 - | PGSBOX(blc, trc, idents, opt, |
489 - | &labctl, &labden, ci, gcode, |
490 - | &tiklen, &ng1, grid1, &ng2, |
491 - | grid2, &doeq, nlfunc, &nlc, &nli, |
492 - | &nld, nlcprm, nliprm, nldprm, |
493 - | &nc, &ic, cache, &ierr, idents_len, opt_len, nlcprm_len); |
488 + | |
489 + | PGSBOX(blc, trc, idents, opt, |
490 + | &labctl, &labden, ci, gcode, |
491 + | &tiklen, &ng1, grid1, &ng2, |
492 + | grid2, &doeq, nlfunc, &nlc, &nli, |
493 + | &nld, nlcprm, nliprm, nldprm, |
494 + | &nc, &ic, cache, &ierr, idents_len, opt_len, nlcprm_len); |
494 495 | } |
495 496 | |
496 497 | |
497 498 | //////////////////////////////////////////////////////////////////////// |
498 499 | |
499 500 | |
500 501 | Bool WCCSNLAxisLabeller::draw(const WCRefreshEvent &ev) { |
501 502 | WorldCanvas *wc = ev.worldCanvas(); |
502 503 | Bool dolist = wc->pixelCanvas()->supportsLists(); |
503 504 | //wc->verifyPGFilterAlignment(); |
846 847 | strncpy(idents + 0, xAxTxt.chars(), nl); |
847 848 | for (ididx = xAxTxt.length(); ididx < nl; ididx++) { |
848 849 | idents[0 + ididx] = 32; |
849 850 | } |
850 851 | strncpy(idents + nl, yAxTxt.chars(), nl); |
851 852 | for (ididx = yAxTxt.length(); ididx < nl; ididx++) { |
852 853 | idents[nl + ididx] = 32; |
853 854 | } |
854 855 | String titleText = displayedTitleText(); |
855 856 | strncpy(idents + 2*nl, /*titleText().chars()*/titleText.chars(), nl); |
856 - | for (ididx = /*titleText().length()*/titleText.length(); ididx < nl; ididx++) { |
857 + | //CAS-13411 Fix buffer overflow |
858 + | for (ididx = /*titleText().length()*/titleText.length(); ididx < nl-1; ididx++) { |
857 859 | idents[2*nl + ididx] = 32; |
858 860 | } |
861 + | //std::cout << "AA Idents"<<std::endl; |
862 + | //std::cout << idents<<std::endl; |
859 863 | titleChanged = false; |
860 864 | // |
861 865 | cpgsch(charSize()); |
862 866 | stemp = charFont(); |
863 867 | if (stemp == "roman") { |
864 868 | cpgscf(2); |
865 869 | } else if (stemp == "italic") { |
866 870 | cpgscf(3); |
867 871 | } else if (stemp == "script") { |
868 872 | cpgscf(4); |
953 957 | cpgp_coord=1.0; |
954 958 | cpgp_fjust=0.5; |
955 959 | } else if (stemp=="inside") { |
956 960 | cpgp_side[0]='T'; |
957 961 | cpgp_disp=-1.75; |
958 962 | cpgp_coord=0.95; |
959 963 | cpgp_fjust=1.0; |
960 964 | } |
961 965 | |
962 966 | // Do the real work |
967 + | //std::cout << "Calling cpgspbox. Idents:" <<std::endl; |
968 + | //std::cout << idents <<std::endl; |
963 969 | cpgsbox(blc, trc, idents, opt, labctl, labden, ci, gcode, |
964 970 | tiklen, ng1, grid1, ng2, grid2, doeq, nlfunc, |
965 971 | nlc, nli, nld, nlcprm, nliprm, nldprm, |
966 972 | nc, ic, cache, ierr); |
967 973 | // |
968 974 | if (plotOutline()) { |
969 975 | cpgsci(23); |
970 976 | cpgbox("BC", 0.0, 0, "BC", 0.0, 0); |
971 977 | } |
972 978 | // |
1012 1018 | zLabel = cs.format(tStr, Coordinate::DEFAULT, tWrld(2), 2); |
1013 1019 | else |
1014 1020 | zLabel = cs.format( tStr, Coordinate::FIXED, tWrld(2), 2, true, true, prec ); |
1015 1021 | //cout << "zlabel: " << zLabel << " tStr: "<<tStr<< " World value: "<< tWrld(2)<<endl; |
1016 1022 | } |
1017 1023 | // |
1018 1024 | zLabel += " "; |
1019 1025 | zLabel += tStr; |
1020 1026 | |
1021 1027 | // plot the z-axis label |
1022 - | cpgmtxt(cpgp_side, cpgp_disp, cpgp_coord, cpgp_fjust, zLabel.chars()); |
1023 - | |
1028 + | // CAS-13411: This keeps crashing on Big Sur |
1029 + | // https://trac.macports.org/ticket/57726 |
1030 + | cpgmtxt(cpgp_side, cpgp_disp, cpgp_coord, cpgp_fjust, zLabel.chars()); |
1031 + | |
1024 1032 | } |
1025 1033 | } |
1026 1034 | cpgstbg(bgcol); |
1027 1035 | } |
1028 1036 | |
1029 1037 | |
1030 1038 | delete [] idents; |
1031 1039 | |
1032 1040 | } // try |
1033 1041 | |