Mercurial > 510Connectbot
diff src/org/tn5250j/framework/tn5250/tnvt.java @ 405:d3c5480e8441
fix broken fillRegenerationBuffer/fillScreenArray attempt to handle missing attributes; fix setfield outside screen boundaries
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 24 Oct 2014 14:19:06 -0700 |
parents | 7ac1a0b02f44 |
children | 4038389cb7ce |
line wrap: on
line diff
--- a/src/org/tn5250j/framework/tn5250/tnvt.java Tue Oct 21 13:11:59 2014 -0700 +++ b/src/org/tn5250j/framework/tn5250/tnvt.java Fri Oct 24 14:19:06 2014 -0700 @@ -1142,32 +1142,26 @@ int len = rows * cols; ScreenPlanes planes = screen52.planes; - for (int y = 0; y < len; y++) { // save the screen data - if (planes.isAttributePlace(y)) { - la = planes.getCharAttr(y); - sa[sac++] = (byte) la; - } - else { - if (planes.getCharAttr(y) != la) { + try { + for (int y = 0; y < len; y++) { // save the screen data + if (planes.isAttributePlace(y)) { la = planes.getCharAttr(y); - sac = max(sac--, 0); sa[sac++] = (byte) la; } - - //LDC: Check to see if it is an displayable character. If not, - // do not convert the character. - // The characters on screen are in unicode - //sa[sac++] = - // (byte)codePage.uni2ebcdic(screen52.screen[y].getChar()); - char ch = planes.getChar(y); - byte byteCh = (byte) ch; - - if (isDataUnicode(ch)) - byteCh = codePage.uni2ebcdic(ch); - - sa[min(sac++, len - 1)] = byteCh; + else { + // The characters on screen are in unicode + char ch = planes.getChar(y); + byte byteCh; + if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); + else byteCh = (byte) ch; + sa[sac++] = byteCh; + } } } + catch (Exception exc) { + Log.i(TAG, exc.getMessage()); + exc.printStackTrace(); + } } private final void fillRegenerationBuffer(ByteArrayOutputStream sc, int rows, int cols) @@ -1206,24 +1200,12 @@ sa[sac++] = (byte) la; } else { - if (planes.getCharAttr(y) != la) { - la = planes.getCharAttr(y); - sac = max(sac--, 0); - sa[sac++] = (byte) la; - } - - //LDC: Check to see if it is an displayable character. If not, - // do not convert the character. // The characters on screen are in unicode - //sa[sac++] = - // (byte)codePage.uni2ebcdic(screen52.screen[y].getChar()); char ch = planes.getChar(y); - byte byteCh = (byte) ch; - - if (isDataUnicode(ch)) - byteCh = codePage.uni2ebcdic(ch); - - sa[min(sac++, len - 1)] = byteCh; + byte byteCh; + if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); + else byteCh = (byte) ch; + sa[sac++] = byteCh; } } } @@ -1369,15 +1351,10 @@ la = b; } else { - //LDC - 12/02/2003 - Check to see if it is an displayable - // character. If not, - // do not convert the character. // The characters on screen are in unicode - char ch = (char) b; - - if (isDataEBCDIC(b)) - ch = codePage.ebcdic2uni(b); - + char ch; + if (isDataEBCDIC(b)) ch = codePage.ebcdic2uni(b); + else ch = b; planes.setScreenCharAndAttr(y, ch, la, false); } }