diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-08-16 22:05:32 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-08-16 22:05:32 +1000 |
commit | af76c04767f3e5d1cc6f39ba907a7d4afdb43200 (patch) | |
tree | 5187b8dada8e5262a83459a593127f215a1afabf /src/gwin/gwin_textedit.c | |
parent | 15e7342fd7b21b76a565561a3caafee394e70c88 (diff) | |
download | uGFX-af76c04767f3e5d1cc6f39ba907a7d4afdb43200.tar.gz uGFX-af76c04767f3e5d1cc6f39ba907a7d4afdb43200.tar.bz2 uGFX-af76c04767f3e5d1cc6f39ba907a7d4afdb43200.zip |
Compile fixes
Diffstat (limited to 'src/gwin/gwin_textedit.c')
-rw-r--r-- | src/gwin/gwin_textedit.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c index 5ea8936a..70a5f8f0 100644 --- a/src/gwin/gwin_textedit.c +++ b/src/gwin/gwin_textedit.c @@ -30,11 +30,11 @@ const int CURSOR_EXTRA_HEIGHT = 1; // cursorPos is the position of the next character // textBuffer[cursorPos++] = readKey(); -static void _shiftTextLeft(char* buffer, size_t bufferSize, size_t index) +static void _shiftTextLeft(char* buffer, size_t maxSize, size_t index) { // Find the end of the string size_t indexTerminator = index; - while (buffer[indexTerminator] != '\0' && indexTerminator < bufferSize-1) { + while (buffer[indexTerminator] != '\0' && indexTerminator < maxSize-1) { indexTerminator++; } @@ -45,11 +45,11 @@ static void _shiftTextLeft(char* buffer, size_t bufferSize, size_t index) buffer[indexTerminator-1] = '\0'; } -static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char fillChar) +static void _shiftTextRight(char* buffer, size_t maxSize, size_t index, char fillChar) { // Find the end of the string size_t indexTerminator = index; - while (buffer[indexTerminator] != '\0' && indexTerminator < bufferSize-1) { + while (buffer[indexTerminator] != '\0' && indexTerminator < maxSize-1) { indexTerminator++; } @@ -98,7 +98,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char if (gw2obj->cursorPos == 0) { return; } - _shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos--); + _shiftTextLeft(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos--); } // Is it delete? @@ -107,7 +107,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char if (gw2obj->textBuffer[gw2obj->cursorPos] == '\0') { return; } - _shiftTextLeft(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos+1); + _shiftTextLeft(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos+1); } // Add a new character @@ -117,7 +117,7 @@ static void _shiftTextRight(char* buffer, size_t bufferSize, size_t index, char return; // Shift everything right from the cursor by one character. This includes the '\0'. Then inser the new character. - _shiftTextRight(gw2obj->textBuffer, gw2obj->bufferSize, gw2obj->cursorPos++, pke->c[0]); + _shiftTextRight(gw2obj->textBuffer, gw2obj->maxSize, gw2obj->cursorPos++, pke->c[0]); } // Set the new text @@ -172,21 +172,19 @@ static const gwidgetVMT texteditVMT = { GHandle gwinGTexteditCreate(GDisplay* g, GTexteditObject* wt, GWidgetInit* pInit, size_t maxSize) { - uint16_t flags = 0; - // Create the underlying widget if (!(wt = (GTexteditObject*)_gwidgetCreate(g, &wt->w, pInit, &texteditVMT))) return 0; // Allocate the text buffer wt->maxSize = maxSize; - wt->textBuffer = gfxAlloc(widget->maxSize); + wt->textBuffer = gfxAlloc(wt->maxSize); if (wt->textBuffer == 0) return 0; // Initialize the text buffer size_t i = 0; - for (i = 0; i < bufSize; i++) { + for (i = 0; i < wt->maxSize; i++) { wt->textBuffer[i] = '\0'; } |