Skip to content

Commit c709753

Browse files
Merge pull request #3090 from w0lek/hotfix-winbuild
set of windows (mingw64) build fixes
2 parents 8446653 + 452611a commit c709753

File tree

2 files changed

+4
-64
lines changed

2 files changed

+4
-64
lines changed

libs/libvtrutil/src/vtr_util.cpp

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -375,67 +375,6 @@ char* fgets(char* buf, int max_size, FILE* fp) {
375375
return nullptr;
376376
}
377377

378-
/**
379-
* @brief to get an arbitrary long input line and cut off any
380-
* comment part
381-
*
382-
* the getline function is exaly like the __get_delim function
383-
* in GNU with '\n' delimiter. As a result, to make the function
384-
* behaviour identical for Windows (\r\n) and Linux (\n) compiler
385-
* macros for checking operating systems have been used.
386-
*
387-
* @note user need to take care of the given pointer,
388-
* which will be dynamically allocated by getdelim
389-
*/
390-
char* getline(char*& _lineptr, FILE* _stream) {
391-
int i;
392-
int ch;
393-
size_t _n = 0;
394-
ssize_t nread;
395-
396-
#if defined(__unix__)
397-
nread = getdelim(&_lineptr, &_n, '\n', _stream);
398-
#elif defined(_WIN32)
399-
#define __WIN_NLTK "\r\n"
400-
nread = getdelim(&_lineptr, &_n, __WIN_NLTK, _stream);
401-
#endif
402-
403-
if (nread == -1) {
404-
int errsv = errno;
405-
std::string error_msg;
406-
407-
if (errsv == EINVAL)
408-
error_msg = string_fmt("[%s] Bad arguments (_lineptr is NULL, or _stream is not valid).", strerror(errsv));
409-
else if (errsv == ENOMEM)
410-
error_msg = string_fmt("[%s] Allocation or reallocation of the line buffer failed.", strerror(errsv));
411-
else
412-
/* end of file so it will return null */
413-
return nullptr;
414-
415-
/* getline was unsuccessful, so error */
416-
throw VtrError(string_fmt("Error -- %s\n",
417-
error_msg.c_str()),
418-
__FILE__, __LINE__);
419-
return nullptr;
420-
}
421-
422-
cont = 0; /* line continued? */
423-
file_line_number++; /* global variable */
424-
425-
for (i = 0; i < nread; i++) { /* Keep going until the line finishes */
426-
427-
ch = _lineptr[i];
428-
429-
if (ch == '#') { /* comment */
430-
_lineptr[i] = '\0';
431-
/* skip the rest of the line */
432-
break;
433-
}
434-
}
435-
436-
return (_lineptr);
437-
}
438-
439378
///@brief Returns line number of last opened and read file
440379
int get_file_line_number_of_last_opened_file() {
441380
return file_line_number;

vpr/src/draw/draw_basic.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#ifndef NO_GRAPHICS
55

66
#include <cstdio>
7+
#include <numbers>
78
#include <cmath>
89
#include <algorithm>
910
#include <sstream>
@@ -1236,7 +1237,7 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr
12361237
std::string incr_delay_str = ss.str();
12371238

12381239
// Get the angle of line, to rotate the text
1239-
float text_angle = (180 / M_PI)
1240+
float text_angle = (180 / std::numbers::pi)
12401241
* atan((end.y - start.y) / (end.x - start.x));
12411242

12421243
// Get the screen coordinates for text drawing
@@ -1251,9 +1252,9 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr
12511252

12521253
// Find an offset so it is sitting on top/below of the line
12531254
float x_offset = screen_coords.center().x
1254-
- 8 * sin(text_angle * (M_PI / 180));
1255+
- 8 * sin(text_angle * (std::numbers::pi / 180));
12551256
float y_offset = screen_coords.center().y
1256-
- 8 * cos(text_angle * (M_PI / 180));
1257+
- 8 * cos(text_angle * (std::numbers::pi / 180));
12571258

12581259
ezgl::point2d offset_text_bbox(x_offset, y_offset);
12591260
g->draw_text(offset_text_bbox, incr_delay_str.c_str(),

0 commit comments

Comments
 (0)