updated to the new Pikotools api (new Space struct)

This commit is contained in:
2021-04-09 17:50:58 +02:00
parent 00b980e74b
commit 35e10ed469
52 changed files with 795 additions and 736 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2012-2014, Tomasz Sowa
* Copyright (c) 2012-2021, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -123,37 +123,40 @@ bool TimeZones::Empty() const
void TimeZones::ParseZones()
{
for(size_t i=0 ; i<temp_space.spaces.size() ; ++i)
if( temp_space.child_spaces )
{
PT::Space & zone = *temp_space.spaces[i];
temp_zone.Clear();
if( temp_zone.SetTz(zone) )
for(size_t i=0 ; i<temp_space.child_spaces->size() ; ++i)
{
if( !HasZone(temp_zone.id) )
PT::Space & zone = *((*temp_space.child_spaces)[i]);
temp_zone.Clear();
if( temp_zone.SetTz(zone) )
{
if( temp_zone.id < zone_indices.size() )
if( !HasZone(temp_zone.id) )
{
zone_tab.push_back(temp_zone);
zone_indices[temp_zone.id] = zone_tab.size() - 1;
if( temp_zone.id < zone_indices.size() )
{
zone_tab.push_back(temp_zone);
zone_indices[temp_zone.id] = zone_tab.size() - 1;
}
else
{
log << log1 << "Tz: zone: " << temp_zone.name << " has too big id: "
<< temp_zone.id << " (skipping)" << logend;
}
}
else
{
log << log1 << "Tz: zone: " << temp_zone.name << " has too big id: "
<< temp_zone.id << " (skipping)" << logend;
log << log1 << "Tz: zone with id: " << temp_zone.id
<< " already exists (skipping)" << logend;
}
}
else
{
log << log1 << "Tz: zone with id: " << temp_zone.id
<< " already exists (skipping)" << logend;
log << log1 << "System: problem with reading time zone info from time zone: "
<< zone.name << " (skipping) " << logend;
}
}
else
{
log << log1 << "System: problem with reading time zone info from time zone: "
<< zone.name << " (skipping) " << logend;
}
}
}
@@ -166,9 +169,9 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
{
parser.SetSpace(temp_space);
zone_tab.clear();
temp_space.Clear();
temp_space.clear();
PT::SpaceParser::Status status = parser.Parse(path);
PT::SpaceParser::Status status = parser.ParseSpaceFile(path);
if( status == PT::SpaceParser::ok )
{
@@ -178,7 +181,7 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
else
if( status == PT::SpaceParser::syntax_error )
{
log << log1 << "TZ: error in time zone file, line: " << parser.line << logend;
log << log1 << "TZ: error in time zone file, line: " << parser.get_last_parsed_line() << logend;
}
else
if( status == PT::SpaceParser::cant_open_file )
@@ -186,7 +189,7 @@ bool TimeZones::ReadTimeZones(const wchar_t * path)
log << log1 << "TZ: I cannot open the time zone file: " << path << logend;
}
temp_space.Clear();
temp_space.clear();
return status == PT::SpaceParser::ok;
}