Skip to content

Commit e6ec079

Browse files
fix quirc_decode on unix builds
1 parent 462ebbb commit e6ec079

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

c_mpos/quirc/lib/quirc_internal.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,27 @@ typedef uint16_t quirc_pixel_t;
4646
#error "QUIRC_MAX_REGIONS > 65534 is not supported"
4747
#endif
4848

49+
#ifdef __xtensa__
4950
#include <esp_heap_caps.h>
50-
static inline void* ps_malloc(const size_t size)
51-
{
51+
static inline void* ps_malloc(const size_t size) {
5252
return heap_caps_malloc_prefer(size, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM, MALLOC_CAP_DEFAULT);
53-
//return malloc(size);
5453
}
55-
static inline void* d_malloc(const size_t size)
56-
{
54+
/*
55+
static inline void* d_malloc(const size_t size) {
5756
return heap_caps_malloc(size, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL);
58-
//return malloc(size);
5957
}
58+
*/
59+
#else // __xtensa__
60+
static inline void* ps_malloc(const size_t size) {
61+
return malloc(size);
62+
}
63+
/*
64+
static inline void* d_malloc(const size_t size) {
65+
return malloc(size);
66+
}
67+
*/
68+
#endif // __xtensa__
69+
6070

6171

6272
#ifdef QUIRC_FLOAT_TYPE

c_mpos/src/quirc_decode.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
#include "py/runtime.h"
77
#include "py/mperrno.h"
88

9+
#ifdef __xtensa__
910
#include "freertos/FreeRTOS.h" // For uxTaskGetStackHighWaterMark
1011
#include "freertos/task.h" // For task-related functions
12+
#else
13+
size_t uxTaskGetStackHighWaterMark(void * unused) {
14+
return 99999999;
15+
}
16+
#endif // __xtensa__
1117

1218
#include "../quirc/lib/quirc.h"
1319

0 commit comments

Comments
 (0)