aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/Incomplete
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-07-20 14:51:19 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-07-20 14:51:19 +0000
commitbf50959b8016adbf6b295178b26b8173514dd060 (patch)
treeb445d0186a5c3b5f148a398d23247e7a70a1a1c0 /Demos/Device/Incomplete
parent86819ba9d8e30e7eeefd79ece41094a42e521d78 (diff)
downloadlufa-bf50959b8016adbf6b295178b26b8173514dd060.tar.gz
lufa-bf50959b8016adbf6b295178b26b8173514dd060.tar.bz2
lufa-bf50959b8016adbf6b295178b26b8173514dd060.zip
Simplify SideShow GUID compares via a macro.
Diffstat (limited to 'Demos/Device/Incomplete')
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c2
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c8
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
index f2789c4a7..ad26d77b5 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
@@ -63,7 +63,7 @@ SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* GUID)
{
if (InstalledApplications[App].InUse)
{
- if (memcmp(&InstalledApplications[App].ApplicationID, GUID, sizeof(GUID_t)) == 0)
+ if (GUID_COMPARE(&InstalledApplications[App].ApplicationID, GUID))
return &InstalledApplications[App];
}
}
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
index 2726d50da..8dc0b6246 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
@@ -134,9 +134,9 @@ static void SideShow_Sync(SideShow_PacketHeader_t* PacketHeader)
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
Endpoint_ClearOUT();
- if (memcmp(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID, sizeof(GUID_t)) != 0)
+ if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID)))
PacketHeader->Type.NAK = true;
-
+
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
@@ -179,7 +179,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
- if (memcmp(&Property.PropertyGUID, (uint32_t[])SIDESHOW_PROPERTY_GUID, sizeof(GUID_t)) == 0)
+ if (GUID_COMPARE(&Property.PropertyGUID, (uint32_t[])SIDESHOW_PROPERTY_GUID))
{
switch (Property.PropertyID)
{
@@ -233,7 +233,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* PacketHeader)
break;
}
}
- else if (memcmp(&Property.PropertyGUID, (uint32_t[])DEVICE_PROPERTY_GUID, sizeof(GUID_t)) == 0)
+ else if (GUID_COMPARE(&Property.PropertyGUID, (uint32_t[])DEVICE_PROPERTY_GUID))
{
switch (Property.PropertyID)
{
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
index cea81ce66..eb76d7c42 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
@@ -38,6 +38,8 @@
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
+ #define GUID_COMPARE(a, b) (memcmp(a, b, sizeof(GUID_t)) == 0)
+
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
#define UNICODE_STRING_t(x) struct \