public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] VfrCompile: fix invalid comparison between pointer and integer
@ 2017-02-13 12:54 Paolo Bonzini
  2017-02-13 13:55 ` Zhu, Yonghong
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2017-02-13 12:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: yonghong.zhu, liming.gao

This would be valid C but is not valid C++, so change the comparison
to do what it has always been doing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 3ca57ed..2f97975 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
   UINT8       BlockType;
   EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
   
-  if (mStringFileName == '\0' ) {
+  if (mStringFileName == NULL) {
     return NULL;
   }
 
-- 
2.9.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
  2017-02-13 12:54 [PATCH] VfrCompile: fix invalid comparison between pointer and integer Paolo Bonzini
@ 2017-02-13 13:55 ` Zhu, Yonghong
  2017-02-13 14:18   ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Zhu, Yonghong @ 2017-02-13 13:55 UTC (permalink / raw)
  To: Paolo Bonzini, edk2-devel@ml01.01.org; +Cc: Gao, Liming, Zhu, Yonghong

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

Hi Paolo Bonzini,

We already had another patch for this issue.  Please help to check the attachment. Thanks.

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Paolo Bonzini [mailto:pbonzini@redhat.com] 
Sent: Monday, February 13, 2017 8:54 PM
To: edk2-devel@ml01.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH] VfrCompile: fix invalid comparison between pointer and integer

This would be valid C but is not valid C++, so change the comparison to do what it has always been doing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 3ca57ed..2f97975 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
   UINT8       BlockType;
   EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
   
