Fix Clang warnings on Android

This commit is contained in:
Pawel Paruzel 2021-12-18 13:24:32 +01:00 committed by Vittorio Romeo
parent aae00e9002
commit 4df16d19e5
16 changed files with 139 additions and 123 deletions

View File

@ -1035,256 +1035,256 @@ Shader::~Shader()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromFile(const std::string& filename, Type type) bool Shader::loadFromFile(const std::string& /* filename */, Type /* type */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::string& fragmentShaderFilename) bool Shader::loadFromFile(const std::string& /* vertexShaderFilename */, const std::string& /* fragmentShaderFilename */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::string& geometryShaderFilename, const std::string& fragmentShaderFilename) bool Shader::loadFromFile(const std::string& /* vertexShaderFilename */, const std::string& /* geometryShaderFilename */, const std::string& /* fragmentShaderFilename */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromMemory(const std::string& shader, Type type) bool Shader::loadFromMemory(const std::string& /* shader */, Type /* type */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromMemory(const std::string& vertexShader, const std::string& fragmentShader) bool Shader::loadFromMemory(const std::string& /* vertexShader */, const std::string& /* fragmentShader */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromMemory(const std::string& vertexShader, const std::string& geometryShader, const std::string& fragmentShader) bool Shader::loadFromMemory(const std::string& /* vertexShader */, const std::string& /* geometryShader */, const std::string& /* fragmentShader */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromStream(InputStream& stream, Type type) bool Shader::loadFromStream(InputStream& /* stream */, Type /* type */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& fragmentShaderStream) bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* fragmentShaderStream */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& geometryShaderStream, InputStream& fragmentShaderStream) bool Shader::loadFromStream(InputStream& /* vertexShaderStream */, InputStream& /* geometryShaderStream */, InputStream& /* fragmentShaderStream */)
{ {
return false; return false;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, float x) void Shader::setUniform(const std::string& /* name */, float)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Vec2& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Vec2&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Vec3& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Vec3&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Vec4& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Vec4&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, int x) void Shader::setUniform(const std::string& /* name */, int)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Ivec2& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec2&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Ivec3& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec3&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Ivec4& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Ivec4&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, bool x) void Shader::setUniform(const std::string& /* name */, bool)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Bvec2& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec2&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Bvec3& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec3&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Bvec4& v) void Shader::setUniform(const std::string& /* name */, const Glsl::Bvec4&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Mat3& matrix) void Shader::setUniform(const std::string& /* name */, const Glsl::Mat3& /* matrix */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Glsl::Mat4& matrix) void Shader::setUniform(const std::string& /* name */, const Glsl::Mat4& /* matrix */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, const Texture& texture) void Shader::setUniform(const std::string& /* name */, const Texture& /* texture */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniform(const std::string& name, CurrentTextureType) void Shader::setUniform(const std::string& /* name */, CurrentTextureType)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const float* scalarArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const float* /* scalarArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const Glsl::Vec2* vectorArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec2* /* vectorArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const Glsl::Vec3* vectorArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec3* /* vectorArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const Glsl::Vec4* vectorArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const Glsl::Vec4* /* vectorArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const Glsl::Mat3* matrixArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const Glsl::Mat3* /* matrixArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setUniformArray(const std::string& name, const Glsl::Mat4* matrixArray, std::size_t length) void Shader::setUniformArray(const std::string& /* name */, const Glsl::Mat4* /* matrixArray */, std::size_t /* length */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, float x) void Shader::setParameter(const std::string& /* name */, float)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, float x, float y) void Shader::setParameter(const std::string& /* name */, float, float)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, float x, float y, float z) void Shader::setParameter(const std::string& /* name */, float, float, float)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, float x, float y, float z, float w) void Shader::setParameter(const std::string& /* name */, float, float, float, float)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, const Vector2f& v) void Shader::setParameter(const std::string& /* name */, const Vector2f&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, const Vector3f& v) void Shader::setParameter(const std::string& /* name */, const Vector3f&)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, const Color& color) void Shader::setParameter(const std::string& /* name */, const Color& /* color */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, const Transform& transform) void Shader::setParameter(const std::string& /* name */, const Transform& /* transform */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, const Texture& texture) void Shader::setParameter(const std::string& /* name */, const Texture& /* texture */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::setParameter(const std::string& name, CurrentTextureType) void Shader::setParameter(const std::string& /* name */, CurrentTextureType)
{ {
} }
@ -1297,7 +1297,7 @@ unsigned int Shader::getNativeHandle() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void Shader::bind(const Shader* shader) void Shader::bind(const Shader* /* shader */)
{ {
} }
@ -1317,7 +1317,7 @@ bool Shader::isGeometryAvailable()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool Shader::compile(const char* vertexShaderCode, const char* geometryShaderCode, const char* fragmentShaderCode) bool Shader::compile(const char* /* vertexShaderCode */, const char* /* geometryShaderCode */, const char* /* fragmentShaderCode */)
{ {
return false; return false;
} }

View File

@ -208,6 +208,7 @@ bool VertexBuffer::update(const VertexBuffer& vertexBuffer)
{ {
#ifdef SFML_OPENGL_ES #ifdef SFML_OPENGL_ES
(void) vertexBuffer;
return false; return false;
#else #else

View File

@ -68,7 +68,7 @@ const char *getLibraryName(JNIEnv* lJNIEnv, jobject& objectActivityInfo)
} }
// Convert the application name to a C++ string and return it // Convert the application name to a C++ string and return it
const jsize applicationNameLength = lJNIEnv->GetStringUTFLength(valueString); const size_t applicationNameLength = static_cast<size_t>(lJNIEnv->GetStringUTFLength(valueString));
const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, NULL); const char* applicationName = lJNIEnv->GetStringUTFChars(valueString, NULL);
if (applicationNameLength >= 256) if (applicationNameLength >= 256)
@ -141,7 +141,7 @@ void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_
// With libname being the library name such as "jpeg". // With libname being the library name such as "jpeg".
// Retrieve JNI environment and JVM instance // Retrieve JNI environment and JVM instance
JavaVM* lJavaVM = activity->vm; // JavaVM* lJavaVM = activity->vm;
JNIEnv* lJNIEnv = activity->env; JNIEnv* lJNIEnv = activity->env;
// Retrieve the NativeActivity // Retrieve the NativeActivity

