projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move the length decrements in the pipe and endpoint stream functions to the point...
[pub/lufa.git]
/
LUFA
/
Drivers
/
USB
/
LowLevel
/
Endpoint.c
diff --git
a/LUFA/Drivers/USB/LowLevel/Endpoint.c
b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index
4615baa
..
a872a00
100644
(file)
--- a/
LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/
LUFA/Drivers/USB/LowLevel/Endpoint.c
@@
-117,7
+117,7
@@
uint8_t Endpoint_Discard_Stream(uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
- while (Length
--
)
\r
+ while (Length)
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
@@
-134,6
+134,7
@@
uint8_t Endpoint_Discard_Stream(uint16_t Length
else
\r
{
\r
Endpoint_Discard_Byte();
\r
else
\r
{
\r
Endpoint_Discard_Byte();
\r
+ Length--;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-152,7
+153,7
@@
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
- while (Length
--
)
\r
+ while (Length)
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
@@
-169,6
+170,7
@@
uint8_t Endpoint_Write_Stream_LE(const void* Buffer, uint16_t Length
else
\r
{
\r
Endpoint_Write_Byte(*(DataStream++));
\r
else
\r
{
\r
Endpoint_Write_Byte(*(DataStream++));
\r
+ Length--;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-187,7
+189,7
@@
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
- while (Length
--
)
\r
+ while (Length)
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
@@
-204,6
+206,7
@@
uint8_t Endpoint_Write_Stream_BE(const void* Buffer, uint16_t Length
else
\r
{
\r
Endpoint_Write_Byte(*(DataStream--));
\r
else
\r
{
\r
Endpoint_Write_Byte(*(DataStream--));
\r
+ Length--;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-222,7
+225,7
@@
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
- while (Length
--
)
\r
+ while (Length)
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
@@
-239,6
+242,7
@@
uint8_t Endpoint_Read_Stream_LE(void* Buffer, uint16_t Length
else
\r
{
\r
*(DataStream++) = Endpoint_Read_Byte();
\r
else
\r
{
\r
*(DataStream++) = Endpoint_Read_Byte();
\r
+ Length--;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-257,7
+261,7
@@
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
if ((ErrorCode = Endpoint_WaitUntilReady()))
\r
return ErrorCode;
\r
\r
- while (Length
--
)
\r
+ while (Length)
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
{
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
@@
-274,6
+278,7
@@
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
else
\r
{
\r
*(DataStream--) = Endpoint_Read_Byte();
\r
else
\r
{
\r
*(DataStream--) = Endpoint_Read_Byte();
\r
+ Length--;
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-294,7
+299,6
@@
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
Endpoint_Write_Byte(*(DataStream++));
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
Endpoint_Write_Byte(*(DataStream++));
\r
-
\r
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r
@@
-329,7
+333,6
@@
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length)
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
Endpoint_Write_Byte(*(DataStream--));
\r
while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
{
\r
Endpoint_Write_Byte(*(DataStream--));
\r
-
\r
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r
@@
-362,7
+365,6
@@
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length)
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
*(DataStream++) = Endpoint_Read_Byte();
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
*(DataStream++) = Endpoint_Read_Byte();
\r
-
\r
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r
@@
-385,7
+387,6
@@
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length)
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
*(DataStream--) = Endpoint_Read_Byte();
\r
while (Length && Endpoint_BytesInEndpoint())
\r
{
\r
*(DataStream--) = Endpoint_Read_Byte();
\r
-
\r
Length--;
\r
}
\r
\r
Length--;
\r
}
\r
\r