# HG changeset patch # User Carl Byington # Date 1414185546 25200 # Node ID d3c5480e8441dcc69f2fb152515c1c565d9cee96 # Parent ec74f347ab5f529125fe4d96ab3765a727f723c9 fix broken fillRegenerationBuffer/fillScreenArray attempt to handle missing attributes; fix setfield outside screen boundaries diff -r ec74f347ab5f -r d3c5480e8441 src/com/five_ten_sg/connectbot/service/TerminalMonitor.java --- a/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Tue Oct 21 13:11:59 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/service/TerminalMonitor.java Fri Oct 24 14:19:06 2014 -0700 @@ -429,7 +429,7 @@ } else { // ignore setfield outside screen boundaries - if ((l >= buffer.height) || (c + len >= buffer.width)) return; + if ((l >= buffer.height) || (c + len > buffer.width)) return; } buffer.setField(l, c, da); diff -r ec74f347ab5f -r d3c5480e8441 src/org/tn5250j/framework/tn5250/tnvt.java --- 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); } }