소스 검색

Warning in loslib.c (signed-unsigned comparison)

Roberto Ierusalimschy 1 개월 전
부모
커밋
cfce6f4b20
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      loslib.c

+ 3 - 2
loslib.c

@@ -273,7 +273,7 @@ static int getfield (lua_State *L, const char *key, int d, int delta) {
 
 
 
 
 static const char *checkoption (lua_State *L, const char *conv,
 static const char *checkoption (lua_State *L, const char *conv,
-                                ptrdiff_t convlen, char *buff) {
+                                size_t convlen, char *buff) {
   const char *option = LUA_STRFTIMEOPTIONS;
   const char *option = LUA_STRFTIMEOPTIONS;
   unsigned oplen = 1;  /* length of options being checked */
   unsigned oplen = 1;  /* length of options being checked */
   for (; *option != '\0' && oplen <= convlen; option += oplen) {
   for (; *option != '\0' && oplen <= convlen; option += oplen) {
@@ -333,7 +333,8 @@ static int os_date (lua_State *L) {
         size_t reslen;
         size_t reslen;
         char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT);
         char *buff = luaL_prepbuffsize(&b, SIZETIMEFMT);
         s++;  /* skip '%' */
         s++;  /* skip '%' */
-        s = checkoption(L, s, se - s, cc + 1);  /* copy specifier to 'cc' */
+        /* copy specifier to 'cc' */
+        s = checkoption(L, s, ct_diff2sz(se - s), cc + 1);
         reslen = strftime(buff, SIZETIMEFMT, cc, stm);
         reslen = strftime(buff, SIZETIMEFMT, cc, stm);
         luaL_addsize(&b, reslen);
         luaL_addsize(&b, reslen);
       }
       }