General: Add many small fixes
This commit is contained in:
parent
417f9fcbf2
commit
17a621b787
|
@ -15,12 +15,14 @@ The following is a list of dependencies that your system needs in order to be ab
|
|||
- [The Ncurses library](https://invisible-island.net/ncurses/announce.html)
|
||||
- [Moreutils](https://joeyh.name/code/moreutils/)
|
||||
|
||||
# Building
|
||||
# Building & Installation
|
||||
|
||||
To build Vis, simply clone this repository and run `mkdir build; cd build; cmake ..; make`
|
||||
To build vis, simply clone this repository and run `mkdir build; cd build; cmake ..; make`
|
||||
|
||||
Resulting binary will be generated inside the `/build/src/` folder called.
|
||||
|
||||
For installation, you can run `sudo make install` (from the /build directory)
|
||||
|
||||
# Usage
|
||||
|
||||
To start Vis simply run the `vis` binary in your terminal alongside the name of the calendar file.
|
||||
|
|
|
@ -286,7 +286,12 @@ calendar_information Engine::parse_date(std::string date) {
|
|||
std::vector<int> tokens;
|
||||
|
||||
while (token != NULL) {
|
||||
tokens.push_back(std::stoi(token));
|
||||
try {
|
||||
tokens.push_back(std::stoi(token));
|
||||
} catch (...) {
|
||||
std::cout << "Error parsing calendar file. Suspected incorrect format." << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
token = strtok(NULL, ".");
|
||||
}
|
||||
|
||||
|
@ -314,6 +319,7 @@ void Engine::parse_line(std::string line) {
|
|||
Base64decode(event_decoded, tokens[1].c_str());
|
||||
|
||||
this->events_map[event_date] = event_decoded;
|
||||
free(event_decoded);
|
||||
}
|
||||
|
||||
void Engine::open_calendar(char *filename) {
|
||||
|
@ -326,9 +332,9 @@ void Engine::open_calendar(char *filename) {
|
|||
return;
|
||||
|
||||
std::string line;
|
||||
while (std::getline(this->calendar_file, line)) {
|
||||
while (std::getline(this->calendar_file, line))
|
||||
this->parse_line(line);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Engine::write_calendar() {
|
||||
|
@ -357,6 +363,7 @@ bool Engine::write_calendar() {
|
|||
output_line << event_encoded;
|
||||
|
||||
this->calendar_file << output_line.str() << std::endl;
|
||||
free(event_encoded);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user