Skip to content

Commit

Permalink
Enable curves everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jddurand authored and jaromil committed Dec 28, 2022
1 parent 0e9ba7a commit 04ac1c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.0)
cmake_minimum_required (VERSION 3.1)

list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

Expand Down
11 changes: 1 addition & 10 deletions src/filter/curves/CMakeLists.txt
@@ -1,12 +1,3 @@
if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES Clang)
return() # MSVC cl doesn't support Variable Length Arrays (VLA), but clang-cl does
endif()

# Set C99 flag for gcc
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "-std=c99")
endif (CMAKE_COMPILER_IS_GNUCC)

set (SOURCES curves.c)
set (TARGET curves)

Expand All @@ -15,6 +6,6 @@ if (MSVC)
endif (MSVC)

add_library (${TARGET} MODULE ${SOURCES})
set_target_properties (${TARGET} PROPERTIES PREFIX "")
set_target_properties (${TARGET} PROPERTIES PREFIX "" C_STANDARD 99)

install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
8 changes: 6 additions & 2 deletions src/filter/curves/curves.c
Expand Up @@ -608,7 +608,7 @@ void updateBsplineMap(f0r_instance_t instance)
char **pointStr = calloc(1, sizeof(char *));
int count = tokenise(inst->bspline, "|", &pointStr);

bspline_point points[count];
bspline_point *points = (bspline_point *) malloc(count * sizeof(bspline_point));

for (int i = 0; i < count; ++i) {
char **positionsStr = calloc(1, sizeof(char *));
Expand Down Expand Up @@ -666,7 +666,7 @@ void updateBsplineMap(f0r_instance_t instance)
c = 1;
}
step = 1 / (double)c;
position curve[c];
position *curve = (position *) malloc(c * sizeof(position));
while (t <= 1) {
curve[pn++] = pointOnBezier(t, p);
t += step;
Expand Down Expand Up @@ -697,7 +697,11 @@ void updateBsplineMap(f0r_instance_t instance)
else
inst->bsplineMap[j] = CLAMP0255(ROUND(y * 255));
}

free(curve);
}

free(points);
}

/**
Expand Down

0 comments on commit 04ac1c5

Please sign in to comment.