Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Revert "Revert "fixed STLDFLAG order in broken st Makefile""
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
d7bd32a
..
7c7ddff
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-386,6
+386,13
@@
static const char base64_digits[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
+char
+base64dec_getc(const char **src)
+{
+ while (**src && !isprint(**src)) (*src)++;
+ return *((*src)++);
+}
+
char *
base64dec(const char *src)
{
char *
base64dec(const char *src)
{
@@
-393,13
+400,13
@@
base64dec(const char *src)
char *result, *dst;
if (in_len % 4)
char *result, *dst;
if (in_len % 4)
-
return NULL
;
+
in_len += 4 - (in_len % 4)
;
result = dst = xmalloc(in_len / 4 * 3 + 1);
while (*src) {
result = dst = xmalloc(in_len / 4 * 3 + 1);
while (*src) {
- int a = base64_digits[(unsigned char)
*src++
];
- int b = base64_digits[(unsigned char)
*src++
];
- int c = base64_digits[(unsigned char)
*src++
];
- int d = base64_digits[(unsigned char)
*src++
];
+ int a = base64_digits[(unsigned char)
base64dec_getc(&src)
];
+ int b = base64_digits[(unsigned char)
base64dec_getc(&src)
];
+ int c = base64_digits[(unsigned char)
base64dec_getc(&src)
];
+ int d = base64_digits[(unsigned char)
base64dec_getc(&src)
];
*dst++ = (a << 2) | ((b & 0x30) >> 4);
if (c == -1)
*dst++ = (a << 2) | ((b & 0x30) >> 4);
if (c == -1)
@@
-2537,7
+2544,7
@@
tresize(int col, int row)
}
/* allocate any new rows */
}
/* allocate any new rows */
- for (/* i =
=
minrow */; i < row; i++) {
+ for (/* i = minrow */; i < row; i++) {
term.line[i] = xmalloc(col * sizeof(Glyph));
term.alt[i] = xmalloc(col * sizeof(Glyph));
}
term.line[i] = xmalloc(col * sizeof(Glyph));
term.alt[i] = xmalloc(col * sizeof(Glyph));
}