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

refactor(1089): update index types from int to size_t #1090

Merged
merged 1 commit into from
Dec 4, 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
4 changes: 2 additions & 2 deletions bindings/c/cross.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ size_t manifold_cross_section_vec_length(ManifoldCrossSectionVec *csv) {
}

ManifoldCrossSection *manifold_cross_section_vec_get(
void *mem, ManifoldCrossSectionVec *csv, int idx) {
void *mem, ManifoldCrossSectionVec *csv, size_t idx) {
auto cs = (*from_c(csv))[idx];
return to_c(new (mem) CrossSection(cs));
}

void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, int idx,
void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, size_t idx,
ManifoldCrossSection *cs) {
(*from_c(csv))[idx] = *from_c(cs);
}
Expand Down
18 changes: 9 additions & 9 deletions bindings/c/include/manifold/manifoldc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ ManifoldPolygons *manifold_polygons(void *mem, ManifoldSimplePolygon **ps,
size_t length);
size_t manifold_simple_polygon_length(ManifoldSimplePolygon *p);
size_t manifold_polygons_length(ManifoldPolygons *ps);
size_t manifold_polygons_simple_length(ManifoldPolygons *ps, int idx);
size_t manifold_polygons_simple_length(ManifoldPolygons *ps, size_t idx);
ManifoldVec2 manifold_simple_polygon_get_point(ManifoldSimplePolygon *p,
int idx);
size_t idx);
ManifoldSimplePolygon *manifold_polygons_get_simple(void *mem,
ManifoldPolygons *ps,
int idx);
ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, int simple_idx,
int pt_idx);
size_t idx);
ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps,
size_t simple_idx, size_t pt_idx);

// Mesh Construction

Expand Down Expand Up @@ -88,8 +88,8 @@ ManifoldManifoldVec *manifold_manifold_vec(void *mem, size_t sz);
void manifold_manifold_vec_reserve(ManifoldManifoldVec *ms, size_t sz);
size_t manifold_manifold_vec_length(ManifoldManifoldVec *ms);
ManifoldManifold *manifold_manifold_vec_get(void *mem, ManifoldManifoldVec *ms,
int idx);
void manifold_manifold_vec_set(ManifoldManifoldVec *ms, int idx,
size_t idx);
void manifold_manifold_vec_set(ManifoldManifoldVec *ms, size_t idx,
ManifoldManifold *m);
void manifold_manifold_vec_push_back(ManifoldManifoldVec *ms,
ManifoldManifold *m);
Expand Down Expand Up @@ -243,8 +243,8 @@ void manifold_cross_section_vec_reserve(ManifoldCrossSectionVec *csv,
size_t sz);
size_t manifold_cross_section_vec_length(ManifoldCrossSectionVec *csv);
ManifoldCrossSection *manifold_cross_section_vec_get(
void *mem, ManifoldCrossSectionVec *csv, int idx);
void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, int idx,
void *mem, ManifoldCrossSectionVec *csv, size_t idx);
void manifold_cross_section_vec_set(ManifoldCrossSectionVec *csv, size_t idx,
ManifoldCrossSection *cs);
void manifold_cross_section_vec_push_back(ManifoldCrossSectionVec *csv,
ManifoldCrossSection *cs);
Expand Down
14 changes: 7 additions & 7 deletions bindings/c/manifoldc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,24 @@ size_t manifold_polygons_length(ManifoldPolygons *ps) {
return from_c(ps)->size();
}

size_t manifold_polygons_simple_length(ManifoldPolygons *ps, int idx) {
size_t manifold_polygons_simple_length(ManifoldPolygons *ps, size_t idx) {
return (*from_c(ps))[idx].size();
}

ManifoldVec2 manifold_simple_polygon_get_point(ManifoldSimplePolygon *p,
int idx) {
size_t idx) {
return to_c((*from_c(p))[idx]);
}

ManifoldSimplePolygon *manifold_polygons_get_simple(void *mem,
ManifoldPolygons *ps,
int idx) {
size_t idx) {
auto sp = (*from_c(ps))[idx];
return to_c(new (mem) SimplePolygon(sp));
}

ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps, int simple_idx,
int pt_idx) {
ManifoldVec2 manifold_polygons_get_point(ManifoldPolygons *ps,
size_t simple_idx, size_t pt_idx) {
return to_c((*from_c(ps))[simple_idx][pt_idx]);
}

Expand All @@ -111,12 +111,12 @@ size_t manifold_manifold_vec_length(ManifoldManifoldVec *ms) {
}

ManifoldManifold *manifold_manifold_vec_get(void *mem, ManifoldManifoldVec *ms,
int idx) {
size_t idx) {
auto m = (*from_c(ms))[idx];
return to_c(new (mem) Manifold(m));
}

void manifold_manifold_vec_set(ManifoldManifoldVec *ms, int idx,
void manifold_manifold_vec_set(ManifoldManifoldVec *ms, size_t idx,
ManifoldManifold *m) {
(*from_c(ms))[idx] = *from_c(m);
}
Expand Down
Loading