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

Commit e97f3a85 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Fix libbinder_sdk build warnings

-Wdeprecated-declarations
-Wformat
-Wpessimizing-move
-Wsign-compare
-Wsubobject-linkage
-Wunused-result
-Wzero-as-null-pointer-constant (turned on in ag/4503295)

Bug: 285204695
Test: m libbinder_sdk
Change-Id: Id4a482c511244968e450fdeecf6b9de41bc65b04
parent 7ef191c8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <inttypes.h>
#include <unistd.h>
#include <condition_variable>

#include <android-base/properties.h>
#include <android/os/BnServiceCallback.h>
@@ -642,7 +643,7 @@ public:

protected:
    // Override realGetService for ServiceManagerShim::waitForService.
    Status realGetService(const std::string& name, sp<IBinder>* _aidl_return) {
    Status realGetService(const std::string& name, sp<IBinder>* _aidl_return) override {
        *_aidl_return = getDeviceService({"-g", name}, mOptions);
        return Status::ok();
    }
+1 −1
Original line number Diff line number Diff line
@@ -2768,7 +2768,7 @@ void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize, const bin
        }
        if (type == BINDER_TYPE_FD) {
            // FDs from the kernel are always owned
            FdTag(flat->handle, 0, this);
            FdTag(flat->handle, nullptr, this);
        }
        minOffset = offset + sizeof(flat_binder_object);
    }
+3 −3
Original line number Diff line number Diff line
@@ -230,8 +230,8 @@ std::optional<RecordedTransaction> RecordedTransaction::fromFile(const unique_fd
        }

        size_t memoryMappedSize = chunkPayloadSize + mmapPayloadStartOffset;
        void* mappedMemory =
                mmap(NULL, memoryMappedSize, PROT_READ, MAP_SHARED, fd.get(), mmapPageAlignedStart);
        void* mappedMemory = mmap(nullptr, memoryMappedSize, PROT_READ, MAP_SHARED, fd.get(),
                                  mmapPageAlignedStart);
        auto mmap_guard = make_scope_guard(
                [mappedMemory, memoryMappedSize] { munmap(mappedMemory, memoryMappedSize); });

@@ -382,7 +382,7 @@ android::status_t RecordedTransaction::dumpToFile(const unique_fd& fd) const {
        return UNKNOWN_ERROR;
    }

    if (NO_ERROR != writeChunk(fd, END_CHUNK, 0, NULL)) {
    if (NO_ERROR != writeChunk(fd, END_CHUNK, 0, nullptr)) {
        ALOGE("Failed to write end chunk to fd %d", fd.get());
        return UNKNOWN_ERROR;
    }
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ bool Stability::requiresVintfDeclaration(const sp<IBinder>& binder) {
}

void Stability::tryMarkCompilationUnit(IBinder* binder) {
    (void)setRepr(binder, getLocalLevel(), REPR_NONE);
    std::ignore = setRepr(binder, getLocalLevel(), REPR_NONE);
}

// after deprecation of the VNDK, these should be aliases. At some point
+1 −1
Original line number Diff line number Diff line
@@ -1009,7 +1009,7 @@ private:
            typename std::enable_if_t<is_specialization_v<CT, std::vector>, bool> = true>
    status_t writeData(const CT& c) {
        using T = first_template_type_t<CT>;  // The T in CT == C<T, ...>
        if (c.size() >  std::numeric_limits<int32_t>::max()) return BAD_VALUE;
        if (c.size() > static_cast<size_t>(std::numeric_limits<int32_t>::max())) return BAD_VALUE;
        const auto size = static_cast<int32_t>(c.size());
        writeData(size);
        if constexpr (is_pointer_equivalent_array_v<T>) {
Loading