Browse Source

Merge pull request #17 from zmeyc/xcode_warnings

Fix warnings on Xcode 7.2
Denis Muratshin 10 years ago
parent
commit
e49b3de591

+ 2 - 1
oxygine/SDL/macosx/oxygine_macosx/oxygine_macosx.xcodeproj/project.pbxproj

@@ -996,7 +996,7 @@
 		049B52B31871EDE900EF3C66 /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 0610;
+				LastUpgradeCheck = 0720;
 				ORGANIZATIONNAME = oxygine;
 			};
 			buildConfigurationList = 049B52B61871EDE900EF3C66 /* Build configuration list for PBXProject "oxygine_macosx" */;
@@ -1136,6 +1136,7 @@
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
+				ENABLE_TESTABILITY = YES;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_ENABLE_OBJC_EXCEPTIONS = YES;

+ 10 - 0
oxygine/src/Actor.cpp

@@ -587,6 +587,11 @@ namespace oxygine
         _clock = clock;
     }
 
+    void Actor::setAlpha(unsigned char alpha)
+    {
+        _alpha = alpha;
+    }
+    
     const Renderer::transform& Actor::getTransform() const
     {
         updateTransform();
@@ -605,6 +610,11 @@ namespace oxygine
         return _transformInvert;
     }
 
+    unsigned char Actor::getAlpha() const
+    {
+        return _alpha;
+    }
+
     const spClock&  Actor::getClock() const
     {
         return _clock;

+ 2 - 2
oxygine/src/Actor.h

@@ -132,7 +132,7 @@ namespace oxygine
         Vector2             getScaledSize() const { return _size.mult(_scale); }
         float               getWidth() const {return getSize().x;}
         float               getHeight() const {return getSize().y;}
-        unsigned char       getAlpha() const {return _alpha;}
+        unsigned char       getAlpha() const;
         const spClock&      getClock() const;
         virtual RectF       getDestRect() const;
         /**returns touch id if actor is pressed down*/
@@ -190,7 +190,7 @@ namespace oxygine
         /**Enable/Disable culling this actor outside of clip area (use it with ClipRectActor)*/
         void setCull(bool enable) {_flags &= ~flag_cull; if (enable) _flags |= flag_cull;}
         /**Sets transparency. if alpha is 0 actor and children are completely invisible, don't rendering and don't receive events.*/
-        void setAlpha(unsigned char alpha) {_alpha = alpha;}
+        void setAlpha(unsigned char alpha);
 
         /**Deprecated, use setTouchEnabled*/
         void setInputEnabled(bool enabled) { setTouchEnabled(enabled); }

+ 1 - 1
oxygine/src/HttpRequestTask.cpp

@@ -80,7 +80,7 @@ namespace oxygine
 
     void HttpRequestTask::_onCustom(const ThreadMessages::message& msg)
     {
-        dispatchProgress((size_t)msg.arg1, (size_t)msg.arg2);
+        dispatchProgress((int)(size_t)msg.arg1, (int)(size_t)msg.arg2);
     }
 
     void HttpRequestTask::progress(int loaded, int total)

+ 1 - 1
oxygine/src/Polygon.cpp

@@ -100,7 +100,7 @@ namespace oxygine
                 ptr += _vdecl->size;
             }
 
-            rs.renderer->addVertices(&buff.front(), buff.size());
+            rs.renderer->addVertices(&buff.front(), (unsigned int) buff.size());
         }
     }
 

+ 8 - 0
oxygine/src/VisualStyle.cpp

@@ -69,4 +69,12 @@ namespace oxygine
         _Actor::deserialize(data);
         setColor(hex2color(data->node.attribute("color").as_string("ffffffff")));
     }
+    
+    const Color& VStyleActor::getColor() const {
+        return _vstyle.getColor();
+    }
+
+    void VStyleActor::setColor(const Color& color) {
+        _vstyle.setColor(color);
+    }
 }

+ 2 - 2
oxygine/src/VisualStyle.h

@@ -37,9 +37,9 @@ namespace oxygine
         void deserialize(const deserializedata* data);
 
         blend_mode              getBlendMode() const {return _vstyle.getBlendMode();}
-        const Color&            getColor() const {return _vstyle.getColor();}
+        const Color&            getColor() const;
 
