Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92cdf9c3 authored by Colin Cross's avatar Colin Cross
Browse files

recovery: fix building with pointer-to-int errors turned on

Use intptr_t/uintptr_t to cast between pointer and int to allow
building with -Werror=pointer-to-int-cast and
Werror=int-to-pointer-cast turned on.

Cast to char* instead of unsigned int for pointer arithmetic.

Change-Id: Ia862306fdcca53866b330e8cf726f3d62f2248a0
parent f3532072
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ void *service_bootstrap_func(void *x)
static void sideload_service(int s, void *cookie)
{
    unsigned char buf[4096];
    unsigned count = (unsigned) cookie;
    unsigned count = (unsigned)(uintptr_t)cookie;
    int fd;

    fprintf(stderr, "sideload_service invoked\n");
@@ -149,7 +149,7 @@ int service_to_fd(const char *name)
    int ret = -1;

    if (!strncmp(name, "sideload:", 9)) {
        ret = create_service_thread(sideload_service, (void*) atoi(name + 9));
        ret = create_service_thread(sideload_service, (void*)(uintptr_t)atoi(name + 9));
#if 0
    } else if(!strncmp(name, "echo:", 5)){
        ret = create_service_thread(echo_service, 0);
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ static int get_framebuffer(GGLSurface *fb)
    fb->width = vi.xres;
    fb->height = vi.yres;
    fb->stride = fi.line_length/PIXEL_SIZE;
    fb->data = (void*) (((unsigned) bits) + vi.yres * fi.line_length);
    fb->data = (void*) (((char*) bits) + vi.yres * fi.line_length);
    fb->format = PIXEL_FORMAT;
    memset(fb->data, 0, vi.yres * fi.line_length);

+2 −2
Original line number Diff line number Diff line
@@ -772,7 +772,7 @@ bool mzReadZipEntry(const ZipArchive* pArchive, const ZipEntry* pEntry,
static bool writeProcessFunction(const unsigned char *data, int dataLen,
                                 void *cookie)
{
    int fd = (int)cookie;
    int fd = (int)(intptr_t)cookie;

    ssize_t soFar = 0;
    while (true) {
@@ -802,7 +802,7 @@ bool mzExtractZipEntryToFile(const ZipArchive *pArchive,
    const ZipEntry *pEntry, int fd)
{
    bool ret = mzProcessZipEntryContents(pArchive, pEntry, writeProcessFunction,
                                         (void*)fd);
                                         (void*)(intptr_t)fd);
    if (!ret) {
        LOGE("Can't extract entry to file.\n");
        return false;