Diffstat (limited to 'core/apps/embeddedkonsole/TEHistory.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/TEHistory.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/core/apps/embeddedkonsole/TEHistory.cpp b/core/apps/embeddedkonsole/TEHistory.cpp index 317ce57..db9d10c 100644 --- a/core/apps/embeddedkonsole/TEHistory.cpp +++ b/core/apps/embeddedkonsole/TEHistory.cpp | |||
@@ -119,4 +119,6 @@ void HistoryBuffer::add(const unsigned char* bytes, int len) | |||
119 | assert(hasScroll()); | 119 | assert(hasScroll()); |
120 | rc = lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::add.seek"); setScroll(FALSE); return; } | 120 | rc = lseek( ion, length, SEEK_SET); |
121 | rc = write(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::add.write"); setScroll(FALSE); return; } | 121 | if (rc < 0) { perror("HistoryBuffer::add.seek"); setScroll(FALSE); return; } |
122 | rc = write( ion, bytes, len); | ||
123 | if (rc < 0) { perror("HistoryBuffer::add.write"); setScroll(FALSE); return; } | ||
122 | length += rc; | 124 | length += rc; |
@@ -124,9 +126,13 @@ void HistoryBuffer::add(const unsigned char* bytes, int len) | |||
124 | 126 | ||
125 | void HistoryBuffer::get(unsigned char* bytes, int len, int loc) | 127 | void HistoryBuffer::get(unsigned char* bytes, int len, int loc) { |
126 | { int rc; | 128 | int rc; |
127 | assert(hasScroll()); | 129 | assert(hasScroll()); |
130 | // qDebug("history get len %d, loc %d, length %d", len, loc, length); | ||
128 | if (loc < 0 || len < 0 || loc + len > length) | 131 | if (loc < 0 || len < 0 || loc + len > length) |
129 | fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc); | 132 | fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc); |
130 | rc = lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryBuffer::get.seek"); setScroll(FALSE); return; } | 133 | |
131 | rc = read(ion,bytes,len); if (rc < 0) { perror("HistoryBuffer::get.read"); setScroll(FALSE); return; } | 134 | rc = lseek( ion, loc, SEEK_SET); |
135 | if (rc < 0) { perror("HistoryBuffer::get.seek"); setScroll(FALSE); return; } | ||
136 | rc = read( ion, bytes, len); | ||
137 | if (rc < 0) { perror("HistoryBuffer::get.read"); setScroll(FALSE); return; } | ||
132 | } | 138 | } |
@@ -197,2 +203,3 @@ void HistoryScroll::getCells(int lineno, int colno, int count, ca res[]) | |||
197 | assert(hasScroll()); | 203 | assert(hasScroll()); |
204 | //get(unsigned char* bytes, int len, int loc) | ||
198 | cells.get((unsigned char*)res,count*sizeof(ca),startOfLine(lineno)+colno*sizeof(ca)); | 205 | cells.get((unsigned char*)res,count*sizeof(ca),startOfLine(lineno)+colno*sizeof(ca)); |