View File

@ -41,14 +41,14 @@ std::streambuf()
std::streambuf::int_type LogcatStream::overflow (std::streambuf::int_type c) std::streambuf::int_type LogcatStream::overflow (std::streambuf::int_type c)
{ {
if (c == "\n"[0]) if (c == '\n')
{ {
m_message.push_back(c); m_message.push_back(static_cast<char>(c));
LOGE("%s", m_message.c_str()); LOGE("%s", m_message.c_str());
m_message.clear(); m_message.clear();
} }
m_message.push_back(c); m_message.push_back(static_cast<char>(c));
return traits_type::not_eof(c); return traits_type::not_eof(c);
} }

View File

@ -61,7 +61,7 @@ Int64 ResourceStream::read(void *data, Int64 size)
{ {
if (m_file) if (m_file)
{ {
return AAsset_read(m_file, data, size); return AAsset_read(m_file, data, static_cast<size_t>(size));
} }
else else
{ {
@ -75,7 +75,7 @@ Int64 ResourceStream::seek(Int64 position)
{ {
if (m_file) if (m_file)
{ {
return AAsset_seek(m_file, position, SEEK_SET); return AAsset_seek(m_file, static_cast<off_t>(position), SEEK_SET);
} }
else else
{ {

View File

@ -42,7 +42,7 @@ String ClipboardImpl::getString()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void ClipboardImpl::setString(const String& text) void ClipboardImpl::setString(const String& /* text */)
{ {
sf::err() << "Clipboard API not implemented for Android.\n"; sf::err() << "Clipboard API not implemented for Android.\n";
} }

View File

@ -47,7 +47,7 @@ CursorImpl::~CursorImpl()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hotspot) bool CursorImpl::loadFromPixels(const Uint8* /* pixels */, Vector2u /* size */, Vector2u /* hotspot */)
{ {
// Not supported // Not supported
return false; return false;
@ -55,7 +55,7 @@ bool CursorImpl::loadFromPixels(const Uint8* pixels, Vector2u size, Vector2u hot
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool CursorImpl::loadFromSystem(Cursor::Type type) bool CursorImpl::loadFromSystem(Cursor::Type /* type */)
{ {
// Not supported // Not supported
return false; return false;

View File

@ -37,7 +37,7 @@ namespace sf
namespace priv namespace priv
{ {
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool InputImpl::isKeyPressed(Keyboard::Key key) bool InputImpl::isKeyPressed(Keyboard::Key /* key */)
{ {
// Not applicable // Not applicable
return false; return false;
@ -52,7 +52,6 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
Lock lock(states.mutex); Lock lock(states.mutex);
// Initializes JNI // Initializes JNI
jint lResult;
jint lFlags = 0; jint lFlags = 0;
JavaVM* lJavaVM = states.activity->vm; JavaVM* lJavaVM = states.activity->vm;
@ -63,7 +62,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
lJavaVMAttachArgs.name = "NativeThread"; lJavaVMAttachArgs.name = "NativeThread";
lJavaVMAttachArgs.group = NULL; lJavaVMAttachArgs.group = NULL;
lResult=lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs); jint lResult = lJavaVM->AttachCurrentThread(&lJNIEnv, &lJavaVMAttachArgs);
if (lResult == JNI_ERR) if (lResult == JNI_ERR)
err() << "Failed to initialize JNI, couldn't switch the keyboard visibility" << std::endl; err() << "Failed to initialize JNI, couldn't switch the keyboard visibility" << std::endl;
@ -105,7 +104,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
// Runs lInputMethodManager.showSoftInput(...) // Runs lInputMethodManager.showSoftInput(...)
jmethodID MethodShowSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager, jmethodID MethodShowSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
"showSoftInput", "(Landroid/view/View;I)Z"); "showSoftInput", "(Landroid/view/View;I)Z");
jboolean lResult = lJNIEnv->CallBooleanMethod(lInputMethodManager, lJNIEnv->CallBooleanMethod(lInputMethodManager,
MethodShowSoftInput, lDecorView, lFlags); MethodShowSoftInput, lDecorView, lFlags);
} }
else else
@ -121,7 +120,7 @@ void InputImpl::setVirtualKeyboardVisible(bool visible)
// lInputMethodManager.hideSoftInput(...) // lInputMethodManager.hideSoftInput(...)
jmethodID MethodHideSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager, jmethodID MethodHideSoftInput = lJNIEnv->GetMethodID(ClassInputMethodManager,
"hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z"); "hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z");
jboolean lRes = lJNIEnv->CallBooleanMethod(lInputMethodManager, lJNIEnv->CallBooleanMethod(lInputMethodManager,
MethodHideSoftInput, lBinder, lFlags); MethodHideSoftInput, lBinder, lFlags);
lJNIEnv->DeleteLocalRef(lBinder); lJNIEnv->DeleteLocalRef(lBinder);
} }
@ -158,21 +157,21 @@ Vector2i InputImpl::getMousePosition()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo) Vector2i InputImpl::getMousePosition(const WindowBase& /* relativeTo */)
{ {
return getMousePosition(); return getMousePosition();
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void InputImpl::setMousePosition(const Vector2i& position) void InputImpl::setMousePosition(const Vector2i& /* position */)
{ {
// Injecting events is impossible on Android // Injecting events is impossible on Android
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& relativeTo) void InputImpl::setMousePosition(const Vector2i& position, const WindowBase& /* relativeTo */)
{ {
setMousePosition(position); setMousePosition(position);
} }
@ -186,7 +185,7 @@ bool InputImpl::isTouchDown(unsigned int finger)
priv::ActivityStates& states = priv::getActivity(); priv::ActivityStates& states = priv::getActivity();
Lock lock(states.mutex); Lock lock(states.mutex);
return states.touchEvents.find(finger) != states.touchEvents.end(); return states.touchEvents.find(static_cast<int>(finger)) != states.touchEvents.end();
} }
@ -198,12 +197,12 @@ Vector2i InputImpl::getTouchPosition(unsigned int finger)
priv::ActivityStates& states = priv::getActivity(); priv::ActivityStates& states = priv::getActivity();
Lock lock(states.mutex); Lock lock(states.mutex);
return states.touchEvents.find(finger)->second; return states.touchEvents.find(static_cast<int>(finger))->second;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& relativeTo) Vector2i InputImpl::getTouchPosition(unsigned int finger, const WindowBase& /* relativeTo */)
{ {
return getTouchPosition(finger); return getTouchPosition(finger);
} }

View File

@ -48,7 +48,7 @@ void JoystickImpl::cleanup()
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool JoystickImpl::isConnected(unsigned int index) bool JoystickImpl::isConnected(unsigned int /* index */)
{ {
// To implement // To implement
return false; return false;
@ -56,7 +56,7 @@ bool JoystickImpl::isConnected(unsigned int index)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
bool JoystickImpl::open(unsigned int index) bool JoystickImpl::open(unsigned int /* index */)
{ {
// To implement // To implement
return false; return false;

View File

@ -105,7 +105,6 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int m_index; ///< Index of the joystick
Joystick::Identification m_identification; ///< Joystick identification Joystick::Identification m_identification; ///< Joystick identification
}; };

View File

@ -54,7 +54,11 @@ void SensorImpl::initialize()
looper = ALooper_forThread(); looper = ALooper_forThread();
// Get the unique sensor manager // Get the unique sensor manager
sensorManager = ASensorManager_getInstance(); #if ANDROID_API >= 26 || __ANDROID_API__ >= 26
sensorManager = ASensorManager_getInstanceForPackage(nullptr);
#else
sensorManager = ASensorManager_getInstance();
#endif
// Create the sensor events queue and attach it to the looper // Create the sensor events queue and attach it to the looper
sensorEventQueue = ASensorManager_createEventQueue(sensorManager, looper, sensorEventQueue = ASensorManager_createEventQueue(sensorManager, looper,
@ -93,7 +97,7 @@ bool SensorImpl::open(Sensor::Type sensor)
Time minimumDelay = microseconds(ASensor_getMinDelay(m_sensor)); Time minimumDelay = microseconds(ASensor_getMinDelay(m_sensor));
// Set the event rate (not to consume too much battery) // Set the event rate (not to consume too much battery)
ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, minimumDelay.asMicroseconds()); ASensorEventQueue_setEventRate(sensorEventQueue, m_sensor, static_cast<sf::Int32>(minimumDelay.asMicroseconds()));
// Save the index of the sensor // Save the index of the sensor
m_index = static_cast<unsigned int>(sensor); m_index = static_cast<unsigned int>(sensor);
@ -145,7 +149,7 @@ ASensor const* SensorImpl::getDefaultSensor(Sensor::Type sensor)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int SensorImpl::processSensorEvents(int fd, int events, void* data) int SensorImpl::processSensorEvents(int /* fd */, int /* events */, void* /* sensorData */)
{ {
ASensorEvent event; ASensorEvent event;

View File

@ -55,7 +55,7 @@ VideoMode VideoModeImpl::getDesktopMode()
priv::ActivityStates& states = priv::getActivity(); priv::ActivityStates& states = priv::getActivity();
Lock lock(states.mutex); Lock lock(states.mutex);
return VideoMode(states.screenSize.x, states.screenSize.y); return VideoMode(static_cast<unsigned int>(states.screenSize.x), static_cast<unsigned int>(states.screenSize.y));
} }
} // namespace priv } // namespace priv

View File

@ -49,7 +49,7 @@ namespace priv
WindowImplAndroid* WindowImplAndroid::singleInstance = NULL; WindowImplAndroid* WindowImplAndroid::singleInstance = NULL;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowImplAndroid::WindowImplAndroid(WindowHandle handle) WindowImplAndroid::WindowImplAndroid(WindowHandle /* handle */)
: m_size(0, 0) : m_size(0, 0)
, m_windowBeingCreated(false) , m_windowBeingCreated(false)
, m_windowBeingDestroyed(false) , m_windowBeingDestroyed(false)
@ -59,7 +59,7 @@ WindowImplAndroid::WindowImplAndroid(WindowHandle handle)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& /* title */, unsigned long style, const ContextSettings& /* settings */)
: m_size(mode.width, mode.height) : m_size(mode.width, mode.height)
, m_windowBeingCreated(false) , m_windowBeingCreated(false)
, m_windowBeingDestroyed(false) , m_windowBeingDestroyed(false)
@ -132,7 +132,7 @@ Vector2i WindowImplAndroid::getPosition() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setPosition(const Vector2i& position) void WindowImplAndroid::setPosition(const Vector2i& /* position */)
{ {
// Not applicable // Not applicable
} }
@ -146,55 +146,55 @@ Vector2u WindowImplAndroid::getSize() const
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setSize(const Vector2u& size) void WindowImplAndroid::setSize(const Vector2u& /* size */)
{ {
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setTitle(const String& title) void WindowImplAndroid::setTitle(const String& /* title */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setIcon(unsigned int width, unsigned int height, const Uint8* pixels) void WindowImplAndroid::setIcon(unsigned int /* width */, unsigned int /* height */, const Uint8* /* pixels */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setVisible(bool visible) void WindowImplAndroid::setVisible(bool /* visible */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setMouseCursorVisible(bool visible) void WindowImplAndroid::setMouseCursorVisible(bool /* visible */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setMouseCursorGrabbed(bool grabbed) void WindowImplAndroid::setMouseCursorGrabbed(bool /* grabbed */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setMouseCursor(const CursorImpl& cursor) void WindowImplAndroid::setMouseCursor(const CursorImpl& /* cursor */)
{ {
// Not applicable // Not applicable
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void WindowImplAndroid::setKeyRepeatEnabled(bool enabled) void WindowImplAndroid::setKeyRepeatEnabled(bool /* enabled */)
{ {
// Not applicable // Not applicable
} }
@ -223,8 +223,8 @@ void WindowImplAndroid::forwardEvent(const Event& event)
if (event.type == Event::GainedFocus) if (event.type == Event::GainedFocus)
{ {
WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states.window); WindowImplAndroid::singleInstance->m_size.x = static_cast<unsigned int>(ANativeWindow_getWidth(states.window));
WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states.window); WindowImplAndroid::singleInstance->m_size.y = static_cast<unsigned int>(ANativeWindow_getHeight(states.window));
WindowImplAndroid::singleInstance->m_windowBeingCreated = true; WindowImplAndroid::singleInstance->m_windowBeingCreated = true;
WindowImplAndroid::singleInstance->m_hasFocus = true; WindowImplAndroid::singleInstance->m_hasFocus = true;
} }
@ -240,7 +240,7 @@ void WindowImplAndroid::forwardEvent(const Event& event)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int WindowImplAndroid::processEvent(int fd, int events, void* data) int WindowImplAndroid::processEvent(int /* fd */, int /* events */, void* /* data */)
{ {
ActivityStates& states = getActivity(); ActivityStates& states = getActivity();
Lock lock(states.mutex); Lock lock(states.mutex);
@ -318,7 +318,7 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
{ {
// Prepare the Java virtual machine // Prepare the Java virtual machine
jint lResult; jint lResult;
jint lFlags = 0; // jint lFlags = 0;
JavaVM* lJavaVM = states.activity->vm; JavaVM* lJavaVM = states.activity->vm;
JNIEnv* lJNIEnv = states.activity->env; JNIEnv* lJNIEnv = states.activity->env;
@ -336,23 +336,30 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
} }
// Retrieve everything we need to create this MotionEvent in Java // Retrieve everything we need to create this MotionEvent in Java
jlong downTime = AMotionEvent_getDownTime(_event); sf::Int64 downTime = AMotionEvent_getDownTime(_event);
jlong eventTime = AMotionEvent_getEventTime(_event); sf::Int64 eventTime = AMotionEvent_getEventTime(_event);
jint action = AMotionEvent_getAction(_event); sf::Int32 action = AMotionEvent_getAction(_event);
jfloat x = AMotionEvent_getX(_event, 0); float x = AMotionEvent_getX(_event, 0);
jfloat y = AMotionEvent_getY(_event, 0); float y = AMotionEvent_getY(_event, 0);
jfloat pressure = AMotionEvent_getPressure(_event, 0); float pressure = AMotionEvent_getPressure(_event, 0);
jfloat size = AMotionEvent_getSize(_event, 0); float size = AMotionEvent_getSize(_event, 0);
jint metaState = AMotionEvent_getMetaState(_event); sf::Int32 metaState = AMotionEvent_getMetaState(_event);
jfloat xPrecision = AMotionEvent_getXPrecision(_event); float xPrecision = AMotionEvent_getXPrecision(_event);
jfloat yPrecision = AMotionEvent_getYPrecision(_event); float yPrecision = AMotionEvent_getYPrecision(_event);
jint deviceId = AInputEvent_getDeviceId(_event); sf::Int32 deviceId = AInputEvent_getDeviceId(_event);
jint edgeFlags = AMotionEvent_getEdgeFlags(_event); sf::Int32 edgeFlags = AMotionEvent_getEdgeFlags(_event);
// Create the MotionEvent object in Java trough its static constructor obtain() // Create the MotionEvent object in Java trough its static constructor obtain()
jclass ClassMotionEvent = lJNIEnv->FindClass("android/view/MotionEvent"); jclass ClassMotionEvent = lJNIEnv->FindClass("android/view/MotionEvent");
jmethodID StaticMethodObtain = lJNIEnv->GetStaticMethodID(ClassMotionEvent, "obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;"); jmethodID StaticMethodObtain = lJNIEnv->GetStaticMethodID(ClassMotionEvent, "obtain", "(JJIFFFFIFFII)Landroid/view/MotionEvent;");
jobject ObjectMotionEvent = lJNIEnv->CallStaticObjectMethod(ClassMotionEvent, StaticMethodObtain, downTime, eventTime, action, x, y, pressure, size, metaState, xPrecision, yPrecision, deviceId, edgeFlags); // Harmless warning related to C standard compatibility
// varargs automatically promote floats to doubles
// even though the function signature declares float
#pragma clang diagnostic ignored "-Wdouble-promotion"
jobject ObjectMotionEvent = lJNIEnv->CallStaticObjectMethod(
ClassMotionEvent, StaticMethodObtain, downTime,
eventTime, action, x, y, pressure, size, metaState,
xPrecision, yPrecision, deviceId, edgeFlags);
// Call its getAxisValue() method to get the delta value of our wheel move event // Call its getAxisValue() method to get the delta value of our wheel move event
jmethodID MethodGetAxisValue = lJNIEnv->GetMethodID(ClassMotionEvent, "getAxisValue", "(I)F"); jmethodID MethodGetAxisValue = lJNIEnv->GetMethodID(ClassMotionEvent, "getAxisValue", "(I)F");
@ -364,9 +371,9 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
// Create and send our mouse wheel event // Create and send our mouse wheel event
Event event; Event event;
event.type = Event::MouseWheelMoved; event.type = Event::MouseWheelMoved;
event.mouseWheel.delta = static_cast<double>(delta); event.mouseWheel.delta = static_cast<int>(delta);
event.mouseWheel.x = AMotionEvent_getX(_event, 0); event.mouseWheel.x = static_cast<int>(AMotionEvent_getX(_event, 0));
event.mouseWheel.y = AMotionEvent_getY(_event, 0); event.mouseWheel.y = static_cast<int>(AMotionEvent_getY(_event, 0));
forwardEvent(event); forwardEvent(event);
@ -378,9 +385,9 @@ int WindowImplAndroid::processScrollEvent(AInputEvent* _event, ActivityStates& s
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& states) int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& /* states */)
{ {
int32_t device = AInputEvent_getSource(_event); // int32_t device = AInputEvent_getSource(_event);
int32_t action = AKeyEvent_getAction(_event); int32_t action = AKeyEvent_getAction(_event);
int32_t key = AKeyEvent_getKeyCode(_event); int32_t key = AKeyEvent_getKeyCode(_event);
@ -402,7 +409,7 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
event.type = Event::KeyReleased; event.type = Event::KeyReleased;
forwardEvent(event); forwardEvent(event);
if (int unicode = getUnicode(_event)) if (sf::Uint32 unicode = static_cast<sf::Uint32>(getUnicode(_event)))
{ {
event.type = Event::TextEntered; event.type = Event::TextEntered;
event.text.unicode = unicode; event.text.unicode = unicode;
@ -425,7 +432,7 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
// https://code.google.com/p/android/issues/detail?id=33998 // https://code.google.com/p/android/issues/detail?id=33998
return 0; return 0;
} }
else if (int unicode = getUnicode(_event)) // This is a repeated sequence else if (sf::Uint32 unicode = static_cast<sf::Uint32>(getUnicode(_event))) // This is a repeated sequence
{ {
event.type = Event::TextEntered; event.type = Event::TextEntered;
event.text.unicode = unicode; event.text.unicode = unicode;
@ -445,23 +452,23 @@ int WindowImplAndroid::processKeyEvent(AInputEvent* _event, ActivityStates& stat
int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& states) int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& states)
{ {
int32_t device = AInputEvent_getSource(_event); int32_t device = AInputEvent_getSource(_event);
int32_t action = AMotionEvent_getAction(_event); // int32_t action = AMotionEvent_getAction(_event);
Event event; Event event;
if (device == AINPUT_SOURCE_MOUSE) if (device == AINPUT_SOURCE_MOUSE)
event.type = Event::MouseMoved; event.type = Event::MouseMoved;
else if (device & AINPUT_SOURCE_TOUCHSCREEN) else if (static_cast<sf::Uint32>(device) & AINPUT_SOURCE_TOUCHSCREEN)
event.type = Event::TouchMoved; event.type = Event::TouchMoved;
int pointerCount = AMotionEvent_getPointerCount(_event); size_t pointerCount = AMotionEvent_getPointerCount(_event);
for (int p = 0; p < pointerCount; p++) for (size_t p = 0; p < pointerCount; p++)
{ {
int id = AMotionEvent_getPointerId(_event, p); int id = AMotionEvent_getPointerId(_event, p);
float x = AMotionEvent_getX(_event, p); int x = static_cast<int>(AMotionEvent_getX(_event, p));
float y = AMotionEvent_getY(_event, p); int y = static_cast<int>(AMotionEvent_getY(_event, p));
if (device == AINPUT_SOURCE_MOUSE) if (device == AINPUT_SOURCE_MOUSE)
{ {
@ -470,12 +477,12 @@ int WindowImplAndroid::processMotionEvent(AInputEvent* _event, ActivityStates& s
states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y); states.mousePosition = Vector2i(event.mouseMove.x, event.mouseMove.y);
} }
else if (device & AINPUT_SOURCE_TOUCHSCREEN) else if (static_cast<unsigned int>(device) & AINPUT_SOURCE_TOUCHSCREEN)
{ {
if (states.touchEvents[id].x == x && states.touchEvents[id].y == y) if (states.touchEvents[id].x == x && states.touchEvents[id].y == y)
continue; continue;
event.touch.finger = id; event.touch.finger = static_cast<unsigned int>(id);
event.touch.x = x; event.touch.x = x;
event.touch.y = y; event.touch.y = y;
@ -494,11 +501,11 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
int32_t device = AInputEvent_getSource(_event); int32_t device = AInputEvent_getSource(_event);
int32_t action = AMotionEvent_getAction(_event); int32_t action = AMotionEvent_getAction(_event);
int index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; size_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
int id = AMotionEvent_getPointerId(_event, index); int32_t id = AMotionEvent_getPointerId(_event, index);
float x = AMotionEvent_getX(_event, index); int x = static_cast<int>(AMotionEvent_getX(_event, index));
float y = AMotionEvent_getY(_event, index); int y = static_cast<int>(AMotionEvent_getY(_event, index));
Event event; Event event;
@ -514,10 +521,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
if (id >= 0 && id < Mouse::ButtonCount) if (id >= 0 && id < Mouse::ButtonCount)
states.isButtonPressed[id] = true; states.isButtonPressed[id] = true;
} }
else if (device & AINPUT_SOURCE_TOUCHSCREEN) else if (static_cast<unsigned int>(device) & AINPUT_SOURCE_TOUCHSCREEN)
{ {
event.type = Event::TouchBegan; event.type = Event::TouchBegan;
event.touch.finger = id; event.touch.finger = static_cast<unsigned int>(id);
event.touch.x = x; event.touch.x = x;
event.touch.y = y; event.touch.y = y;
@ -536,10 +543,10 @@ int WindowImplAndroid::processPointerEvent(bool isDown, AInputEvent* _event, Act
if (id >= 0 && id < Mouse::ButtonCount) if (id >= 0 && id < Mouse::ButtonCount)
states.isButtonPressed[id] = false; states.isButtonPressed[id] = false;
} }
else if (device & AINPUT_SOURCE_TOUCHSCREEN) else if (static_cast<unsigned int>(device) & AINPUT_SOURCE_TOUCHSCREEN)
{ {
event.type = Event::TouchEnded; event.type = Event::TouchEnded;
event.touch.finger = id; event.touch.finger = static_cast<unsigned int>(id);
event.touch.x = x; event.touch.x = x;
event.touch.y = y; event.touch.y = y;
@ -683,7 +690,7 @@ int WindowImplAndroid::getUnicode(AInputEvent* event)
// Initializes JNI // Initializes JNI
jint lResult; jint lResult;
jint lFlags = 0; // jint lFlags = 0;
JavaVM* lJavaVM = states.activity->vm; JavaVM* lJavaVM = states.activity->vm;
JNIEnv* lJNIEnv = states.activity->env; JNIEnv* lJNIEnv = states.activity->env;

View File

@ -138,6 +138,7 @@ m_context (EGL_NO_CONTEXT),
m_surface (EGL_NO_SURFACE), m_surface (EGL_NO_SURFACE),
m_config (NULL) m_config (NULL)
{ {
(void) owner;
EglContextImpl::ensureInit(); EglContextImpl::ensureInit();
#ifdef SFML_SYSTEM_ANDROID #ifdef SFML_SYSTEM_ANDROID

View File

@ -51,6 +51,7 @@ bool Vulkan::isAvailable(bool requireGraphics)
{ {
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
(void) requireGraphics;
return false; return false;
#else #else
@ -66,6 +67,7 @@ VulkanFunctionPointer Vulkan::getFunction(const char* name)
{ {
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
(void) name;
return NULL; return NULL;
#else #else

View File

@ -280,6 +280,9 @@ bool WindowImpl::createVulkanSurface(const VkInstance& instance, VkSurfaceKHR& s
{ {
#if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE) #if defined(SFML_VULKAN_IMPLEMENTATION_NOT_AVAILABLE)
(void) instance;
(void) surface;
(void) allocator;
return false; return false;
#else #else