libsparse: Fix verbose_error string usage
Switch vnsprintf to StringPrintf to avoid off-by-one, and switch
sparse_read.c to cpp.
Test: fastboot flash normal image with smaller sparse limit
Change-Id: Ia399b167625deb271bfd0ee3273071306d71c4d4
diff --git a/libsparse/sparse_format.h b/libsparse/sparse_format.h
index c41f12a..779e038 100644
--- a/libsparse/sparse_format.h
+++ b/libsparse/sparse_format.h
@@ -18,6 +18,10 @@
#define _LIBSPARSE_SPARSE_FORMAT_H_
#include "sparse_defs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct sparse_header {
__le32 magic; /* 0xed26ff3a */
__le16 major_version; /* (0x1) - reject images with higher major versions */
@@ -52,4 +56,8 @@
* For a CRC32 chunk, it's 4 bytes of CRC32
*/
+#ifdef __cplusplus
+}
+#endif
+
#endif