-  if (mStringFileName == '\0' ) {
+  if (mStringFileName == NULL) {
     return NULL;
   }
 
--
2.9.3


[-- Attachment #2: Type: message/rfc822, Size: 4223 bytes --]

From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Nikolai SAOUKH <nms@otdel-1.org>
Subject: [edk2] [Patch] BaseTools: NULL pointer comparison to a char literal should be to NULL
Date: Fri, 10 Feb 2017 09:26:03 +0000
Message-ID: <1486718763-4596-1-git-send-email-yonghong.zhu@intel.com>

From: Nikolai SAOUKH <nms@otdel-1.org>

GCC7 complaint -- error: ISO C++ forbids comparison between pointer and
integer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 3ca57ed..b81fc7b 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -3370,11 +3370,11 @@ CVfrStringDB::GetVarStoreNameFormStringId (
   EFI_STATUS  Status;
   CHAR8       LineBuf[EFI_IFR_MAX_LENGTH];
   UINT8       BlockType;
   EFI_HII_STRING_PACKAGE_HDR *PkgHeader;

-  if (mStringFileName == '\0' ) {
+  if (mStringFileName == NULL || *mStringFileName == '\0' ) {
     return NULL;
   }

   if ((pInFile = fopen (LongFilePath (mStringFileName), "rb")) == NULL) {
     return NULL;
--
2.6.1.windows.1

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
  2017-02-13 13:55 ` Zhu, Yonghong
@ 2017-02-13 14:18   ` Paolo Bonzini
  2017-02-15  8:46     ` Zhu, Yonghong
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2017-02-13 14:18 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@ml01.01.org; +Cc: Gao, Liming



On 13/02/2017 14:55, Zhu, Yonghong wrote:
> Hi Paolo Bonzini,
> 
> We already had another patch for this issue.  Please help to check the attachment. Thanks.

Is it intended that "-s ''" is not an error, rather it is the same as no
option at all?

Paolo

> Best Regards,
> Zhu Yonghong
> 
> 
> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com] 
> Sent: Monday, February 13, 2017 8:54 PM
> To: edk2-devel@ml01.01.org
> Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
> 
> This would be valid C but is not valid C++, so change the comparison to do what it has always been doing.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> index 3ca57ed..2f97975 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> @@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
>    UINT8       BlockType;
>    EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
>    
> -  if (mStringFileName == '\0' ) {
> +  if (mStringFileName == NULL) {
>      return NULL;
>    }
>  
> --
> 2.9.3
> 
> 
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
  2017-02-13 14:18   ` Paolo Bonzini
@ 2017-02-15  8:46     ` Zhu, Yonghong
  2017-02-15  9:11       ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Zhu, Yonghong @ 2017-02-15  8:46 UTC (permalink / raw)
  To: Paolo Bonzini, edk2-devel@ml01.01.org; +Cc: Gao, Liming, Zhu, Yonghong

Hi Paolo,

"-s ''" is an error, current the error message is not same as no option, because the content after the " all be treated as -s 's input.
May I know what's your comment on  Nikolai SAOUKH's patch ?

-  if (mStringFileName == '\0' ) {
+  if (mStringFileName == NULL || *mStringFileName == '\0' ) {


Best Regards,
Zhu Yonghong


-----Original Message-----
From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
Sent: Monday, February 13, 2017 10:18 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@ml01.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH] VfrCompile: fix invalid comparison between pointer and integer



On 13/02/2017 14:55, Zhu, Yonghong wrote:
> Hi Paolo Bonzini,
> 
> We already had another patch for this issue.  Please help to check the attachment. Thanks.

Is it intended that "-s ''" is not an error, rather it is the same as no option at all?

Paolo

> Best Regards,
> Zhu Yonghong
> 
> 
> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Monday, February 13, 2017 8:54 PM
> To: edk2-devel@ml01.01.org
> Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming 
> <liming.gao@intel.com>
> Subject: [PATCH] VfrCompile: fix invalid comparison between pointer 
> and integer
> 
> This would be valid C but is not valid C++, so change the comparison to do what it has always been doing.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp 
> b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> index 3ca57ed..2f97975 100644
> --- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> +++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
> @@ -3372,7 +3372,7 @@ CVfrStringDB::GetVarStoreNameFormStringId (
>    UINT8       BlockType;
>    EFI_HII_STRING_PACKAGE_HDR *PkgHeader;
>    
> -  if (mStringFileName == '\0' ) {
> +  if (mStringFileName == NULL) {
>      return NULL;
>    }
>  
> --
> 2.9.3
> 
> 
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
  2017-02-15  8:46     ` Zhu, Yonghong
@ 2017-02-15  9:11       ` Paolo Bonzini
  2017-02-16  9:03         ` Zhu, Yonghong
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2017-02-15  9:11 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@ml01.01.org; +Cc: Gao, Liming



On 15/02/2017 09:46, Zhu, Yonghong wrote:
> 
> "-s ''" is an error, current the error message is not same as no option, because the content after the " all be treated as -s 's input.
> May I know what's your comment on  Nikolai SAOUKH's patch ?
> 
> -  if (mStringFileName == '\0' ) {
> +  if (mStringFileName == NULL || *mStringFileName == '\0' ) {

If "-s ''" is an error, it should be pointless to check *mStringFileName.

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] VfrCompile: fix invalid comparison between pointer and integer
  2017-02-15  9:11       ` Paolo Bonzini
@ 2017-02-16  9:03         ` Zhu, Yonghong
  0 siblings, 0 replies; 6+ messages in thread
From: Zhu, Yonghong @ 2017-02-16  9:03 UTC (permalink / raw)
  To: Paolo Bonzini, edk2-devel@ml01.01.org
  Cc: Gao, Liming, Nikolai SAOUKH, Zhu, Yonghong

Hi Paolo,

Yes, I agree with you.  I also add Nikolai SAOUKH in loop in case he may have different comment.

Best Regards,
Zhu Yonghong


-----Original Message-----
From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini
Sent: Wednesday, February 15, 2017 5:11 PM
To: Zhu, Yonghong <yonghong.zhu@intel.com>; edk2-devel@ml01.01.org
Cc: Gao, Liming <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH] VfrCompile: fix invalid comparison between pointer and integer



On 15/02/2017 09:46, Zhu, Yonghong wrote:
> 
> "-s ''" is an error, current the error message is not same as no option, because the content after the " all be treated as -s 's input.
> May I know what's your comment on  Nikolai SAOUKH's patch ?
> 
> -  if (mStringFileName == '\0' ) {
> +  if (mStringFileName == NULL || *mStringFileName == '\0' ) {

If "-s ''" is an error, it should be pointless to check *mStringFileName.

Paolo


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-16  9:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 12:54 [PATCH] VfrCompile: fix invalid comparison between pointer and integer Paolo Bonzini
2017-02-13 13:55 ` Zhu, Yonghong
2017-02-13 14:18   ` Paolo Bonzini
2017-02-15  8:46     ` Zhu, Yonghong
2017-02-15  9:11       ` Paolo Bonzini
2017-02-16  9:03         ` Zhu, Yonghong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox