Remove some gcc compiler warnings

This commit is contained in:
Fred Kiefer 2023-12-28 14:45:16 +01:00
parent 7fce63432a
commit 3a6dce02be
6 changed files with 85 additions and 86 deletions

View file

@ -30,74 +30,6 @@ static NSUInteger minYAttribute = 33;
static NSUInteger maxXAttribute = 36;
static NSUInteger maxYAttribute = 37;
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
+ (NSAutoresizingMaskLayoutConstraint *)
_xConstraintForAutoresizingMask: (NSAutoresizingMaskOptions)autoresizingMask
subitem: (NSView *)subItem
@ -292,4 +224,72 @@ static NSUInteger maxYAttribute = 37;
}
}
+ (NSArray *)constraintsWithAutoresizingMask:
(NSAutoresizingMaskOptions) autoresizingMask
subitem: (NSView *) subItem
frame: (NSRect) frame
superitem: (NSView *) superItem
bounds: (NSRect) bounds
{
if (autoresizingMask == NSViewNotSizable)
{
return [NSArray array];
}
NSAutoresizingMaskLayoutConstraint *xConstraint =
[self _xConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *yConstraint =
[self _yConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *widthConstraint =
[self _widthConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSAutoresizingMaskLayoutConstraint *heightConstraint =
[self _heightConstraintForAutoresizingMask: autoresizingMask
subitem: subItem
frame: frame
superitem: superItem
bounds: bounds];
NSMutableArray *constraints = [NSMutableArray arrayWithCapacity:4];
// The order of constraints was determined from MacOS behaviour.
// For the majority of users it will not matter, but we should assume that users have coupled to the ordering.
if ((autoresizingMask & NSViewMinXMargin)
&& (autoresizingMask & NSViewMaxXMargin))
{
[constraints addObject: widthConstraint];
[constraints addObject: xConstraint];
}
else
{
[constraints addObject: xConstraint];
[constraints addObject: widthConstraint];
}
if ((autoresizingMask & NSViewMinYMargin)
&& (autoresizingMask & NSViewMaxYMargin))
{
[constraints addObject: heightConstraint];
[constraints addObject: yConstraint];
}
else
{
[constraints addObject: yConstraint];
[constraints addObject: heightConstraint];
}
return constraints;
}
@end