Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: src/platform/vboot_reference/include/utility.h

Issue 661353: Vboot Reference: Refactor Code. (Closed)
Patch Set: Review Fixes. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/platform/vboot_reference/include/utility.h
diff --git a/src/platform/vboot_reference/include/utility.h b/src/platform/vboot_reference/include/utility.h
index 36182632d3eedd23e1f189903f073a2f92aed0eb..b26e2477907e351e1ef99ea97efb7d1101bd9e34 100644
--- a/src/platform/vboot_reference/include/utility.h
+++ b/src/platform/vboot_reference/include/utility.h
@@ -41,7 +41,7 @@ typedef struct MemcpyState {
/* Copy [len] bytes into [dst] only if there's enough data to read according
* to [state].
- * On success, return [dst] and update [state]..
+ * On success, return [dst] and update [state].
* On failure, return NULL, set remaining len in state to -1.
*
* Useful for iterating through a binary blob to populate a struct. After the
@@ -49,5 +49,14 @@ typedef struct MemcpyState {
*/
void* StatefulMemcpy(MemcpyState* state, void* dst, int len);
+/* Like StatefulMemcpy() but copies in the opposite direction, populating
+ * data from [src] into the buffer encapsulated in state [state].
+ * On success, return [src] and update [state].
+ * On failure, return NULL, set remaining_len in state to -1.
+ *
+ * Useful for iterating through a structure to populate a binary blob. After the
+ * first failure (buffer overrun), successive calls will always fail.
+ */
+const void* StatefulMemcpy_r(MemcpyState* state, const void* src, int len);
#endif /* VBOOT_REFERENCE_UTILITY_H_ */
« no previous file with comments | « src/platform/vboot_reference/include/signature_digest.h ('k') | src/platform/vboot_reference/tests/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698