Fixing iOS clang warnings, part 2
This commit is contained in:
parent
d3821e8cd7
commit
ef3d02214b
@ -249,9 +249,9 @@ macro(add_apple_compiler_options the_module)
|
|||||||
if("${source}" MATCHES "\\.mm$")
|
if("${source}" MATCHES "\\.mm$")
|
||||||
get_source_file_property(flags "${source}" COMPILE_FLAGS)
|
get_source_file_property(flags "${source}" COMPILE_FLAGS)
|
||||||
if(flags)
|
if(flags)
|
||||||
set(flags "${_flags} -fobjc-exceptions")
|
set(flags "${_flags} -fobjc-exceptions -Wno-semicolon-before-method-body")
|
||||||
else()
|
else()
|
||||||
set(flags "-fobjc-exceptions")
|
set(flags "-fobjc-exceptions -Wno-semicolon-before-method-body")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
set_source_files_properties("${source}" PROPERTIES COMPILE_FLAGS "${flags}")
|
||||||
|
@ -177,7 +177,7 @@ namespace
|
|||||||
static void block_function(void* context, size_t index)
|
static void block_function(void* context, size_t index)
|
||||||
{
|
{
|
||||||
ProxyLoopBody* ptr_body = static_cast<ProxyLoopBody*>(context);
|
ProxyLoopBody* ptr_body = static_cast<ProxyLoopBody*>(context);
|
||||||
(*ptr_body)(cv::Range(index, index + 1));
|
(*ptr_body)(cv::Range((int)index, (int)index + 1));
|
||||||
}
|
}
|
||||||
#elif defined HAVE_CONCURRENCY
|
#elif defined HAVE_CONCURRENCY
|
||||||
class ProxyLoopBody : public ParallelLoopBodyWrapper
|
class ProxyLoopBody : public ParallelLoopBodyWrapper
|
||||||
|
@ -1177,7 +1177,7 @@ force_int:
|
|||||||
int val, is_hex = d == 'x';
|
int val, is_hex = d == 'x';
|
||||||
c = ptr[3];
|
c = ptr[3];
|
||||||
ptr[3] = '\0';
|
ptr[3] = '\0';
|
||||||
val = strtol( ptr + is_hex, &endptr, is_hex ? 8 : 16 );
|
val = (int)strtol( ptr + is_hex, &endptr, is_hex ? 8 : 16 );
|
||||||
ptr[3] = c;
|
ptr[3] = c;
|
||||||
if( endptr == ptr + is_hex )
|
if( endptr == ptr + is_hex )
|
||||||
buf[len++] = 'x';
|
buf[len++] = 'x';
|
||||||
@ -2787,7 +2787,7 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
|
|||||||
// find the last occurence of </opencv_storage>
|
// find the last occurence of </opencv_storage>
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
int line_offset = ftell( fs->file );
|
int line_offset = (int)ftell( fs->file );
|
||||||
char* ptr0 = icvGets( fs, xml_buf, xml_buf_size ), *ptr;
|
char* ptr0 = icvGets( fs, xml_buf, xml_buf_size ), *ptr;
|
||||||
if( !ptr0 )
|
if( !ptr0 )
|
||||||
break;
|
break;
|
||||||
|
@ -1979,7 +1979,7 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
|
|||||||
if( !f )
|
if( !f )
|
||||||
CV_Error( CV_StsError, "" );
|
CV_Error( CV_StsError, "" );
|
||||||
fseek( f, 0, SEEK_END );
|
fseek( f, 0, SEEK_END );
|
||||||
size = ftell( f );
|
size = (int)ftell( f );
|
||||||
fseek( f, 0, SEEK_SET );
|
fseek( f, 0, SEEK_SET );
|
||||||
size_t elements_read = fread( ptr, 1, size, f );
|
size_t elements_read = fread( ptr, 1, size, f );
|
||||||
CV_Assert(elements_read == (size_t)(size));
|
CV_Assert(elements_read == (size_t)(size));
|
||||||
|
@ -711,26 +711,26 @@ fromConnection:(AVCaptureConnection *)connection{
|
|||||||
memcpy(imagedata, baseaddress, currSize);
|
memcpy(imagedata, baseaddress, currSize);
|
||||||
|
|
||||||
if (image == NULL) {
|
if (image == NULL) {
|
||||||
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
|
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
|
||||||
}
|
}
|
||||||
image->width =width;
|
image->width = (int)width;
|
||||||
image->height = height;
|
image->height = (int)height;
|
||||||
image->nChannels = 4;
|
image->nChannels = 4;
|
||||||
image->depth = IPL_DEPTH_8U;
|
image->depth = IPL_DEPTH_8U;
|
||||||
image->widthStep = (int)rowBytes;
|
image->widthStep = (int)rowBytes;
|
||||||
image->imageData = imagedata;
|
image->imageData = imagedata;
|
||||||
image->imageSize = currSize;
|
image->imageSize = (int)currSize;
|
||||||
|
|
||||||
if (bgr_image == NULL) {
|
if (bgr_image == NULL) {
|
||||||
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
|
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
|
||||||
}
|
}
|
||||||
bgr_image->width =width;
|
bgr_image->width = (int)width;
|
||||||
bgr_image->height = height;
|
bgr_image->height = (int)height;
|
||||||
bgr_image->nChannels = 3;
|
bgr_image->nChannels = 3;
|
||||||
bgr_image->depth = IPL_DEPTH_8U;
|
bgr_image->depth = IPL_DEPTH_8U;
|
||||||
bgr_image->widthStep = (int)rowBytes;
|
bgr_image->widthStep = (int)rowBytes;
|
||||||
bgr_image->imageData = bgr_imagedata;
|
bgr_image->imageData = bgr_imagedata;
|
||||||
bgr_image->imageSize = currSize;
|
bgr_image->imageSize = (int)currSize;
|
||||||
|
|
||||||
cvCvtColor(image, bgr_image, CV_BGRA2BGR);
|
cvCvtColor(image, bgr_image, CV_BGRA2BGR);
|
||||||
|
|
||||||
@ -739,7 +739,7 @@ fromConnection:(AVCaptureConnection *)connection{
|
|||||||
// iOS provides hardware accelerated rotation through AVCaptureConnection class
|
// iOS provides hardware accelerated rotation through AVCaptureConnection class
|
||||||
// I can't get it work.
|
// I can't get it work.
|
||||||
if (bgr_image_r90 == NULL){
|
if (bgr_image_r90 == NULL){
|
||||||
bgr_image_r90 = cvCreateImage(cvSize(height, width), IPL_DEPTH_8U, 3);
|
bgr_image_r90 = cvCreateImage(cvSize((int)height, (int)width), IPL_DEPTH_8U, 3);
|
||||||
}
|
}
|
||||||
cvTranspose(bgr_image, bgr_image_r90);
|
cvTranspose(bgr_image, bgr_image_r90);
|
||||||
cvFlip(bgr_image_r90, NULL, 1);
|
cvFlip(bgr_image_r90, NULL, 1);
|
||||||
@ -939,29 +939,29 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
|
|||||||
memcpy(imagedata, baseaddress, currSize);
|
memcpy(imagedata, baseaddress, currSize);
|
||||||
|
|
||||||
if (image == NULL) {
|
if (image == NULL) {
|
||||||
image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 4);
|
image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
image->width =width;
|
image->width = (int)width;
|
||||||
image->height = height;
|
image->height = (int)height;
|
||||||
image->nChannels = 4;
|
image->nChannels = 4;
|
||||||
image->depth = IPL_DEPTH_8U;
|
image->depth = IPL_DEPTH_8U;
|
||||||
image->widthStep = rowBytes;
|
image->widthStep = (int)rowBytes;
|
||||||
image->imageData = imagedata;
|
image->imageData = imagedata;
|
||||||
image->imageSize = currSize;
|
image->imageSize = (int)currSize;
|
||||||
|
|
||||||
|
|
||||||
if (bgr_image == NULL) {
|
if (bgr_image == NULL) {
|
||||||
bgr_image = cvCreateImageHeader(cvSize(width,height), IPL_DEPTH_8U, 3);
|
bgr_image = cvCreateImageHeader(cvSize((int)width,(int)height), IPL_DEPTH_8U, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bgr_image->width =width;
|
bgr_image->width = (int)width;
|
||||||
bgr_image->height = height;
|
bgr_image->height = (int)height;
|
||||||
bgr_image->nChannels = 3;
|
bgr_image->nChannels = 3;
|
||||||
bgr_image->depth = IPL_DEPTH_8U;
|
bgr_image->depth = IPL_DEPTH_8U;
|
||||||
bgr_image->widthStep = rowBytes;
|
bgr_image->widthStep = (int)rowBytes;
|
||||||
bgr_image->imageData = bgr_imagedata;
|
bgr_image->imageData = bgr_imagedata;
|
||||||
bgr_image->imageSize = currSize;
|
bgr_image->imageSize = (int)currSize;
|
||||||
|
|
||||||
cvCvtColor(image, bgr_image,CV_BGRA2BGR);
|
cvCvtColor(image, bgr_image,CV_BGRA2BGR);
|
||||||
|
|
||||||
@ -1262,7 +1262,7 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
|
|||||||
// writer status check
|
// writer status check
|
||||||
if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) {
|
if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) {
|
||||||
NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ...");
|
NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ...");
|
||||||
NSLog(@"mMovieWriter.status: %d. Error: %@", mMovieWriter.status, [mMovieWriter.error localizedDescription]);
|
NSLog(@"mMovieWriter.status: %d. Error: %@", (int)mMovieWriter.status, [mMovieWriter.error localizedDescription]);
|
||||||
[localpool drain];
|
[localpool drain];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
|
||||||
|
[super dealloc]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -226,6 +227,7 @@
|
|||||||
|
|
||||||
- (void)deviceOrientationDidChange:(NSNotification*)notification
|
- (void)deviceOrientationDidChange:(NSNotification*)notification
|
||||||
{
|
{
|
||||||
|
(void)notification;
|
||||||
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
||||||
|
|
||||||
switch (orientation)
|
switch (orientation)
|
||||||
|
@ -474,7 +474,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
|
|||||||
|
|
||||||
// check if matrix data pointer or dimensions were changed by the delegate
|
// check if matrix data pointer or dimensions were changed by the delegate
|
||||||
bool iOSimage = false;
|
bool iOSimage = false;
|
||||||
if (height == image.rows && width == image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
|
if (height == (size_t)image.rows && width == (size_t)image.cols && format_opencv == image.type() && bufferAddress == image.data && bytesPerRow == image.step) {
|
||||||
iOSimage = true;
|
iOSimage = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +592,7 @@ static CGFloat DegreesToRadians(CGFloat degrees) {return degrees * M_PI / 180;}
|
|||||||
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
|
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
|
||||||
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
|
if ([library videoAtPathIsCompatibleWithSavedPhotosAlbum:[self videoFileURL]]) {
|
||||||
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
|
[library writeVideoAtPathToSavedPhotosAlbum:[self videoFileURL]
|
||||||
completionBlock:^(NSURL *assetURL, NSError *error){}];
|
completionBlock:^(NSURL *assetURL, NSError *error){ (void)assetURL; (void)error; }];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ set (CMAKE_CXX_FLAGS "-stdlib=libc++ -fvisibility=hidden -fvisibility-inlines-hi
|
|||||||
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
|
set (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -O3 -fomit-frame-pointer -ffast-math")
|
||||||
|
|
||||||
# Silence some warnings
|
# Silence some warnings
|
||||||
set (no_warn "-Wno-semicolon-before-method-body -Wno-unused-function -Wno-unused-parameter -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-const-variable -Wno-overloaded-virtual")
|
set (no_warn "-Wno-unused-function -Wno-unused-parameter -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-const-variable -Wno-overloaded-virtual")
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${no_warn}")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${no_warn}")
|
||||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${no_warn}")
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${no_warn}")
|
||||||
# Additional linker flag
|
# Additional linker flag
|
||||||
|
Loading…
x
Reference in New Issue
Block a user