diff options
author | Cody Heiner <codyheiner@google.com> | 2024-02-15 00:28:08 +0000 |
---|---|---|
committer | Cody Heiner <codyheiner@google.com> | 2024-02-15 17:59:57 -0800 |
commit | d737c3ed06f9aef6d68456288a5250c3893a8ca5 (patch) | |
tree | 3e38e7d37b12019bbcafdc674a550f829945e8d3 /tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp | |
parent | 03d191d6c98f6adf2382a2741b068b0260036679 (diff) | |
download | aidl-d737c3ed06f9aef6d68456288a5250c3893a8ca5.tar.gz |
Fix implicit narrowing conversion in generated C++ code
Also updates `auto` types to explicit types in order to improve readability and make it clear how and why different integral types are being used.
Note: the only manual change here is the change to `generate_cpp.cpp`.
The rest of the changes were produced by running:
`system/tools/aidl/tests/golden_test.sh update`
Test: build succeeds when generating code within a library that
uses -Wall -Werror flags (where it failed before this change).
Test: device runs normally.
Change-Id: I704e3322318d2fe327320b50519de1acbefc33f9
Diffstat (limited to 'tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp')
-rw-r--r-- | tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp b/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp index c08ecb1d..d1392785 100644 --- a/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp +++ b/tests/golden_output/frozen/aidl-test-interface-cpp-source/gen/android/aidl/tests/extension/MyExt2.cpp @@ -48,7 +48,7 @@ namespace extension { } ::android::status_t MyExt2::writeToParcel(::android::Parcel* _aidl_parcel) const { ::android::status_t _aidl_ret_status = ::android::OK; - auto _aidl_start_pos = _aidl_parcel->dataPosition(); + size_t _aidl_start_pos = _aidl_parcel->dataPosition(); _aidl_parcel->writeInt32(0); _aidl_ret_status = _aidl_parcel->writeInt32(a); if (((_aidl_ret_status) != (::android::OK))) { @@ -62,9 +62,9 @@ namespace extension { if (((_aidl_ret_status) != (::android::OK))) { return _aidl_ret_status; } - auto _aidl_end_pos = _aidl_parcel->dataPosition(); + size_t _aidl_end_pos = _aidl_parcel->dataPosition(); _aidl_parcel->setDataPosition(_aidl_start_pos); - _aidl_parcel->writeInt32(_aidl_end_pos - _aidl_start_pos); + _aidl_parcel->writeInt32(static_cast<int32_t>(_aidl_end_pos - _aidl_start_pos)); _aidl_parcel->setDataPosition(_aidl_end_pos); return _aidl_ret_status; } |