libgui: Enable -Weverything and -Werror
Enables -Weverything and -Werror, with just a few exceptions for
warnings we can't (or shouldn't need to) work around.
Change-Id: I034abec27bf4020d84af60d7acc1939c59986dd6
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index bc4baa3..36ddb13 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -51,6 +51,8 @@
{
}
+ virtual ~BpSurfaceComposer();
+
virtual sp<ISurfaceComposerClient> createConnection()
{
uint32_t n;
@@ -76,23 +78,18 @@
{
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
- {
- Vector<ComposerState>::const_iterator b(state.begin());
- Vector<ComposerState>::const_iterator e(state.end());
- data.writeInt32(state.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
- }
+
+ data.writeUint32(static_cast<uint32_t>(state.size()));
+ for (const auto& s : state) {
+ s.write(data);
}
- {
- Vector<DisplayState>::const_iterator b(displays.begin());
- Vector<DisplayState>::const_iterator e(displays.end());
- data.writeInt32(displays.size());
- for ( ; b != e ; ++b ) {
- b->write(data);
- }
+
+ data.writeUint32(static_cast<uint32_t>(displays.size()));
+ for (const auto& d : displays) {
+ d.write(data);
}
- data.writeInt32(flags);
+
+ data.writeUint32(flags);
remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply);
}
@@ -115,10 +112,10 @@
data.writeStrongBinder(display);
data.writeStrongBinder(IInterface::asBinder(producer));
data.write(sourceCrop);
- data.writeInt32(reqWidth);
- data.writeInt32(reqHeight);
- data.writeInt32(minLayerZ);
- data.writeInt32(maxLayerZ);
+ data.writeUint32(reqWidth);
+ data.writeUint32(reqHeight);
+ data.writeUint32(minLayerZ);
+ data.writeUint32(maxLayerZ);
data.writeInt32(static_cast<int32_t>(useIdentityTransform));
data.writeInt32(static_cast<int32_t>(rotation));
remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply);
@@ -226,7 +223,7 @@
remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply);
status_t result = reply.readInt32();
if (result == NO_ERROR) {
- size_t numConfigs = static_cast<size_t>(reply.readInt32());
+ size_t numConfigs = reply.readUint32();
configs->clear();
configs->resize(numConfigs);
for (size_t c = 0; c < numConfigs; ++c) {
@@ -289,6 +286,10 @@
}
};
+// Out-of-line virtual method definition to trigger vtable emission in this
+// translation unit (see clang warning -Wweak-vtables)
+BpSurfaceComposer::~BpSurfaceComposer() {}
+
IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer");
// ----------------------------------------------------------------------
@@ -311,34 +312,37 @@
}
case SET_TRANSACTION_STATE: {
CHECK_INTERFACE(ISurfaceComposer, data, reply);
- size_t count = data.readInt32();
+
+ size_t count = data.readUint32();
if (count > data.dataSize()) {
return BAD_VALUE;
}
ComposerState s;
Vector<ComposerState> state;
state.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
+ for (size_t i = 0; i < count; i++) {
if (s.read(data) == BAD_VALUE) {
return BAD_VALUE;
}
state.add(s);
}
- count = data.readInt32();
+
+ count = data.readUint32();
if (count > data.dataSize()) {
return BAD_VALUE;
}
DisplayState d;
Vector<DisplayState> displays;
displays.setCapacity(count);
- for (size_t i=0 ; i<count ; i++) {
+ for (size_t i = 0; i < count; i++) {
if (d.read(data) == BAD_VALUE) {
return BAD_VALUE;
}
displays.add(d);
}
- uint32_t flags = data.readInt32();
- setTransactionState(state, displays, flags);
+
+ uint32_t stateFlags = data.readUint32();
+ setTransactionState(state, displays, stateFlags);
return NO_ERROR;
}
case BOOT_FINISHED: {
@@ -353,12 +357,12 @@
interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
Rect sourceCrop;
data.read(sourceCrop);
- uint32_t reqWidth = data.readInt32();
- uint32_t reqHeight = data.readInt32();
- uint32_t minLayerZ = data.readInt32();
- uint32_t maxLayerZ = data.readInt32();
+ uint32_t reqWidth = data.readUint32();
+ uint32_t reqHeight = data.readUint32();
+ uint32_t minLayerZ = data.readUint32();
+ uint32_t maxLayerZ = data.readUint32();
bool useIdentityTransform = static_cast<bool>(data.readInt32());
- uint32_t rotation = data.readInt32();
+ int32_t rotation = data.readInt32();
status_t res = captureScreen(display, producer,
sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ,
@@ -409,7 +413,7 @@
status_t result = getDisplayConfigs(display, &configs);
reply->writeInt32(result);
if (result == NO_ERROR) {
- reply->writeInt32(static_cast<int32_t>(configs.size()));
+ reply->writeUint32(static_cast<uint32_t>(configs.size()));
for (size_t c = 0; c < configs.size(); ++c) {
memcpy(reply->writeInplace(sizeof(DisplayInfo)),
&configs[c], sizeof(DisplayInfo));
@@ -469,8 +473,6 @@
return BBinder::onTransact(code, data, reply, flags);
}
}
- // should be unreachable
- return NO_ERROR;
}
// ----------------------------------------------------------------------------