Hao,

If these code removing will make the function to be not matched with its original implementation purpose according to the function description, and the description is not updated, the code's readability will be sacrificed. I prefer to keep the code's readability and follow the function's original implementation purpose.


Thanks,
Star

On 2018/10/16 14:28, Wu, Hao A wrote:
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
Leif Lindholm
Sent: Tuesday, October 16, 2018 2:20 PM
To: Wu, Hao A
Cc: Ni, Ruiyu; edk2-devel@lists.01.org; Zeng, Star
Subject: Re: [edk2] [PATCH v1 6/7] MdeModulePkg/UdfDxe: Remove dead
codes in FileName.c

On Mon, Oct 15, 2018 at 12:55:21PM +0800, Hao Wu wrote:
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1249

We found potential dead codes within File.c during the code coverage test.

After manual review, we think the below ones are positive reports:

A. In function MangleFileName():

   FileName = TrimString (FileName);
   // Begin of dead codes
   if (*FileName == L'\0') {
     goto Exit;
   }
   // End of dead codes

When the code reaches the TrimString() call, the string in 'FileName' is
guaranteed to have a '\' character due to the call patterns of

What in the call pattern guarantees this? Please be precise.

OK, I will update the log message.


MangleFileName(). So after trimming the lead-off/tailing white spaces,
string in 'FileName' will not be an empty string.

B. In function MangleFileName():

   if (FileName[0] == L'.') {
     if (FileName[1] == L'.') {
       if (FileName[2] == L'\0') {
         goto Exit;
       } else {
         FileName += 2;
       }
     } else if (FileName[1] == L'\0') {
       goto Exit;
     }
   }

When the code hits the above checks, string in 'FileName' will always have
a leading '\' character (denoting an absolute path) due to the call
patterns of MangleFileName(). So no leading '.' can be there in string
'FileName'.

What in the call pattern guarantees this? Please be precise.

OK, I will update the log message.

Thanks for the comments.

Best Regards,
Hao Wu


Regards,

Leif
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to