@@ -347,8 +347,8 @@ _strptime(pTHX_ const char *buf, const char *fmt, struct tm *tm, int *got_GMT)
347347{
348348 char c ;
349349 const char * ptr ;
350- int i ,
351- len ;
350+ int i ;
351+ size_t len ;
352352 int Ealternative , Oalternative ;
353353
354354 /* There seems to be a slightly improved version at
@@ -811,12 +811,12 @@ label:
811811 for (cp = buf ; * cp && isupper ((unsigned char )* cp ); ++ cp )
812812 {/*empty*/ }
813813 if (cp - buf ) {
814- zonestr = (char * )malloc (cp - buf + 1 );
814+ zonestr = (char * )malloc (( size_t ) ( cp - buf + 1 ) );
815815 if (!zonestr ) {
816816 errno = ENOMEM ;
817817 return 0 ;
818818 }
819- strncpy (zonestr , buf , cp - buf );
819+ strncpy (zonestr , buf ,( size_t ) ( cp - buf ) );
820820 zonestr [cp - buf ] = '\0' ;
821821 my_tzset (aTHX );
822822 if (0 == strcmp (zonestr , "GMT" )) {
@@ -921,9 +921,9 @@ return_11part_tm(pTHX_ SV ** SP, struct tm *mytm)
921921
922922static void _populate_C_time_locale (pTHX_ HV * locales )
923923{
924- AV * alt_names = (AV * ) SvRV ( * hv_fetch (locales , "alt_month" , strlen ( "alt_month" ) , 0 ) );
925- AV * long_names = (AV * ) SvRV ( * hv_fetch (locales , "month" , strlen ( "month" ) , 0 ) );
926- AV * short_names = (AV * ) SvRV ( * hv_fetch (locales , "mon" , strlen ( "mon" ) , 0 ) );
924+ AV * alt_names = (AV * ) SvRV ( * hv_fetch (locales , "alt_month" , 9 , 0 ) );
925+ AV * long_names = (AV * ) SvRV ( * hv_fetch (locales , "month" , 5 , 0 ) );
926+ AV * short_names = (AV * ) SvRV ( * hv_fetch (locales , "mon" , 3 , 0 ) );
927927 int i ;
928928
929929 for (i = 0 ; i < 1 + (int ) av_len ( long_names ); i ++ ) {
@@ -932,18 +932,18 @@ static void _populate_C_time_locale(pTHX_ HV* locales )
932932 Locale -> mon [i ] = SvPV_nolen ( (SV * ) * av_fetch (short_names , i , 0 ) );
933933 }
934934
935- long_names = (AV * ) SvRV ( * hv_fetch (locales , "weekday" , strlen ( "weekday" ) , 0 ) );
936- short_names = (AV * ) SvRV ( * hv_fetch (locales , "wday" , strlen ( "wday" ) , 0 ) );
935+ long_names = (AV * ) SvRV ( * hv_fetch (locales , "weekday" , 7 , 0 ) );
936+ short_names = (AV * ) SvRV ( * hv_fetch (locales , "wday" , 4 , 0 ) );
937937
938938 for (i = 0 ; i < 1 + (int ) av_len ( long_names ); i ++ ) {
939939 Locale -> wday [i ] = SvPV_nolen ( (SV * ) * av_fetch (short_names , i , 0 ) );
940940 Locale -> weekday [i ] = SvPV_nolen ( (SV * ) * av_fetch (long_names , i , 0 ) );
941941 }
942942
943- Locale -> am = SvPV_nolen ( (SV * ) * hv_fetch (locales , "am" , strlen ( "am" ) , 0 ) );
944- Locale -> pm = SvPV_nolen ( (SV * ) * hv_fetch (locales , "pm" , strlen ( "pm" ) , 0 ) );
945- Locale -> AM = SvPV_nolen ( (SV * ) * hv_fetch (locales , "AM" , strlen ( "AM" ) , 0 ) );
946- Locale -> PM = SvPV_nolen ( (SV * ) * hv_fetch (locales , "PM" , strlen ( "PM" ) , 0 ) );
943+ Locale -> am = SvPV_nolen ( (SV * ) * hv_fetch (locales , "am" , 2 , 0 ) );
944+ Locale -> pm = SvPV_nolen ( (SV * ) * hv_fetch (locales , "pm" , 2 , 0 ) );
945+ Locale -> AM = SvPV_nolen ( (SV * ) * hv_fetch (locales , "AM" , 2 , 0 ) );
946+ Locale -> PM = SvPV_nolen ( (SV * ) * hv_fetch (locales , "PM" , 2 , 0 ) );
947947
948948 return ;
949949}
@@ -987,10 +987,10 @@ _strftime(fmt, epoch, islocal = 1)
987987 ST (0 ) = sv_2mortal (newSVpv (tmpbuf , len ));
988988 else {
989989 /* Possibly buf overflowed - try again with a bigger buf */
990- int fmtlen = strlen (fmt );
991- int bufsize = fmtlen + TP_BUF_SIZE ;
990+ size_t fmtlen = strlen (fmt );
991+ size_t bufsize = fmtlen + TP_BUF_SIZE ;
992992 char * buf ;
993- int buflen ;
993+ size_t buflen ;
994994
995995 New (0 , buf , bufsize , char );
996996 while (buf ) {
@@ -1145,17 +1145,17 @@ _get_localization()
11451145 ++ mytm .tm_mon ;
11461146 }
11471147
1148- tmp = hv_store (locales , "wday" , strlen ( "wday" ) , newRV_noinc ((SV * ) wdays ), 0 );
1149- tmp = hv_store (locales , "weekday" , strlen ( "weekday" ) , newRV_noinc ((SV * ) weekdays ), 0 );
1150- tmp = hv_store (locales , "mon" , strlen ( "mon" ) , newRV_noinc ((SV * ) mons ), 0 );
1151- tmp = hv_store (locales , "month" , strlen ( "month" ) , newRV_noinc ((SV * ) months ), 0 );
1152- tmp = hv_store (locales , "alt_month" , strlen ( "alt_month" ) , newRV ((SV * ) months ), 0 );
1148+ tmp = hv_store (locales , "wday" , 4 , newRV_noinc ((SV * ) wdays ), 0 );
1149+ tmp = hv_store (locales , "weekday" , 7 , newRV_noinc ((SV * ) weekdays ), 0 );
1150+ tmp = hv_store (locales , "mon" , 3 , newRV_noinc ((SV * ) mons ), 0 );
1151+ tmp = hv_store (locales , "month" , 5 , newRV_noinc ((SV * ) months ), 0 );
1152+ tmp = hv_store (locales , "alt_month" , 9 , newRV ((SV * ) months ), 0 );
11531153
11541154 len = strftime (buf , TP_BUF_SIZE , "%p" , & mytm );
1155- tmp = hv_store (locales , "AM" , strlen ( "AM" ) , newSVpvn (buf ,len ), 0 );
1155+ tmp = hv_store (locales , "AM" , 2 , newSVpvn (buf ,len ), 0 );
11561156 mytm .tm_hour = 18 ;
11571157 len = strftime (buf , TP_BUF_SIZE , "%p" , & mytm );
1158- tmp = hv_store (locales , "PM" , strlen ( "PM" ) , newSVpvn (buf ,len ), 0 );
1158+ tmp = hv_store (locales , "PM" , 2 , newSVpvn (buf ,len ), 0 );
11591159
11601160 if (tmp == NULL || !SvOK ( (SV * ) * tmp )){
11611161 croak ("Failed to get localization." );
0 commit comments