Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/neutrinolabs/xrdp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichiro IWAO <meta@vmeta.jp>2022-11-01 17:40:09 +0300
committerKoichiro IWAO <meta@vmeta.jp>2022-11-01 18:20:31 +0300
commit32da5a7ed638afbe81c775ed0900932a905712b0 (patch)
treec4779c540f739690a16c5a2a434891bc2042dc38
parent44c977a7c2b590d0301a2a80caaf387e884704c8 (diff)
Replace guid_to_str() with ms_guid_to_str()
-rw-r--r--common/guid.c10
-rw-r--r--common/guid.h11
-rw-r--r--libxrdp/xrdp_caps.c7
-rw-r--r--tests/common/test_guid.c26
4 files changed, 25 insertions, 29 deletions
diff --git a/common/guid.c b/common/guid.c
index ae0386d4..cf863648 100644
--- a/common/guid.c
+++ b/common/guid.c
@@ -65,15 +65,9 @@ guid_is_set(const struct guid *guid)
}
-const char *guid_to_str(const struct guid *guid, char *str)
+const char *guid_to_str(const struct guid *src, char *dest)
{
- g_bytes_to_hexstr(guid->g, GUID_SIZE, str, GUID_STR_SIZE);
- return str;
-}
-
-const char *ms_guid_to_str(const char *src, char *dest)
-{
- const unsigned char *guid = (const unsigned char *)src;
+ const unsigned char *guid = (const unsigned char *)src->g;
/*
* Flipping integers into little-endian
diff --git a/common/guid.h b/common/guid.h
index 060e9a03..c68823a2 100644
--- a/common/guid.h
+++ b/common/guid.h
@@ -71,16 +71,7 @@ guid_is_set(const struct guid *guid);
* representation
* @return str is returned for convenience
*/
-const char *guid_to_str(const struct guid *guid, char *str);
+const char *guid_to_str(const struct guid *guid, char *dest);
-
-/**
- * Converts a Microsoft's COM GUID to a string representation
- *
- * @param src GUID to represent
- * @param dest pointer to at least GUID_STR_SIZE bytes to store the
- * representation
- */
-const char *ms_guid_to_str(const char *src, char *dest);
#endif
diff --git a/libxrdp/xrdp_caps.c b/libxrdp/xrdp_caps.c
index 035f4576..2f3d8e75 100644
--- a/libxrdp/xrdp_caps.c
+++ b/libxrdp/xrdp_caps.c
@@ -522,8 +522,11 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
int i1;
char *codec_guid;
char *next_guid;
+ struct guid guid;
char codec_guid_str[GUID_STR_SIZE];
+ guid_clear(&guid);
+
if (len < 1)
{
LOG(LOG_LEVEL_ERROR, "xrdp_caps_process_codecs: error");
@@ -535,7 +538,9 @@ xrdp_caps_process_codecs(struct xrdp_rdp *self, struct stream *s, int len)
for (index = 0; index < codec_count; index++)
{
codec_guid = s->p;
- ms_guid_to_str(codec_guid, codec_guid_str);
+
+ g_memcpy(guid.g, s->p, GUID_SIZE);
+ guid_to_str(&guid, codec_guid_str);
if (len < 16 + 1 + 2)
{
diff --git a/tests/common/test_guid.c b/tests/common/test_guid.c
index c39152de..7580bb95 100644
--- a/tests/common/test_guid.c
+++ b/tests/common/test_guid.c
@@ -4,47 +4,53 @@
#endif
#include "guid.h"
-#include "string_calls.h"
#include "ms-rdpbcgr.h"
+#include "os_calls.h"
#include "test_common.h"
/******************************************************************************/
-START_TEST(test_ms_guid_to_str_remotefx)
+START_TEST(test_guid_to_str_remotefx)
{
/* setup */
char dest[GUID_STR_SIZE];
+ struct guid guid;
+ g_memcpy(guid.g, XR_CODEC_GUID_REMOTEFX, GUID_SIZE);
/* test */
- ms_guid_to_str(XR_CODEC_GUID_REMOTEFX, dest);
+ guid_to_str(&guid, dest);
/* verify */
ck_assert_str_eq(dest, "76772F12-BD72-4463-AFB3-B73C9C6F7886");
}
END_TEST
-START_TEST(test_ms_guid_to_str_nscodec)
+START_TEST(test_guid_to_str_nscodec)
{
/* setup */
char dest[GUID_STR_SIZE];
+ struct guid guid;
+ g_memcpy(guid.g, XR_CODEC_GUID_NSCODEC, GUID_SIZE);
/* test */
- ms_guid_to_str(XR_CODEC_GUID_NSCODEC, dest);
+ guid_to_str(&guid, dest);
/* verify */
ck_assert_str_eq(dest, "CA8D1BB9-000F-154F-589F-AE2D1A87E2D6");
}
END_TEST
-START_TEST(test_ms_guid_to_str_ignore)
+START_TEST(test_guid_to_str_ignore)
{
/* setup */
char dest[GUID_STR_SIZE];
+ struct guid guid;
+ g_memcpy(guid.g, XR_CODEC_GUID_IGNORE, GUID_SIZE);
/* test */
- ms_guid_to_str(XR_CODEC_GUID_IGNORE, dest);
+ guid_to_str(&guid, dest);
/* verify */
ck_assert_str_eq(dest, "0C4351A6-3535-42AE-910C-CDFCE5760B58");
@@ -63,9 +69,9 @@ make_suite_test_guid(void)
tc_guid = tcase_create("guid_to_str");
suite_add_tcase(s, tc_guid);
- tcase_add_test(tc_guid, test_ms_guid_to_str_remotefx);
- tcase_add_test(tc_guid, test_ms_guid_to_str_nscodec);
- tcase_add_test(tc_guid, test_ms_guid_to_str_ignore);
+ tcase_add_test(tc_guid, test_guid_to_str_remotefx);
+ tcase_add_test(tc_guid, test_guid_to_str_nscodec);
+ tcase_add_test(tc_guid, test_guid_to_str_ignore);
return s;
}