mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
fix: compilation on mingw
This commit is contained in:
parent
5f831ee776
commit
c5c364d994
1 changed files with 17 additions and 8 deletions
|
@ -237,26 +237,35 @@ static void memcpy_filtered(void *dest, const void *src, size_t n, bool filter)
|
|||
#else
|
||||
if (filter) {
|
||||
// Filter out ANSI sequences on these OS
|
||||
uint16_t si=0;
|
||||
for (uint16_t i=0; i < n; i++) {
|
||||
if ((src[i] == '\x1b') && (i < n - 1) && (src[i+1] >= 0x40) && (src[i+1] <= 0x5F)) { // entering ANSI sequence
|
||||
uint8_t *rdest = (uint8_t *)dest;
|
||||
uint8_t *rsrc = (uint8_t *)src;
|
||||
uint16_t si = 0;
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
if ( (rsrc[i] == '\x1b')
|
||||
&& (i < n - 1)
|
||||
&& (rsrc[i + 1] >= 0x40)
|
||||
&& (rsrc[i + 1] <= 0x5F) ) { // entering ANSI sequence
|
||||
|
||||
i++;
|
||||
if ((src[i] == '[') && (i < n - 1)) { // entering CSI sequence
|
||||
if ((rsrc[i] == '[') && (i < n - 1)) { // entering CSI sequence
|
||||
i++;
|
||||
while ((i < n - 1) && (src[i] >= 0x30) && (src[i] <= 0x3F)) { // parameter bytes
|
||||
|
||||
while ((i < n - 1) && (rsrc[i] >= 0x30) && (rsrc[i] <= 0x3F)) { // parameter bytes
|
||||
i++;
|
||||
}
|
||||
while ((i < n - 1) && (src[i] >= 0x20) && (src[i] <= 0x2F)) { // intermediate bytes
|
||||
|
||||
while ((i < n - 1) && (rsrc[i] >= 0x20) && (rsrc[i] <= 0x2F)) { // intermediate bytes
|
||||
i++;
|
||||
}
|
||||
if ((src[i] >= 0x40) && (src[i] <= 0x7F)) { // final byte
|
||||
|
||||
if ((rsrc[i] >= 0x40) && (rsrc[i] <= 0x7F)) { // final byte
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
dest[si++] = src[i];
|
||||
rdest[si++] = rsrc[i];
|
||||
}
|
||||
} else {
|
||||
memcpy(dest, src, n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue