1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
|
Description: Fix some compiler warnings.
Also check the return value of fread/fgets.
.
comparison of distinct pointer types lacks a cast
assignment makes integer from pointer without a cast [-Wint-conversion]
'main' is usually a function [-Wmain]
'foo' may be used uninitialized in this function
missing braces around initializer [-Wmissing-braces]
passing argument N of ‘foo:’ from distinct Objective-C type
passing argument N of ‘foo:’ from incompatible pointer type
initialization of ‘double *’ from incompatible pointer type ‘id’
Author: Yavor Doganov <yavor@gnu.org>
Forwarded: no
Last-Update: 2019-01-30
---
--- lynkeos.app.orig/Sources/FFmpegReader.m
+++ lynkeos.app/Sources/FFmpegReader.m
@@ -200,7 +200,7 @@
return( pix->_frame );
int ret;
- BOOL success;
+ BOOL success = NO;
// Do not move if the frame already read is asked
if ( index == (_nextIndex - 1) )
@@ -449,7 +449,7 @@
_height = (_pCodecCtx->height * aspect.num) / aspect.den;
}
const AVPixFmtDescriptor *fmtDesc = av_pix_fmt_desc_get(_pCodecCtx->pix_fmt);
- if (fmtDesc == nil)
+ if (fmtDesc == NULL)
{
NSLog( @"Unknown pixel format" );
[self release];
--- lynkeos.app.orig/Sources/MyImageListWindow.m
+++ lynkeos.app/Sources/MyImageListWindow.m
@@ -586,10 +586,11 @@
- (void)windowDidBecomeMain:(NSNotification *)aNotification
{
- NSWindow *main = [self window];
+ NSWindow *mainWindow = [self window];
NSWindow *sender = [aNotification object];
- NSAssert1( sender == main, @"Unexpected window becomes main : %@", sender );
+ NSAssert1( sender == mainWindow,
+ @"Unexpected window becomes main : %@", sender );
if ( _currentProcessDisplay == SeparateView
|| _currentProcessDisplay == SeparateView_NoList )
@@ -605,10 +606,11 @@
- (void)windowDidResignMain:(NSNotification *)aNotification
{
- NSWindow *main = [self window];
+ NSWindow *mainWindow = [self window];
NSWindow *sender = [aNotification object];
- NSAssert1( sender == main, @"Unexpected window becomes main : %@", sender );
+ NSAssert1( sender == mainWindow,
+ @"Unexpected window becomes main : %@", sender );
if ( _currentProcessDisplay == SeparateView
|| _currentProcessDisplay == SeparateView_NoList )
@@ -1288,7 +1290,7 @@
- (void) showHideImageList:(id)sender
{
- LynkeosProcessingViewFrame_t display;
+ LynkeosProcessingViewFrame_t display = BottomTab;
switch( _currentProcessDisplay )
{
@@ -1306,7 +1308,7 @@
- (void) attachDetachProcessView:(id)sender
{
- LynkeosProcessingViewFrame_t display;
+ LynkeosProcessingViewFrame_t display = BottomTab;
switch( _currentProcessDisplay )
{
--- lynkeos.app.orig/Sources/MyProcessingThread.m
+++ lynkeos.app/Sources/MyProcessingThread.m
@@ -145,7 +145,7 @@
NSAutoreleasePool *pool;
NSPort *rxPort;
LynkeosThreadConnection *cnx;
- MyProcessingThread *threadController;
+ MyProcessingThread *threadController = nil;
MyDocument *doc;
pool = [[NSAutoreleasePool alloc] init];
--- lynkeos.app.orig/Sources/MyTiff16Reader.m
+++ lynkeos.app/Sources/MyTiff16Reader.m
@@ -272,7 +272,7 @@
for( xs = x; xs < x+w; xs++ )
{
- float v;
+ float v = 0;
switch ( _nBits )
{
--- lynkeos.app.orig/Sources/MyTiffWriter.m
+++ lynkeos.app/Sources/MyTiffWriter.m
@@ -82,7 +82,7 @@
void *buf;
u_short s, x, y, c;
u_long hstrip;
- double max;
+ double max = 0;
// Choose a strip size
hstrip = 256*1024/scanLineW;
--- lynkeos.app.orig/ThreadConnectionSources/LynkeosThreadConnection.m
+++ lynkeos.app/ThreadConnectionSources/LynkeosThreadConnection.m
@@ -90,7 +90,7 @@
if ( (self = [super init]) != nil )
{
_queue = (NSPortMessage**)malloc( size*sizeof(NSPortMessage*) );
- NSAssert( _queue != nil, @"Cannot allocate 2nd level queue" );
+ NSAssert( _queue != NULL, @"Cannot allocate 2nd level queue" );
_size = size;
_full = NO;
_insert = 0;
--- lynkeos.app.orig/GNUstep/GNUmakefile
+++ lynkeos.app/GNUstep/GNUmakefile
@@ -93,7 +93,7 @@
-lcfitsio -lpthread
#ADDITIONAL_LIB_DIRS +=
-ADDITIONAL_OBJCFLAGS += -Wno-unknown-pragmas
+ADDITIONAL_OBJCFLAGS += -Wno-unknown-pragmas -Wno-cpp
ADDITIONAL_CPPFLAGS += -I. -I.. -I$(PWD).. -I$(PWD)/../Sources \
-I$(PWD)/../ThreadConnectionSources \
-I$(PWD)/../ThirdPartySources/SMDoubleSlider -DNO_FRAMEWORK_CHECK=1
--- lynkeos.app.orig/Sources/MyImageStacker.m
+++ lynkeos.app/Sources/MyImageStacker.m
@@ -228,7 +228,7 @@
else
{
id <LynkeosImageBuffer> image = nil;
- NSPoint offsets[3] = {0.0, 0.0, 0.0};
+ NSPoint offsets[3] = {{0.0}, {0.0}, {0.0}};
LynkeosIntegerRect r = _params->_cropRectangle;
id <LynkeosAlignResult> alignRes
--- lynkeos.app.orig/Sources/LynkeosBasicAlignResult.m
+++ lynkeos.app/Sources/LynkeosBasicAlignResult.m
@@ -29,6 +29,10 @@
#define K_ALIGN_OFFSET @"offset"
#define K_ALIGN_TRANSFORM @"transform"
+@interface LynkeosBasicAlignResult(Private)
+- (void) cacheValues;
+@end
+
@implementation LynkeosBasicAlignResult(Private)
- (void) cacheValues
{
--- lynkeos.app.orig/Sources/MyImageAlignerView.m
+++ lynkeos.app/Sources/MyImageAlignerView.m
@@ -729,7 +729,7 @@
NSNumberFormatter *xFormat = [[NSNumberFormatter alloc] init];
[xFormat setFormatterBehavior:NSNumberFormatterBehavior10_4];
[xFormat setAllowsFloats:NO];
- [xFormat setMinimum:[NSNumber numberWithInt:0]];
+ [xFormat setMinimum:[NSDecimalNumber zero]];
[_xField setFormatter:xFormat];
[_xField setEditable:YES];
@@ -737,7 +737,7 @@
NSNumberFormatter *yFormat = [[NSNumberFormatter alloc] init];
[yFormat setFormatterBehavior:NSNumberFormatterBehavior10_4];
[yFormat setAllowsFloats:NO];
- [yFormat setMinimum:[NSNumber numberWithInt:0]];
+ [yFormat setMinimum:[NSDecimalNumber zero]];
[_yField setFormatter:yFormat];
[_yField setEditable:YES];
@@ -745,7 +745,8 @@
NSNumberFormatter *sizeFormat = [[NSNumberFormatter alloc] init];
[sizeFormat setFormatterBehavior:NSNumberFormatterBehavior10_4];
[sizeFormat setAllowsFloats:NO];
- [sizeFormat setMinimum:[NSNumber numberWithInt:2]];
+ [sizeFormat setMinimum:
+ [[[NSDecimalNumber alloc] initWithInt:2] autorelease]];
[_sizeField setFormatter:sizeFormat];
[_sizeField setControlSize:NSSmallControlSize];
[_sizeField setEditable:YES];
--- lynkeos.app.orig/Sources/MyImageListItem.m
+++ lynkeos.app/Sources/MyImageListItem.m
@@ -1040,7 +1040,7 @@
NSPoint *lOffsets = (NSPoint*)malloc(sizeof(NSPoint)*_nPlanes);
u_short p;
for (p = 0; p < _nPlanes; p++)
- lOffsets[p] = (offsets != nil ? offsets[p] : NSMakePoint(0.0, 0.0));
+ lOffsets[p] = (offsets != NULL ? offsets[p] : NSMakePoint(0.0, 0.0));
if ( _index == NSNotFound )
// Image file
--- lynkeos.app.orig/Sources/FITSReader.m
+++ lynkeos.app/Sources/FITSReader.m
@@ -234,7 +234,7 @@
NSBitmapImageRep* bitmap;
// Create a RGBA bitmap
- bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
+ bitmap = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:_width
pixelsHigh:_height
bitsPerSample:8
--- lynkeos.app.orig/Sources/FITSWriter.m
+++ lynkeos.app/Sources/FITSWriter.m
@@ -79,7 +79,7 @@
metaData:(NSDictionary*)metaData
{
fitsfile *fits;
- double *buf = nil;
+ double *buf = NULL;
u_short x, y;
double max, offset, scale, datamax, datamin;
int err = 0;
--- lynkeos.app.orig/Sources/DcrawReader.m
+++ lynkeos.app/Sources/DcrawReader.m
@@ -557,22 +557,26 @@
ppmFile = fopen( [_ppmFilePath fileSystemRepresentation], "rb" );
- fgets( line, 40, ppmFile ); // First line of input "P5" or "P6"
- if ( strcmp( "P5\n", line ) == 0 )
- NSAssert( _numberOfPlanes == 1,
- @"Number of planes inconsistent after conversion" );
- else if ( strcmp( "P6\n", line ) == 0 )
- NSAssert( _numberOfPlanes == 3,
- @"Number of planes inconsistent after conversion" );
-
- fgets( line, 40, ppmFile ); // Second line "w h"
- NSAssert( sscanf( line, "%hu %hu", &w, &h ) == 2,
- @"Cannot read image size after conversion" );
- NSAssert( w == _width && h == _height,
- @"Image size inconsistent after conversion" );
- fgets( line, 40, ppmFile ); // Third line "max"
- if ( sscanf( line, "%hu", &_dataMax ) != 1 )
- _dataMax = 0;
+ if ( fgets( line, 40, ppmFile ) ) // First line of input "P5" or "P6"
+ {
+ if ( strcmp( "P5\n", line ) == 0 )
+ NSAssert( _numberOfPlanes == 1,
+ @"Number of planes inconsistent after conversion" );
+ else if ( strcmp( "P6\n", line ) == 0 )
+ NSAssert( _numberOfPlanes == 3,
+ @"Number of planes inconsistent after conversion" );
+ }
+
+ if ( fgets( line, 40, ppmFile ) ) // Second line "w h"
+ {
+ NSAssert( sscanf( line, "%hu %hu", &w, &h ) == 2,
+ @"Cannot read image size after conversion" );
+ NSAssert( w == _width && h == _height,
+ @"Image size inconsistent after conversion" );
+ }
+ if ( fgets( line, 40, ppmFile ) ) // Third line "max"
+ if ( sscanf( line, "%hu", &_dataMax ) != 1 )
+ _dataMax = 0;
_ppmDataOffset = ftell( ppmFile );
@@ -632,7 +636,8 @@
fseek( ppmFile,
_ppmDataOffset + sizeof(u_short)*_numberOfPlanes*((y+ys)*_width+x),
SEEK_SET );
- fread( &data[ys*w*_numberOfPlanes], _numberOfPlanes*sizeof(u_short), w, ppmFile );
+ if ( fread( &data[ys*w*_numberOfPlanes], _numberOfPlanes*sizeof(u_short), w, ppmFile ) == 0 )
+ break;
}
fclose( ppmFile );
|