@@ -139,7 +139,7 @@ static const int monthdays_leap[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30,
139139#define VALIDSEC (sec ) (sec >= 0 && sec <= 60)
140140
141141/* Check that a nanosecond is in a valid range */
142- #define VALIDNANOSEC (nanosec ) (nanosec >= 0 && nanosec <= 999999999)
142+ #define VALIDNANOSEC (nanosec ) (nanosec <= 999999999)
143143
144144/** @endcond */
145145
314314ms_nslc2sid (char * sid , int sidlen , uint16_t flags ,
315315 const char * net , const char * sta , const char * loc , const char * chan )
316316{
317+ (void )flags ; /* Unused */
317318 char * sptr = sid ;
318319 char xchan [6 ] = {0 };
319320 int needed = 0 ;
@@ -411,7 +412,7 @@ ms_nslc2sid (char *sid, int sidlen, uint16_t flags,
411412 return -1 ;
412413 }
413414
414- return (sptr - sid );
415+ return (int )( sptr - sid );
415416} /* End of ms_nslc2sid() */
416417
417418/**********************************************************************/ /**
@@ -1344,7 +1345,7 @@ ms_timestr2nstime (const char *timestr)
13441345 }
13451346 }
13461347
1347- length = cp - timestr ;
1348+ length = ( int )( cp - timestr ) ;
13481349
13491350 /* If the time string is all number-like characters assume it is an epoch time.
13501351 * Unless it is 4 characters, which could be a year, unless it starts with a sign. */
@@ -1431,15 +1432,15 @@ nstime_t
14311432ms_mdtimestr2nstime (const char * timestr )
14321433{
14331434 int fields ;
1434- int year = 0 ;
1435- int mon = 1 ;
1436- int mday = 1 ;
1437- int yday = 1 ;
1438- int hour = 0 ;
1439- int min = 0 ;
1440- int sec = 0 ;
1441- double fsec = 0.0 ;
1442- int nsec = 0 ;
1435+ int year = 0 ;
1436+ int mon = 1 ;
1437+ int mday = 1 ;
1438+ int yday = 1 ;
1439+ int hour = 0 ;
1440+ int min = 0 ;
1441+ int sec = 0 ;
1442+ double fsec = 0.0 ;
1443+ uint32_t nsec = 0 ;
14431444
14441445 if (!timestr )
14451446 {
@@ -1453,7 +1454,7 @@ ms_mdtimestr2nstime (const char *timestr)
14531454 /* Convert fractional seconds to nanoseconds */
14541455 if (fsec != 0.0 )
14551456 {
1456- nsec = (int )(fsec * 1000000000.0 + 0.5 );
1457+ nsec = (uint32_t )(fsec * 1000000000.0 + 0.5 );
14571458 }
14581459
14591460 if (fields < 1 )
@@ -1500,7 +1501,7 @@ ms_mdtimestr2nstime (const char *timestr)
15001501
15011502 if (!VALIDNANOSEC (nsec ))
15021503 {
1503- ms_log (2 , "fractional second (%d ) is out of range\n" , nsec );
1504+ ms_log (2 , "fractional second (%u ) is out of range\n" , nsec );
15041505 return NSTERROR ;
15051506 }
15061507
@@ -1539,13 +1540,13 @@ nstime_t
15391540ms_seedtimestr2nstime (const char * seedtimestr )
15401541{
15411542 int fields ;
1542- int year = 0 ;
1543- int yday = 1 ;
1544- int hour = 0 ;
1545- int min = 0 ;
1546- int sec = 0 ;
1547- double fsec = 0.0 ;
1548- int nsec = 0 ;
1543+ int year = 0 ;
1544+ int yday = 1 ;
1545+ int hour = 0 ;
1546+ int min = 0 ;
1547+ int sec = 0 ;
1548+ double fsec = 0.0 ;
1549+ uint32_t nsec = 0 ;
15491550
15501551 if (!seedtimestr )
15511552 {
@@ -1559,7 +1560,7 @@ ms_seedtimestr2nstime (const char *seedtimestr)
15591560 /* Convert fractional seconds to nanoseconds */
15601561 if (fsec != 0.0 )
15611562 {
1562- nsec = (int )(fsec * 1000000000.0 + 0.5 );
1563+ nsec = (uint32_t )(fsec * 1000000000.0 + 0.5 );
15631564 }
15641565
15651566 if (fields < 1 )
@@ -1600,7 +1601,7 @@ ms_seedtimestr2nstime (const char *seedtimestr)
16001601
16011602 if (!VALIDNANOSEC (nsec ))
16021603 {
1603- ms_log (2 , "fractional second (%d ) is out of range\n" , nsec );
1604+ ms_log (2 , "fractional second (%u ) is out of range\n" , nsec );
16041605 return NSTERROR ;
16051606 }
16061607
0 commit comments