Skip to content

Commit

Permalink
Merge pull request #18117 from LP-HAW/fix-phydat_to_json
Browse files Browse the repository at this point in the history
sys/phydat: fix phydat_to_json precondition
  • Loading branch information
chrysn authored May 19, 2022
2 parents 158203f + 7a94b36 commit bb56b34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sys/include/phydat.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ void phydat_fit(phydat_t *dat, const int32_t *values, unsigned int dim);
* for @ref UNIT_NONE.
*
* @param[in] data data to encode
* @param[in] dim dimensions used in @p data, MUST be > 0 and < PHYDAT_DIM
* @param[in] dim dimensions used in @p data, MUST be > 0 and <= PHYDAT_DIM
* @param[out] buf target buffer for the JSON string, or NULL
*
* @pre @p dim > 0
* @pre @p dim < PHYDAT_DIM
* @pre @p dim <= PHYDAT_DIM
*
* @return number of bytes (potentially) written to @p buf, including `\0`
* terminator
Expand Down
2 changes: 1 addition & 1 deletion sys/phydat/phydat_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static size_t _bool_to_str(int16_t val, char *buf)

size_t phydat_to_json(const phydat_t *data, size_t dim, char *buf)
{
assert((dim > 0) && (dim < PHYDAT_DIM));
assert((dim > 0) && (dim <= PHYDAT_DIM));

size_t pos = 0;

Expand Down

0 comments on commit bb56b34

Please sign in to comment.