mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-26 19:25:02 +00:00
Make crossystem.h more polite and more useful.
This adds a VB_MAX_STRING_PROPERTY for callers that don't want to guess at how big to make their buffers. Additionally, it changes the size parameter to VbGetPropertyString() from int to size_t. BUG=None TEST=compile the code BRANCH=none Change-Id: I22809d48e13b535593cb22a56444e2dcb27791a5 Reviewed-on: https://chromium-review.googlesource.com/175039 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
fe2c1a231e
commit
a3d70a3d2b
@@ -10,6 +10,12 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Recommended size for string property buffers used with
|
||||
* VbGetSystemPropertyString(). */
|
||||
#define VB_MAX_STRING_PROPERTY ((size_t) 8192)
|
||||
|
||||
/* Reads a system property integer.
|
||||
*
|
||||
* Returns the property value, or -1 if error. */
|
||||
@@ -19,8 +25,12 @@ int VbGetSystemPropertyInt(const char* name);
|
||||
* specified size. Returned string will be null-terminated. If the
|
||||
* buffer is too small, the returned string will be truncated.
|
||||
*
|
||||
* The caller can expect an un-truncated value if the size provided is
|
||||
* at least VB_MAX_STRING_PROPERTY.
|
||||
*
|
||||
* Returns the passed buffer, or NULL if error. */
|
||||
const char* VbGetSystemPropertyString(const char* name, char* dest, int size);
|
||||
const char* VbGetSystemPropertyString(const char* name, char* dest,
|
||||
size_t size);
|
||||
|
||||
/* Sets a system property integer.
|
||||
*
|
||||
@@ -28,6 +38,9 @@ const char* VbGetSystemPropertyString(const char* name, char* dest, int size);
|
||||
int VbSetSystemPropertyInt(const char* name, int value);
|
||||
|
||||
/* Set a system property string.
|
||||
*
|
||||
* The maximum length of the value accepted depends on the specific
|
||||
* property, not on VB_MAX_STRING_PROPERTY.
|
||||
*
|
||||
* Returns 0 if success, -1 if error. */
|
||||
int VbSetSystemPropertyString(const char* name, const char* value);
|
||||
|
||||
Reference in New Issue
Block a user