Skip to content

Commit 8913c30

Browse files
authored
fix compile warnings (#20028)
1 parent 1444263 commit 8913c30

File tree

17 files changed

+57
-135
lines changed

17 files changed

+57
-135
lines changed

cocos/2d/CCFontAtlas.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ const char* FontAtlas::CMD_RESET_FONTATLAS = "__cc_RESET_FONTATLAS";
4646

4747
FontAtlas::FontAtlas(Font &theFont)
4848
: _font(&theFont)
49-
, _fontFreeType(nullptr)
50-
, _iconv(nullptr)
51-
, _currentPageData(nullptr)
52-
, _fontAscender(0)
53-
, _rendererRecreatedListener(nullptr)
54-
, _antialiasEnabled(true)
55-
, _currLineHeight(0)
56-
, _currentPageDataRGBA(nullptr)
5749
{
5850
_font->retain();
5951

@@ -62,11 +54,7 @@ FontAtlas::FontAtlas(Font &theFont)
6254
{
6355
_lineHeight = _font->getFontMaxHeight();
6456
_fontAscender = _fontFreeType->getFontAscender();
65-
_currentPage = 0;
66-
_currentPageOrigX = 0;
67-
_currentPageOrigY = 0;
6857
_letterEdgeExtend = 2;
69-
_letterPadding = 0;
7058

7159
if (_fontFreeType->isDistanceFieldEnabled())
7260
{

cocos/2d/CCFontAtlas.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,26 +135,26 @@ class CC_DLL FontAtlas : public Ref
135135

136136
std::unordered_map<ssize_t, Texture2D*> _atlasTextures;
137137
std::unordered_map<char32_t, FontLetterDefinition> _letterDefinitions;
138-
float _lineHeight;
139-
Font* _font;
140-
FontFreeType* _fontFreeType;
141-
void* _iconv;
138+
float _lineHeight = 0.f;
139+
Font* _font = nullptr;
140+
FontFreeType* _fontFreeType = nullptr;
141+
void* _iconv = nullptr;
142142

143143
// Dynamic GlyphCollection related stuff
144-
int _currentPage;
145-
unsigned char *_currentPageData;
146-
unsigned char *_currentPageDataRGBA;
147-
int _currentPageDataSize;
148-
int _currentPageDataSizeRGBA;
149-
float _currentPageOrigX;
150-
float _currentPageOrigY;
151-
int _letterPadding;
152-
int _letterEdgeExtend;
153-
154-
int _fontAscender;
155-
EventListenerCustom* _rendererRecreatedListener;
156-
bool _antialiasEnabled;
157-
int _currLineHeight;
144+
int _currentPage = 0;
145+
unsigned char *_currentPageData = nullptr;
146+
unsigned char *_currentPageDataRGBA = nullptr;
147+
int _currentPageDataSize = 0;
148+
int _currentPageDataSizeRGBA = 0;
149+
float _currentPageOrigX = 0;
150+
float _currentPageOrigY = 0;
151+
int _letterPadding = 0;
152+
int _letterEdgeExtend = 0;
153+
154+
int _fontAscender = 0;
155+
EventListenerCustom* _rendererRecreatedListener = nullptr;
156+
bool _antialiasEnabled = true;
157+
int _currLineHeight = 0;
158158

159159
friend class Label;
160160
};

cocos/3d/CCMesh.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -529,16 +529,6 @@ void Mesh::bindMeshCommand()
529529
{
530530
if (_material && _meshIndexData)
531531
{
532-
auto pass = _material->_currentTechnique->_passes.at(0);
533-
// auto glprogramstate = pass->getGLProgramState();
534-
//auto texture = pass->getTexture();
535-
// auto textureid = texture ? texture->getName() : 0;
536-
// XXX
537-
// auto blend = pass->getStateBlock()->getBlendFunc();
538-
auto blend = BlendFunc::ALPHA_PREMULTIPLIED;
539-
540-
//TODO
541-
// _meshCommand.genMaterialID(textureid, glprogramstate, _meshIndexData->getVertexBuffer()->getVBO(), _meshIndexData->getIndexBuffer()->getVBO(), blend);
542532
_material->getStateBlock().setCullFace(true);
543533
_material->getStateBlock().setDepthTest(true);
544534
}

cocos/3d/CCMeshVertexIndexData.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,9 @@ void MeshVertexData::setVertexData(const std::vector<float> &vertexData)
109109
MeshVertexData* MeshVertexData::create(const MeshData& meshdata)
110110
{
111111
auto vertexdata = new (std::nothrow) MeshVertexData();
112-
int pervertexsize = meshdata.getPerVertexSize();
113112
vertexdata->_vertexBuffer = backend::Device::getInstance()->newBuffer(meshdata.vertex.size() * sizeof(meshdata.vertex[0]), backend::BufferType::VERTEX, backend::BufferUsage::STATIC);
114113
//CC_SAFE_RETAIN(vertexdata->_vertexBuffer);
115114

116-
int offset = 0;
117-
118115
vertexdata->_sizePerVertex = meshdata.getPerVertexSize();
119116

120117
vertexdata->_attribs = meshdata.attribs;

cocos/3d/CCVertexAttribBinding.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
NS_CC_BEGIN
3131

3232

33-
static uint32_t __maxVertexAttribs = 0;
3433
static std::vector<VertexAttribBinding*> __vertexAttribBindingCache;
3534

3635
VertexAttribBinding::VertexAttribBinding() :

cocos/editor-support/cocostudio/ActionTimeline/CCActionTimeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void ActionTimeline::startWithTarget(Node *target)
250250
this->setTag(target->getTag());
251251

252252
foreachNodeDescendant(target,
253-
[this, target](Node* child)
253+
[this](Node* child)
254254
{
255255
ComExtensionData* data = dynamic_cast<ComExtensionData*>(child->getComponent("ComExtensionData"));
256256

cocos/navmesh/CCNavMeshDebugDraw.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ class NavMeshDebugDraw : public duDebugDraw
100100
backend::ProgramState * _programState = nullptr;
101101
bool _currentDepthMask = true;
102102
bool _dirtyBuffer = true;
103-
backend::PrimitiveType _primitiveType = backend::PrimitiveType::POINT;
104103
backend::Buffer * _vertexBuffer = nullptr;
105104

106105
//RenderState::StateBlock _stateBlock;

cocos/navmesh/CCNavMeshObstacle.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ void NavMeshObstacle::syncToObstacle()
150150
if (_tileCache){
151151
auto obstacle = _tileCache->getObstacleByRef(_obstacleID);
152152
if (obstacle){
153-
Vec3 worldPos = Vec3(obstacle->pos[0], obstacle->pos[1], obstacle->pos[2]);
154153
Mat4 mat = _owner->getNodeToWorldTransform();
155154
if ((mat.m[12] != obstacle->pos[0] && mat.m[13] != obstacle->pos[1] && mat.m[14] != obstacle->pos[2])
156155
|| obstacle->radius != _radius

cocos/platform/mac/CCCommon-mac.mm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,11 @@ void MessageBox(const char * msg, const char * title)
5252
[alert addButtonWithTitle:@"OK"];
5353
[alert setMessageText:tmpMsg];
5454
[alert setInformativeText:tmpTitle];
55-
[alert setAlertStyle:NSWarningAlertStyle];
55+
[alert setAlertStyle:NSAlertStyleWarning];
5656

5757
auto glview = Director::getInstance()->getOpenGLView();
5858
id window = glview->getCocoaWindow();
59-
[alert beginSheetModalForWindow:window
60-
modalDelegate:[window delegate]
61-
didEndSelector:nil
62-
contextInfo:nil];
59+
[alert beginSheetModalForWindow:window completionHandler:nil];
6360
}
6461

6562
NS_CC_END

cocos/renderer/backend/Texture.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ namespace
9696

9797
TextureBackend::TextureBackend(const TextureDescriptor& descriptor)
9898
: _bitsPerElement(computeBitsPerElement(descriptor.textureFormat))
99+
, _width(descriptor.width)
100+
, _height(descriptor.height)
99101
, _textureType(descriptor.textureType)
100102
, _textureFormat(descriptor.textureFormat)
101103
, _textureUsage(descriptor.textureUsage)
102-
, _width(descriptor.width)
103-
, _height(descriptor.height)
104104
{
105105
}
106106

0 commit comments

Comments
 (0)