mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-14 07:17:44 +00:00
Silence warnings about unused result.
Introduce a DISCARD macro to ignore the warn_unused_result attribute used by Spidermonkey, and reuse it elsewhere. Differential Revision: https://code.wildfiregames.com/D3147 This was SVN commit r24261.
This commit is contained in:
@@ -95,12 +95,12 @@ public:
|
||||
data.get()[1] = 64;
|
||||
data.get()[2] = 64;
|
||||
Tex t;
|
||||
(void)t.wrap(1, 1, 24, 0, data, 0);
|
||||
DISCARD t.wrap(1, 1, 24, 0, data, 0);
|
||||
|
||||
m_DefaultHandle = ogl_tex_wrap(&t, m_VFS, L"(default texture)");
|
||||
(void)ogl_tex_set_filter(m_DefaultHandle, GL_LINEAR);
|
||||
DISCARD ogl_tex_set_filter(m_DefaultHandle, GL_LINEAR);
|
||||
if (!m_DisableGL)
|
||||
(void)ogl_tex_upload(m_DefaultHandle);
|
||||
DISCARD ogl_tex_upload(m_DefaultHandle);
|
||||
}
|
||||
|
||||
// Error texture (magenta)
|
||||
@@ -112,12 +112,12 @@ public:
|
||||
data.get()[1] = 0;
|
||||
data.get()[2] = 255;
|
||||
Tex t;
|
||||
(void)t.wrap(1, 1, 24, 0, data, 0);
|
||||
DISCARD t.wrap(1, 1, 24, 0, data, 0);
|
||||
|
||||
m_ErrorHandle = ogl_tex_wrap(&t, m_VFS, L"(error texture)");
|
||||
(void)ogl_tex_set_filter(m_ErrorHandle, GL_LINEAR);
|
||||
DISCARD ogl_tex_set_filter(m_ErrorHandle, GL_LINEAR);
|
||||
if (!m_DisableGL)
|
||||
(void)ogl_tex_upload(m_ErrorHandle);
|
||||
DISCARD ogl_tex_upload(m_ErrorHandle);
|
||||
|
||||
// Construct a CTexture to return to callers who want an error texture
|
||||
CTextureProperties props(L"(error texture)");
|
||||
@@ -134,8 +134,8 @@ public:
|
||||
{
|
||||
UnregisterFileReloadFunc(ReloadChangedFileCB, this);
|
||||
|
||||
(void)ogl_tex_free(m_DefaultHandle);
|
||||
(void)ogl_tex_free(m_ErrorHandle);
|
||||
DISCARD ogl_tex_free(m_DefaultHandle);
|
||||
DISCARD ogl_tex_free(m_ErrorHandle);
|
||||
}
|
||||
|
||||
CTexturePtr GetErrorTexture()
|
||||
@@ -188,14 +188,14 @@ public:
|
||||
|
||||
// Get some flags for later use
|
||||
size_t flags = 0;
|
||||
(void)ogl_tex_get_format(h, &flags, NULL);
|
||||
DISCARD ogl_tex_get_format(h, &flags, NULL);
|
||||
|
||||
// Initialise base color from the texture
|
||||
(void)ogl_tex_get_average_color(h, &texture->m_BaseColor);
|
||||
DISCARD ogl_tex_get_average_color(h, &texture->m_BaseColor);
|
||||
|
||||
// Set GL upload properties
|
||||
(void)ogl_tex_set_wrap(h, texture->m_Properties.m_WrapS, texture->m_Properties.m_WrapT);
|
||||
(void)ogl_tex_set_anisotropy(h, texture->m_Properties.m_Aniso);
|
||||
DISCARD ogl_tex_set_wrap(h, texture->m_Properties.m_WrapS, texture->m_Properties.m_WrapT);
|
||||
DISCARD ogl_tex_set_anisotropy(h, texture->m_Properties.m_Aniso);
|
||||
|
||||
// Prevent ogl_tex automatically generating mipmaps (which is slow and unwanted),
|
||||
// by avoiding mipmapped filters unless the source texture already has mipmaps
|
||||
@@ -214,7 +214,7 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void)ogl_tex_set_filter(h, filter);
|
||||
DISCARD ogl_tex_set_filter(h, filter);
|
||||
|
||||
// Upload to GL
|
||||
if (!m_DisableGL && ogl_tex_upload(h, texture->m_Properties.m_Format) < 0)
|
||||
@@ -604,21 +604,21 @@ void CTexture::SetHandle(Handle handle, bool takeOwnership)
|
||||
size_t CTexture::GetWidth() const
|
||||
{
|
||||
size_t w = 0;
|
||||
(void)ogl_tex_get_size(m_Handle, &w, 0, 0);
|
||||
DISCARD ogl_tex_get_size(m_Handle, &w, 0, 0);
|
||||
return w;
|
||||
}
|
||||
|
||||
size_t CTexture::GetHeight() const
|
||||
{
|
||||
size_t h = 0;
|
||||
(void)ogl_tex_get_size(m_Handle, 0, &h, 0);
|
||||
DISCARD ogl_tex_get_size(m_Handle, 0, &h, 0);
|
||||
return h;
|
||||
}
|
||||
|
||||
bool CTexture::HasAlpha() const
|
||||
{
|
||||
size_t flags = 0;
|
||||
(void)ogl_tex_get_format(m_Handle, &flags, 0);
|
||||
DISCARD ogl_tex_get_format(m_Handle, &flags, 0);
|
||||
return (flags & TEX_ALPHA) != 0;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ u32 CTexture::GetBaseColor() const
|
||||
size_t CTexture::GetUploadedSize() const
|
||||
{
|
||||
size_t size = 0;
|
||||
(void)ogl_tex_get_uploaded_size(m_Handle, &size);
|
||||
DISCARD ogl_tex_get_uploaded_size(m_Handle, &size);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user