-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Stripped dead code #4425
base: develop
Are you sure you want to change the base?
Conversation
@Semty, you definitely do not need to be one of IINA's core developers to propose changes. IINA is slow at reviewing and merging PRs as the senior developers are very busy. Usually it occurs in spurts when those developers have time to focus on IINA. I am a newbie junior contributor. I don't merge, but I do review PRs. No promises, but I will try and find time to take a look at this one this weekend. This really needs a review by the senior developers as it covers areas of IINA I am unfamiliar with. At the moment the senior developers are focused on getting a release out. The release branch as already been cut. The hold up is the need to patch some problems in the updated dependencies. Commits going into While on the topic of contributing I should point out that although CONTRIBUTING indicates the latest version of Xcode must be used, at the moment we are building with Xcode 13 as well as Xcode 14 in order to support macOS 10.11 and 10.12, which Xcode 14 dropped. |
@low-batt hey! Got it, thank you so much for your thorough response 👌. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled the PR locally, built IINA and confirmed IINA started and was able to play a video.
I'm unfamiliar with a lot of this code, so the real review must be done by the senior developers. I had planned on not requesting changes and leaving it to those developers to request changes as I am unsure as to whether they would agree with some of my comments. However…
I'm certain this PR in its current state will be rejected due to including changes to generated sources. This is an existing pitfall for new contributors. I have entered issue #4429 for the failure to properly identify generated sources. See that issue and my inline comment.
On my other comments, feel free to wait and see what the other developers think.
Thank you for proposing these changes to IINA!
@@ -1394,7 +1360,7 @@ class MPVController: NSObject { | |||
} | |||
} | |||
|
|||
fileprivate func mpvGetOpenGLFunc(_ ctx: UnsafeMutableRawPointer?, _ name: UnsafePointer<Int8>?) -> UnsafeMutableRawPointer? { | |||
fileprivate func mpvGetOpenGLFunc(_: UnsafeMutableRawPointer?, _ name: UnsafePointer<Int8>?) -> UnsafeMutableRawPointer? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will have to see what the senior developers think, but I'm strongly against removing the name of parameters, even if they are not used. After this change a developer reading this code can't tell what it is that is being passed and ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not changing
_: CVDisplayLink, _: UnsafePointer<CVTimeStamp>, | ||
_: UnsafePointer<CVTimeStamp>, | ||
_: CVOptionFlags, | ||
_: UnsafeMutablePointer<CVOptionFlags>, | ||
_ context: UnsafeMutableRawPointer?) -> CVReturn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although unused with respects to the code, these parameter names effectively provide documentation for developers reading the code. See what the senior developers say, but I am against removing parameter names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I tend to disagree here. My two points:
- In my opinion, it actually better to omit some stuff that you don't need to perform your logic, you have less things to grasp and see only the important ones
- If you want to change/debug this piece of code, it's better if you're familiar with it a bit more than just knowing the parameter names. It can be done really easily by checking where this function is used (
CVDisplayLinkSetOutputCallback
) and locating the parameter (CVDisplayLinkOutputCallback
). After that you'll see the complete documentation with everything you may need
But, of course, I understand that it can be a hot topic, so I'm fully okay to return parameter names in every function even if it's not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On this one lets see what the senior developers think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate konmari efforts. Lots of this needs to go. Deciding which parts, though, is complicated. In general, these things should probably not be removed:
- Sets of related properties or methods that exist for completeness: e.g. if we have setString, setInt, setDouble, … it doesn't make sense to remove one of these because it's not used. People expect the full set of APIs to be available.
- Things that were just added and intend to be used in the near future. Determining this will probably be hard. cc @lhc70000 @uiryuu since they should sign off on this.
Marking for changes because some of these definitely need to be rolled back–see the comments for the ones I spotted.
/** Tags for "Open File/URL" menu item when "Always open file in new windows" is off. Vice versa. */ | ||
fileprivate let NormalMenuItemTag = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell this was never used, perhaps worth adjusting the code to reflect that?
@@ -55,7 +55,7 @@ class CollapseView: NSStackView { | |||
updateContentView(animated: animated) | |||
} | |||
|
|||
@objc private func triggerAction(_ sender: NSControl) { | |||
@objc private func triggerAction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saagarjha hey! thank you for your review!
You can't remove this parameter, see https://developer.apple.com/library/archive/documentation/General/Conceptual/Devpedia-CocoaApp/TargetAction.html#//apple_ref/doc/uid/TP40009071-CH3-SW2
are you sure? it works on iOS to omit the sender
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's legal on iOS, but not on macOS. Things will mostly still work because the argument register will probably not get touched but it's good to do it correctly.
/// A Boolean value that indicates whether this executable was an optimized (not debug) build. | ||
#if DEBUG | ||
let isDebug = true | ||
#else | ||
let isDebug = false | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this was just added recently, @low-batt you should probably look at this and see if you needed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let keep this, although there isn't any code using this. We might want to use this in the future.
|
||
if externalURL != nil { | ||
self.isExternal = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @lhc70000 did you intend to do something with this
|
||
func add(_ multiplier: CGFloat) -> NSSize { | ||
return NSSize(width: width + multiplier, height: height + multiplier) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove spaces
/// A Boolean value that indicates whether this executable was an optimized (not debug) build. | ||
#if DEBUG | ||
let isDebug = true | ||
#else | ||
let isDebug = false | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let keep this, although there isn't any code using this. We might want to use this in the future.
@@ -1394,7 +1360,7 @@ class MPVController: NSObject { | |||
} | |||
} | |||
|
|||
fileprivate func mpvGetOpenGLFunc(_ ctx: UnsafeMutableRawPointer?, _ name: UnsafePointer<Int8>?) -> UnsafeMutableRawPointer? { | |||
fileprivate func mpvGetOpenGLFunc(_: UnsafeMutableRawPointer?, _ name: UnsafePointer<Int8>?) -> UnsafeMutableRawPointer? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not changing
@@ -195,7 +195,7 @@ class ViewLayer: CAOpenGLLayer { | |||
} | |||
|
|||
// MARK: Utils | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just drop some comments here, will take a deeper look another day. Merge conflicts look scary but are surprisingly trivial.
@@ -11,7 +11,7 @@ import Cocoa | |||
class Aspect: NSObject { | |||
|
|||
private var size: NSSize! | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space
@@ -20,7 +20,7 @@ class Aspect: NSObject { | |||
size.width = newValue | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space
_: CVDisplayLink, _: UnsafePointer<CVTimeStamp>, | ||
_: UnsafePointer<CVTimeStamp>, | ||
_: CVOptionFlags, | ||
_: UnsafeMutablePointer<CVOptionFlags>, | ||
_ context: UnsafeMutableRawPointer?) -> CVReturn { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to keep it as it is.
Description:
Stripped dead code throughout the project.
It's a good practice to perform from time to time, leaving only the code that is actually in use.
Note:
I'm not sure whether this project still accepts pull requests from not core team members.
@low-batt, it seems to me that you're the most active participant lately, could you, please, help me with that?