Skip to content

Commit

Permalink
Fix bugs. Add suggestions to style guide.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole committed Dec 5, 2024
1 parent 45fd506 commit 192e367
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ The goal of this section is to improve the readability of the code and reduce co
- braces after a function declaration or a control flow statement go on a new line;
- first-level braces at the beginning of a line appear in the first column;
- closing braces appear in the same column as their counterpart.
- spaces...:
- ... around binary operators;
- ... after commas;
- ... before opening parentheses and after closing parentheses.

If you use vim, the default C formatting should be fine (':h C-indenting').

Expand Down
13 changes: 4 additions & 9 deletions src/src/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ int load( char *file)
// getcwd(path, 255);
// getcwd(temp, sizeof(temp)) ? std::string( temp ) : std::string("")

GetCurrentDir( path, 255 );
warning("Current working directory: %s\n", path);
if (GetCurrentDir(path, 255) != NULL) {
warning("Current working directory: %s\n", path);
}
// warning("Current working directory: %s\n", std::filesystem::current_path());
/* error("Can't open \"%s\"", "rate_file");*/
warning("Can not open ratefile: %s", file);
Expand Down Expand Up @@ -410,20 +411,14 @@ int create_output_fn_dir() {
char buffer_sup_fn_dest [1024];
sprintf (buffer_sup_fn_dest, "%s%s", buffer_output_dir, rate_file_name);
FILE *source = fopen(rate_file_name, "rb");
FILE *destination = fopen(buffer_sup_fn_dest, "wb");
// copy the .sup-file (rate_file_name) into the subfolder:
char buffer_sup_fn_dest[1024];
sprintf (buffer_sup_fn_dest, "%s%s", buffer_output_dir, rate_file_base_name);
FILE *source = fopen(rate_file_name, "rb");
if (source == NULL) {
Rprintf("Could not open source (rate) file: %s\n", strerror(errno));
}
FILE *destination = fopen(buffer_sup_fn_dest, "wb");
if (destination == NULL) {
stop("Could not open destination file: %s\n", strerror(errno));
}
>>>>>>> main
char buffer[1024];
char buffer[1024];
size_t bytes_read;
while ((bytes_read = fread(buffer, 1, sizeof(buffer), source)) > 0) {
fwrite(buffer, 1, bytes_read, destination);
Expand Down

0 comments on commit 192e367

Please sign in to comment.