@@ -55,9 +55,10 @@ class Delegate
55
55
* @brief Can the selected locations be set by the client in the current operating mode?
56
56
* @param[out] statusText text describing why the selected locations cannot be set (if return is false).
57
57
* Max size kMaxSizeStatusText.
58
- * Note: If the return is false and statusText is not successfully set, for example due to a string that can be longer than
59
- * kMaxSizeStatusText, the size of this value should be set to 0 with .reduce_size(0) to avoid callers using un-initialized
60
- * memory.
58
+ * Note: statusText must be successfully set if the return is false. Use CopyCharSpanToMutableCharSpanWithTruncation to
59
+ * ensure that a message is copied successfully. Otherwise, ensure that if setting the statusText can fail (e.g., due
60
+ * to exceeding kMaxSizeStatusText) the size of this value is set to 0 with .reduce_size(0) to avoid callers using
61
+ * un-initialized memory.
61
62
* @return true if the current device state allows selected locations to be set by user.
62
63
*
63
64
* @note The statusText field SHOULD indicate why the request is not allowed, given the current mode
@@ -77,9 +78,10 @@ class Delegate
77
78
* @param[in] selectedAreas List of new selected locations.
78
79
* @param[out] locationStatus Success if all checks pass, error code if failure.
79
80
* @param[out] statusText text describing failure (see description above). Max size kMaxSizeStatusText.
80
- * Note: If the return is false and statusText is not successfully set, for example due to a string that can be longer than
81
- * kMaxSizeStatusText, the size of this value should be set to 0 with .reduce_size(0) to avoid callers using un-initialized
82
- * memory.
81
+ * Note: statusText must be successfully set if the return is false. Use CopyCharSpanToMutableCharSpanWithTruncation to
82
+ * ensure that a message is copied successfully. Otherwise, ensure that if setting the statusText can fail (e.g., due
83
+ * to exceeding kMaxSizeStatusText) the size of this value is set to 0 with .reduce_size(0) to avoid callers using
84
+ * un-initialized memory.
83
85
* @return true if success.
84
86
*
85
87
* @note If the SelectAreas command is allowed when the device is operating and the selected locations change to none, the
@@ -93,9 +95,10 @@ class Delegate
93
95
* calling this method.
94
96
* @param[in] skippedArea the area ID to skip.
95
97
* @param[out] skipStatusText text describing why the current location cannot be skipped. Max size kMaxSizeStatusText.
96
- * Note: If the return is false and skipStatusText is not successfully set, for example due to a string that can be longer than
97
- * kMaxSizeStatusText, the size of this value should be set to 0 with .reduce_size(0) to avoid callers using un-initialized
98
- * memory.
98
+ * Note: skipStatusText must be successfully set if the return is false. Use CopyCharSpanToMutableCharSpanWithTruncation to
99
+ * ensure that a message is copied successfully. Otherwise, ensure that if setting the skipStatusText can fail (e.g., due
100
+ * to exceeding kMaxSizeStatusText) the size of this value is set to 0 with .reduce_size(0) to avoid callers using
101
+ * un-initialized memory.
99
102
* @return true if command is successful, false if the received skip request cannot be handled due to the current mode of the
100
103
* device.
101
104
*
@@ -120,7 +123,7 @@ class Delegate
120
123
virtual bool HandleSkipArea (uint32_t skippedArea, MutableCharSpan & skipStatusText)
121
124
{
122
125
// device support of this command is optional
123
- CopyCharSpanToMutableCharSpan (" Skip Current Area command not supported by device" _span, skipStatusText);
126
+ CopyCharSpanToMutableCharSpanWithTruncation (" Skip Current Area command not supported by device" _span, skipStatusText);
124
127
return false ;
125
128
}
126
129
0 commit comments