-        void                    setColor(const Color& color) {_vstyle.setColor(color);}
+        void                    setColor(const Color& color);
         void                    setBlendMode(blend_mode mode) {_vstyle.setBlendMode(mode);}
 
         typedef Property<Color, const Color&, VStyleActor, &VStyleActor::getColor, &VStyleActor::setColor> TweenColor;

+ 2 - 2
oxygine/src/core/Renderer.cpp

@@ -214,9 +214,9 @@ namespace oxygine
         size_t indices = (count * 3) / 2;
 
         if (indices <= indices8.size())
-            getDriver()->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), count, &indices8.front(), indices, false);
+            getDriver()->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), (unsigned int) count, &indices8.front(), (unsigned int) indices, false);
         else
-            getDriver()->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), count, &indices16.front(), indices, true);
+            getDriver()->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), (unsigned int) count, &indices16.front(), (unsigned int) indices, true);
 
         _vertices.clear();
     }

+ 2 - 2
oxygine/src/core/STDFileSystem.cpp

@@ -133,12 +133,12 @@ namespace oxygine
 
             unsigned int read(void* dest, unsigned int size)
             {
-                return oxFileRead(dest, 1, size, _handle);
+                return (unsigned int) oxFileRead(dest, 1, size, _handle);
             }
 
             unsigned int write(const void* src, unsigned int size)
             {
-                return oxFileWrite(src, 1, size, _handle);
+                return (unsigned int) oxFileWrite(src, 1, size, _handle);
             }
 
             int seek(unsigned int offset, int whence)

+ 1 - 1
oxygine/src/core/ThreadMessages.cpp

@@ -127,7 +127,7 @@ namespace oxygine
 
         MutexPthreadLock lock(_mutex);
         if (ev.num == -1)
-            ev.num = _events.size();
+            ev.num = (int) _events.size();
 
         _replyLast(0);
 

+ 1 - 1
oxygine/src/core/ZipFileSystem.cpp

@@ -307,7 +307,7 @@ namespace oxygine
             {
                 unz_file_info file_info;
                 unzGetCurrentFileInfo(_entry->zp, &file_info, 0, 0, 0, 0, 0, 0);
-                return file_info.uncompressed_size;
+                return (unsigned int) file_info.uncompressed_size;
             }
 
             const file_entry* _entry;

+ 7 - 7
oxygine/src/core/gl/NativeTextureGLES.cpp

@@ -198,7 +198,7 @@ namespace oxygine
 
     void NativeTextureGLES::setLinearFilter(bool enable)
     {
-        glBindTexture(GL_TEXTURE_2D, _id);
+        glBindTexture(GL_TEXTURE_2D, (GLuint) _id);
 
         unsigned int f = enable ? GL_LINEAR : GL_NEAREST;
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, f);
@@ -208,7 +208,7 @@ namespace oxygine
 
     void NativeTextureGLES::setClamp2Edge(bool clamp2edge)
     {
-        glBindTexture(GL_TEXTURE_2D, _id);
+        glBindTexture(GL_TEXTURE_2D, (GLuint) _id);
 
         unsigned int f = clamp2edge ? GL_CLAMP_TO_EDGE : GL_REPEAT;
 
@@ -293,7 +293,7 @@ namespace oxygine
             //_data.resize(_width)
         }
 
-        ImageData im =  ImageData(_width, _height, _data.size() / _height, _format, &_data.front());
+        ImageData im =  ImageData(_width, _height, (int) (_data.size() / _height), _format, &_data.front());
         return im.getRect(_lockRect);
     }
 
@@ -305,10 +305,10 @@ namespace oxygine
 
         if (_lockFlags & lock_write)
         {
-            glBindTexture(GL_TEXTURE_2D, _id);
+            glBindTexture(GL_TEXTURE_2D, (GLuint) _id);
             GLenum er = glGetError();
 
-            ImageData src = ImageData(_width, _height, _data.size() / _height, _format, &_data.front());
+            ImageData src = ImageData(_width, _height, (int) (_data.size() / _height), _format, &_data.front());
             ImageData locked = src.getRect(_lockRect);
 
             //glPixelStorei (GL_UNPACK_ALIGNMENT,  1);//byte align
@@ -344,7 +344,7 @@ namespace oxygine
         ImageData data = data_;
         assert(_width >= data.w - x);
         assert(_height >= data.h - y);
-        glBindTexture(GL_TEXTURE_2D, _id);
+        glBindTexture(GL_TEXTURE_2D, (GLuint) _id);
 
         glPixel glp = SurfaceFormat2GL(_format);
         //saveImage(data, "test1.png");
@@ -377,6 +377,6 @@ namespace oxygine
 
     unsigned int NativeTextureGLES::getFboID() const
     {
-        return _fbo;
+        return (unsigned int) _fbo;
     }
 }

