Skip to content

Commit

Permalink
bindings: fix a bug in BufferPrinter
Browse files Browse the repository at this point in the history
i'm not smart enough to write C++
  • Loading branch information
rrbutani committed Jul 1, 2020
1 parent 1c3b1a8 commit 73ee0cc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions extra/shims.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "shims.h"
#include <iostream>

#if !(defined(WIN32) || defined(_WIN32) || defined(__WIN32))
#define UNUSED __attribute((unused))
Expand Down Expand Up @@ -48,7 +47,7 @@ void lc3::shims::endInputNoOp(void) {}

// BufferPrinter:
bool lc3::shims::BufferPrinter::put(unsigned char c) {
if (this->pos < this->len) { this->buffer[this->len++] = c; return true; }
if (this->pos < this->len) { this->buffer[this->pos++] = c; return true; }
else { return false; }
}
void lc3::shims::BufferPrinter::setColor(UNUSED lc3::utils::PrintColor color) {}
Expand All @@ -61,7 +60,7 @@ void lc3::shims::BufferPrinter::newline(void) { this->put('\n'); }
// BufferInputter:
void lc3::shims::BufferInputter::beginInput(void) {}
bool lc3::shims::BufferInputter::getChar(char & c) {
if (this->pos < this->len) { c = this->buffer[this->len++]; return true; }
if (this->pos < this->len) { c = this->buffer[this->pos++]; return true; }
else { return false; }
}
void lc3::shims::BufferInputter::endInput(void) {}
Expand Down

0 comments on commit 73ee0cc

Please sign in to comment.