[PATCH 2/2] lib: fwts_guid: constify guid_str_len and guid_len parameters

Colin King colin.king at canonical.com
Sun Dec 16 23:22:25 UTC 2012


From: Colin Ian King <colin.king at canonical.com>

Constify the length parameters.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/include/fwts_guid.h | 4 ++--
 src/lib/src/fwts_guid.c     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lib/include/fwts_guid.h b/src/lib/include/fwts_guid.h
index ba5ee6c..cb13137 100644
--- a/src/lib/include/fwts_guid.h
+++ b/src/lib/include/fwts_guid.h
@@ -23,7 +23,7 @@
 #include <stdlib.h>
 #include <stdint.h>
 
-void fwts_guid_buf_to_str(uint8_t *guid, char *guid_str, size_t guid_str_len);
-void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, size_t guid_len);
+void fwts_guid_buf_to_str(uint8_t *guid, char *guid_str, const size_t guid_str_len);
+void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, const size_t guid_len);
 
 #endif
diff --git a/src/lib/src/fwts_guid.c b/src/lib/src/fwts_guid.c
index b4e9b07..ebb5d4d 100644
--- a/src/lib/src/fwts_guid.c
+++ b/src/lib/src/fwts_guid.c
@@ -26,7 +26,7 @@
  *	format given GUID 'guid' into a string guid_str.
  *	guid_str needs to be at least 37 chars long
  */
-void fwts_guid_buf_to_str(uint8_t *guid, char *guid_str, size_t guid_str_len)
+void fwts_guid_buf_to_str(uint8_t *guid, char *guid_str, const size_t guid_str_len)
 {
 	if (guid_str && guid_str_len > 36)
         	snprintf(guid_str, guid_str_len, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
@@ -39,7 +39,7 @@ void fwts_guid_buf_to_str(uint8_t *guid, char *guid_str, size_t guid_str_len)
  *	convert a GUID string back to a 16 byte GUID
  *	guid needs to be at least 16 chars long
  */
-void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, size_t guid_len)
+void fwts_guid_str_to_buf(const char *guid_str, uint8_t *guid, const size_t guid_len)
 {
 	if (guid && guid_len >= 16) {
 		sscanf(guid_str, "%2hhx%2hhx%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx",
-- 
1.8.0




More information about the fwts-devel mailing list