+ 1 - 1
oxygine/src/core/ios/HttpRequestCocoaTask.mm

@@ -63,7 +63,7 @@ static char key;
 -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
 {
     oxygine::HttpRequestCocoaTask* task = [self getTask:downloadTask remove:false];
-    task->progress_(totalBytesWritten, totalBytesExpectedToWrite);
+    task->progress_((int) totalBytesWritten, (int) totalBytesExpectedToWrite);
 }
 
 -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {

+ 1 - 1
oxygine/src/core/ios/ios.mm

@@ -112,7 +112,7 @@ namespace oxygine
         int h = image.size.height;
         
         TextureFormat srcFormat = image.bitsPerPixel == 32 ? TF_R8G8B8A8 : TF_R8G8B8;
-        ImageData src(w, h, image.bytesPerRow, srcFormat, image.bitmapData);
+        ImageData src(w, h, (int) image.bytesPerRow, srcFormat, image.bitmapData);
         
         if (destFormat == TF_UNDEFINED)
             destFormat = srcFormat;

+ 1 - 1
oxygine/src/minizip/unzip.c

@@ -1292,7 +1292,7 @@ extern int ZEXPORT unzReadCurrentFile  (file, buf, len)
         return UNZ_PARAMERROR;
 
 
-    if ((pfile_in_zip_read_info->read_buffer == NULL))
+    if (pfile_in_zip_read_info->read_buffer == NULL)
         return UNZ_END_OF_LIST_OF_FILE;
     if (len==0)
         return 0;

+ 1 - 1
oxygine/src/res/ResAtlas.cpp

@@ -745,7 +745,7 @@ namespace oxygine
 
                         size_t n = frames.size();
                         int column = n % columns;
-                        int row = n / columns;
+                        int row = (int) (n / columns);
 
                         frame.init2(ra, column, row, df,
                                     srcRect, destRect,

+ 1 - 1
oxygine/src/utils/ImageUtils.cpp

@@ -83,7 +83,7 @@ namespace oxygine
         for (size_t y = 0; y < cinfo.image_height; y++)
             for (size_t x = 0; x < cinfo.image_width; x++)
             {
-                unsigned int pixelIdx = ((y * cinfo.image_height) + x) * cinfo.input_components;
+                unsigned int pixelIdx = (unsigned int) (((y * cinfo.image_height) + x) * cinfo.input_components);
 
                 if (x % 2 == y % 2)
                 {

+ 5 - 5
oxygine/src/utils/cdecode.c

@@ -40,7 +40,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
 				{
 					state_in->step = step_a;
 					state_in->plainchar = *plainchar;
-					return plainchar - plaintext_out;
+					return (int) (plainchar - plaintext_out);
 				}
 				fragment = (char)base64_decode_value(*codechar++);
 			} while (fragment < 0);
@@ -51,7 +51,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
 				{
 					state_in->step = step_b;
 					state_in->plainchar = *plainchar;
-					return plainchar - plaintext_out;
+					return (int) (plainchar - plaintext_out);
 				}
 				fragment = (char)base64_decode_value(*codechar++);
 			} while (fragment < 0);
@@ -63,7 +63,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
 				{
 					state_in->step = step_c;
 					state_in->plainchar = *plainchar;
-					return plainchar - plaintext_out;
+					return (int) (plainchar - plaintext_out);
 				}
 				fragment = (char)base64_decode_value(*codechar++);
 			} while (fragment < 0);
@@ -75,7 +75,7 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
 				{
 					state_in->step = step_d;
 					state_in->plainchar = *plainchar;
-					return plainchar - plaintext_out;
+					return (int) (plainchar - plaintext_out);
 				}
 				fragment = (char)base64_decode_value(*codechar++);
 			} while (fragment < 0);
@@ -83,6 +83,6 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
 		}
 	}
 	/* control should not reach here */
-	return plainchar - plaintext_out;
+	return (int) (plainchar - plaintext_out);
 }