Re: [viewvc-dev] aspfool.cpp - Improvment

"C. Michael Pilato" <[email protected]> Tue, 18 Oct 2011 15:31:06 -0400
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Organization CollabNet, Inc.
Message-ID <4E9DD3FA.1010906__1794.28045307777$1318966279$gmane$org@collab.net>
Yousha,

Thanks for the recommendation.  But can you explain why your version is an
improvement.  As far as I can tell, you've made two changes:

1.  changed the return type of file_exists() to be unsigned.
2.  added unnecessary parenthesis in the return statement itself.

Am I overlooking something?

On 09/02/2011 08:47 AM, Yousha Alayoub wrote:
> Hi,
> Some changes to improve aspfool.cpp
> 
> ViewVC 1.1.11 
> File: windows/aspfool/aspfool.cpp
> Line #8
> 
> [Original]
> int inline file_exists(TCHAR const * filename)
> {
>   WIN32_FIND_DATA fd;
>   HANDLE fh = FindFirstFile(filename, &fd);
>   if (fh != INVALID_HANDLE_VALUE)
>   {
>     FindClose(fh);
>     return fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? 2 : 1;
> 	 }
> 
>   return 0;
> }
> 
> [Improved]
> unsigned int inline file_exists(TCHAR const * filename)
> {
> 	WIN32_FIND_DATA fd;
> 	HANDLE fh= FindFirstFile(filename, &fd);
> 
> 	if(fh != INVALID_HANDLE_VALUE)
> 	{
> 		FindClose(fh);
> 		return (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? 2 : 1;
> 	}
> 
> 	return 0;
> }
> 
> ------------------------------------------------------
> http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2834579
> 
> To unsubscribe from this discussion, e-mail: [[email protected]].


-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2858567

To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk6d0/oACgkQokEGqRcG/W6dKQCeNqiDmFEevWSNRDsw2mCE5bfF
+5QAoKaxVYaRYolMZ5xviDzmL36fCv+j
=vp0B
-----END PGP SIGNATURE-----