This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git


The following commit(s) were added to refs/heads/main by this push:
     new 4a8a0b0  chore: replace C-style cast with static_cast in 
String::substr (#386)
4a8a0b0 is described below

commit 4a8a0b01f45f726147cbf75742d6b772eceab369
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Wed Jan 7 10:28:42 2026 +0800

    chore: replace C-style cast with static_cast in String::substr (#386)
    
    ## Related
    
    
    https://github.com/apache/tvm-ffi/actions/runs/20755375337/job/59595882892
    
    ## Why
    
    clang-tidy fails with google-readability-casting error due to C-style
    cast in default parameter.
    
    ## How
    
    Replace size_t(-1) with `nops` in String::substr method
---
 include/tvm/ffi/string.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/tvm/ffi/string.h b/include/tvm/ffi/string.h
index b93c3a9..59addfa 100644
--- a/include/tvm/ffi/string.h
+++ b/include/tvm/ffi/string.h
@@ -647,7 +647,7 @@ class String {
    * \param count The length of the substring (default: until end of string)
    * \return A string containing the substring
    */
-  String substr(size_t pos = 0, size_t count = size_t(-1)) const {
+  String substr(size_t pos = 0, size_t count = npos) const {
     if (pos > size()) {
       throw std::out_of_range("tvm::String substr index out of bounds");
     }

Reply via email to