Review Request: Factor out and reuse the code that guesses mime-type from filename

Dawit Alemayehu adawit at kde.org
Tue Jan 3 14:09:04 GMT 2012



> On Jan. 2, 2012, 10:50 p.m., David Faure wrote:
> > kparts/browseropenorsavequestion.cpp, line 287
> > <http://git.reviewboard.kde.org/r/103617/diff/1/?file=45307#file45307line287>
> >
> >     I don't get what this call changes, here (with no  filename passed to the method). It resolves aliases? But that doesn't matter for mime->is(...). So this seems superfluous.
> 
> Dawit Alemayehu wrote:
>     Ahh... We no longer store the result of doing KMimeType::mimeType(...) in the constructor and hence we do it here again to get the mime-type pointer ? KMimeType::mimeType explicitly says not to store the returned value, but this class for some reason did just that. Or is it okay to ignore KMimeType::mimeType's documentation ?
> 
> David Faure wrote:
>     I think you're mistaken in your reading of the API doc. It says : do not store this into a raw pointer. Storing into a Ptr is ok.
>     It also says, don't compare mimetype pointers, but I don't think the code was doing that.
>     
>     So all in all it seemed fine to me as it was. But I'm ok with not storing a kmimetype::ptr, if you prefer, but then this line of code could just be KMimeType::Ptr mime = KMimeType::mimeType(mimeType);   /*note that ResolveAliases is the default nowadays*/
>     No point in calling the fixup method if we have no filename anyway.

*sigh* all this time I have been misreading that documentation! My brain simply equated "KMimeType*" as being any pointer instead of just the "raw" pointer. Will fix.


- Dawit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103617/#review9484
-----------------------------------------------------------


On Jan. 3, 2012, 5:51 a.m., Dawit Alemayehu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103617/
> -----------------------------------------------------------
> 
> (Updated Jan. 3, 2012, 5:51 a.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Description
> -------
> 
> * Factored out the code that is used to determine the actual mime-type from either another mime-type or a filename.
> * Avoid storing the KMimeType::Ptr returned by KMimeType::mimeType as stated in its documentation.
> 
> 
> Diffs
> -----
> 
>   kparts/browseropenorsavequestion.cpp 092198f 
> 
> Diff: http://git.reviewboard.kde.org/r/103617/diff/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Dawit Alemayehu
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120103/4e0c43c1/attachment.htm>


More information about the kde-core-devel mailing list