nancy.liao
2025-05-23 8553a8d63f97cfa8d64b5b2260e81f8c896a8398
src/library/base/string_utils.cpp
@@ -13,7 +13,7 @@
#include <algorithm>
#include <stdexcept>
#include <regex>
#include "StringUtils.h"
#include "string_utils.h"
#ifdef _WIN32
#include <time.h>  //mktime under windows
@@ -107,4 +107,17 @@
   return count;
}
size_t mstrlcpy(char *dst, const char *src, size_t n) {
   size_t n_orig = n;
   if (n > 0) {
      char *pd;
      const char *ps;
      for (--n, pd = dst, ps = src; n > 0 && *ps != '\0'; --n, ++pd, ++ps) *pd = *ps;
      *pd = '\0';
   }
   return n_orig - n;
}
} /* namespace license */