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

Commit ce82d784 authored by Amy Zhang's avatar Amy Zhang
Browse files

Cast HIDL uint16_t to char16_t in AIDL cpp backend service

Note that 16 bit int in AIDL interface is char type, while the
corresponding type in cpp/ndk backend is chat16_t type.

See https://source.android.com/devices/architecture/aidl/aidl-backends#types

This CL changes all the casting from uint16_t to char16_t instead of
char to keep the right size of the data.

Test: make
Bug: 185627837
Change-Id: Ic41c7d15df62adb4f78216580fcd9af2c806d891
parent c57a6c62
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -732,10 +732,10 @@ void TunerFilter::FilterCallback::getSectionEvent(
        DemuxFilterSectionEvent sectionEvent = e.section();
        TunerFilterSectionEvent tunerSection;

        tunerSection.tableId = static_cast<char>(sectionEvent.tableId);
        tunerSection.version = static_cast<char>(sectionEvent.version);
        tunerSection.sectionNum = static_cast<char>(sectionEvent.sectionNum);
        tunerSection.dataLength = static_cast<char>(sectionEvent.dataLength);
        tunerSection.tableId = static_cast<char16_t>(sectionEvent.tableId);
        tunerSection.version = static_cast<char16_t>(sectionEvent.version);
        tunerSection.sectionNum = static_cast<char16_t>(sectionEvent.sectionNum);
        tunerSection.dataLength = static_cast<char16_t>(sectionEvent.dataLength);

        TunerFilterEvent tunerEvent;
        tunerEvent.set<TunerFilterEvent::section>(move(tunerSection));
@@ -749,7 +749,7 @@ void TunerFilter::FilterCallback::getPesEvent(
        DemuxFilterPesEvent pesEvent = e.pes();
        TunerFilterPesEvent tunerPes;

        tunerPes.streamId = static_cast<char>(pesEvent.streamId);
        tunerPes.streamId = static_cast<char16_t>(pesEvent.streamId);
        tunerPes.dataLength = static_cast<int>(pesEvent.dataLength);
        tunerPes.mpuSequenceNumber = static_cast<int>(pesEvent.mpuSequenceNumber);

@@ -777,9 +777,9 @@ void TunerFilter::FilterCallback::getTsRecordEvent(vector<DemuxFilterEvent::Even
        }

        if (tsRecordEvent.pid.getDiscriminator() == DemuxPid::hidl_discriminator::tPid) {
            tunerTsRecord.pid = static_cast<char>(tsRecordEvent.pid.tPid());
            tunerTsRecord.pid = static_cast<char16_t>(tsRecordEvent.pid.tPid());
        } else {
            tunerTsRecord.pid = static_cast<char>(Constant::INVALID_TS_PID);
            tunerTsRecord.pid = static_cast<char16_t>(Constant::INVALID_TS_PID);
        }

        tunerTsRecord.scIndexMask = scIndexMask;
@@ -839,7 +839,7 @@ void TunerFilter::FilterCallback::getDownloadEvent(
        tunerDownload.itemFragmentIndex = static_cast<int>(downloadEvent.itemFragmentIndex);
        tunerDownload.mpuSequenceNumber = static_cast<int>(downloadEvent.mpuSequenceNumber);
        tunerDownload.lastItemFragmentIndex = static_cast<int>(downloadEvent.lastItemFragmentIndex);
        tunerDownload.dataLength = static_cast<char>(downloadEvent.dataLength);
        tunerDownload.dataLength = static_cast<char16_t>(downloadEvent.dataLength);

        TunerFilterEvent tunerEvent;
        tunerEvent.set<TunerFilterEvent::download>(move(tunerDownload));
@@ -853,7 +853,7 @@ void TunerFilter::FilterCallback::getIpPayloadEvent(
        DemuxFilterIpPayloadEvent ipPayloadEvent = e.ipPayload();
        TunerFilterIpPayloadEvent tunerIpPayload;

        tunerIpPayload.dataLength = static_cast<char>(ipPayloadEvent.dataLength);
        tunerIpPayload.dataLength = static_cast<char16_t>(ipPayloadEvent.dataLength);

        TunerFilterEvent tunerEvent;
        tunerEvent.set<TunerFilterEvent::ipPayload>(move(tunerIpPayload));