Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve MAC compatibility #236

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ target_link_libraries(wfmash
pthread
libwflign_static
hts
rt
wfa2cpp
jemalloc
z
Expand Down
8 changes: 4 additions & 4 deletions src/common/wflign/deps/atomic_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ color_t layer(const color_t& a, const color_t& b, const double& f) {
//std::cerr << "got a = " << a.hex << " " << (int)a.c.r << "," << (int)a.c.g << "," << (int)a.c.b << std::endl;
//std::cerr << "got b = " << b.hex << " " << (int)b.c.r << "," << (int)b.c.g << "," << (int)b.c.b << std::endl;
//std::cerr << "f = " << f << std::endl;
if (.0d < f) {
if ((double) 0.0 < f) {
out.c = (RGB) { inrange((double)b.c.r - ((double)(255 * (1-f) - a.c.r))),
inrange((double)b.c.g - ((double)(255 * (1-f) - a.c.g))),
inrange((double)b.c.b - ((double)(255 * (1-f) - a.c.b))),
Expand All @@ -88,11 +88,11 @@ color_t mix(const color_t& a, const color_t& b, const double& f) {

double u_ipart(double x) { return std::floor(x); }

double u_round(double x) { return u_ipart(x + 0.5d); }
double u_round(double x) { return u_ipart(x + (double) 0.5); }

double u_fpart(double x) { return x - std::floor(x); }

double u_rfpart(double x) { return 1.0d - u_fpart(x); }
double u_rfpart(double x) { return (double) 1.0 - u_fpart(x); }

void wu_draw_line(const bool steep, const double_t gradient, double intery,
const xy_d_t pxl1, const xy_d_t pxl2, const color_t& color,
Expand All @@ -119,7 +119,7 @@ xy_d_t wu_calc_endpoint(xy_d_t xy, const double_t gradient, const bool steep,
const xy_d_t end = {u_round(xy.x),
std::max(0.0, xy.y + gradient * (u_round(xy.x) - xy.x))};
//std::cerr << "end is " << "(" << end.x << "," << end.y << ")" << std::endl;
const double xgap = u_rfpart(xy.x + 0.5d);
const double xgap = u_rfpart(xy.x + (double) 0.5);
const xy_d_t pxl = {end.x, u_ipart(end.y)};
//std::cerr << "pxl is " << "(" << pxl.x << "," << pxl.y << ")" << std::endl;

Expand Down
12 changes: 9 additions & 3 deletions src/interface/parse_args.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <unistd.h>
#include <limits.h>

#include "common/args.hxx"

Expand Down Expand Up @@ -623,9 +624,14 @@ void parse_args(int argc,
if (tmp_base) {
temp_file::set_dir(args::get(tmp_base));
} else {
char* cwd = get_current_dir_name();
temp_file::set_dir(std::string(cwd));
free(cwd);
char cwd[PATH_MAX];
if (getcwd(cwd, sizeof(cwd)) != NULL) {
temp_file::set_dir(std::string(cwd));
} else {
// Handle error: getcwd() failed
std::cerr << "[wfmash] ERROR, skch::parseandSave, problem in getting the current directory." << std::endl;
exit(1);
}
}

if (align_input_paf) {
Expand Down