diff options
author | 2016-11-16 10:38:55 -0800 | |
---|---|---|
committer | 2016-11-16 10:46:04 -0800 | |
commit | fd398fdb1a68a823c56836184197fe3aaaf09a5a (patch) | |
tree | 54f27333d19d9393fa7e7a994f68453f50fd68a9 /tensorflow/c/c_api.h | |
parent | df0ba56a87b03d3cdea94ab087c45ca0b9f46116 (diff) |
C API: Comment tweaks and some suggested corner case handling
Change: 139349604
Diffstat (limited to 'tensorflow/c/c_api.h')
-rw-r--r-- | tensorflow/c/c_api.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tensorflow/c/c_api.h b/tensorflow/c/c_api.h index 828ef23ebb..3b969551e4 100644 --- a/tensorflow/c/c_api.h +++ b/tensorflow/c/c_api.h @@ -235,27 +235,28 @@ extern size_t TF_TensorByteSize(const TF_Tensor*); extern void* TF_TensorData(const TF_Tensor*); // -------------------------------------------------------------------------- -// Encode the string "src" ("src_len" bytes long) into "dst" in the format -// required by TF_STRING tensors. Does not write to memory more than "dst_len" -// bytes beyond "*dst". "dst_len" should be at least +// Encode the string `src` (`src_len` bytes long) into `dst` in the format +// required by TF_STRING tensors. Does not write to memory more than `dst_len` +// bytes beyond `*dst`. `dst_len` should be at least // TF_StringEncodedSize(src_len). // // On success returns the size in bytes of the encoded string. +// Returns an error into `status` otherwise. extern size_t TF_StringEncode(const char* src, size_t src_len, char* dst, size_t dst_len, TF_Status* status); // Decode a string encoded using TF_StringEncode. // -// On success, sets "*dst" to the start of the decoded string and "*dst_len" to -// its length. Returns the number of bytes starting at "src" consumed while -// decoding. "*dst" points to memory within the encoded buffer. On failure, -// "*dst" and "*dst_len" are undefined. +// On success, sets `*dst` to the start of the decoded string and `*dst_len` to +// its length. Returns the number of bytes starting at `src` consumed while +// decoding. `*dst` points to memory within the encoded buffer. On failure, +// `*dst` and `*dst_len` are undefined and an error is set in `status`. // -// Does not read memory pointed to by "limit" or beyond. +// Does not read memory more than `src_len` bytes beyond `src`. extern size_t TF_DecodeString(const char* src, size_t src_len, char** dst, size_t* dst_len, TF_Status* status); -// Return the size in bytes required to encode a string "len" bytes long into a +// Return the size in bytes required to encode a string `len` bytes long into a // TF_STRING tensor. extern size_t TF_StringEncodedSize(size_t len); |