Fix two minor issues.

This commit is contained in:
Steven Smith 2016-06-04 20:10:43 -07:00
parent 2c9dffd4c0
commit c417958a42
2 changed files with 3 additions and 1 deletions

View File

@ -1575,7 +1575,7 @@ static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h)
// magnitude code followed by receive_extend code
int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits);
int m = 1 << (magbits - 1);
if (k < m) k += (-1 << magbits) + 1;
if (k < m) k += (0xFFFFFFFF << magbits) + 1;
// if the result is small enough, we can fit it in fast_ac table
if (k >= -128 && k <= 127)
fast_ac[i] = (stbi__int16) ((k << 8) + (run << 4) + (len + magbits));

View File

@ -366,6 +366,8 @@ void kbd_display(const char* name, const char* initialInput, void* data, void (*
ui_view* view = (ui_view*) calloc(1, sizeof(ui_view));
if(view == NULL) {
error_display(NULL, NULL, NULL, "Failed to allocate UI view.");
free(kbdData);
return;
}