[edk2-devel] [PATCH] BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH

Enze Zhu posted 1 patch 3 years, 4 months ago
Failed in applying to current master (apply log)
BaseTools/Source/C/Common/CommonLib.h | 8 ++++++++
1 file changed, 8 insertions(+)
[edk2-devel] [PATCH] BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH
Posted by Enze Zhu 3 years, 4 months ago
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3032

We had a build fail due to the hard coded MAX_LONG_FILE_PATH value.
We should use PATH_MAX if it is available.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Enze Zhu <zhuenze@byosoft.com.cn>
---
 BaseTools/Source/C/Common/CommonLib.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
index e1cce985f7..0f05d88db2 100644
--- a/BaseTools/Source/C/Common/CommonLib.h
+++ b/BaseTools/Source/C/Common/CommonLib.h
@@ -12,9 +12,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <Common/UefiBaseTypes.h>
 #include <Common/BuildVersion.h>
 #include <assert.h>
+#ifndef _WIN32
+#include <limits.h>
+#endif
+
 #define PRINTED_GUID_BUFFER_SIZE  37  // including null-termination
 
+#ifdef PATH_MAX
+#define MAX_LONG_FILE_PATH PATH_MAX
+#else
 #define MAX_LONG_FILE_PATH 500
+#endif
 
 #define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
 #define MAX_UINT32 ((UINT32)0xFFFFFFFF)
-- 
2.27.0.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69081): https://edk2.groups.io/g/devel/message/69081
Mute This Topic: https://groups.io/mt/78995536/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH
Posted by Bob Feng 3 years, 4 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Enze Zhu <zhuenze@byosoft.com.cn> 
Sent: Thursday, December 17, 2020 10:20 AM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>
Subject: [PATCH] BaseTools/CommonLib.h: Build failed due to MAX_LONG_FILE_PATH

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3032

We had a build fail due to the hard coded MAX_LONG_FILE_PATH value.
We should use PATH_MAX if it is available.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Enze Zhu <zhuenze@byosoft.com.cn>
---
 BaseTools/Source/C/Common/CommonLib.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/BaseTools/Source/C/Common/CommonLib.h b/BaseTools/Source/C/Common/CommonLib.h
index e1cce985f7..0f05d88db2 100644
--- a/BaseTools/Source/C/Common/CommonLib.h
+++ b/BaseTools/Source/C/Common/CommonLib.h
@@ -12,9 +12,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include <Common/UefiBaseTypes.h>  #include <Common/BuildVersion.h>  #include <assert.h>
+#ifndef _WIN32
+#include <limits.h>
+#endif
+
 #define PRINTED_GUID_BUFFER_SIZE  37  // including null-termination
 
+#ifdef PATH_MAX
+#define MAX_LONG_FILE_PATH PATH_MAX
+#else
 #define MAX_LONG_FILE_PATH 500
+#endif
 
 #define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)  #define MAX_UINT32 ((UINT32)0xFFFFFFFF)
--
2.27.0.windows.1




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69181): https://edk2.groups.io/g/devel/message/69181
Mute This Topic: https://groups.io/mt/78995536/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-