Skip to content

Commit bd328d4

Browse files
committed
address windows-related compilation errors/warnings
1 parent de942cd commit bd328d4

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/python/vector.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ auto register_vector_type(nb::module_ &m, const char *name) {
2323
.def(nb::init<const Array &>())
2424
.def("__init__", [](Array &a, const std::array<Value, Size> &arr) {
2525
new (&a) Array();
26-
for (size_t i = 0; i < Size; ++i)
26+
for (size_t i = 0; i < Array::Size; ++i)
2727
a[i] = arr[i];
2828
})
2929
.def(nb::self == nb::self)
@@ -40,13 +40,13 @@ auto register_vector_type(nb::module_ &m, const char *name) {
4040
.def(nb::self -= nb::self)
4141
.def(nb::self *= nb::self)
4242
.def(nb::self /= nb::self)
43-
.def("__getitem__", [Size](const Array &a, size_t index) -> Value {
44-
if (index >= Size)
43+
.def("__getitem__", [](const Array &a, size_t index) -> Value {
44+
if (index >= Array::Size)
4545
throw nb::index_error();
4646
return a[index];
4747
}, "index"_a)
48-
.def("__setitem__", [Size](Array &a, size_t index, Value value) {
49-
if (index >= Size)
48+
.def("__setitem__", [](Array &a, size_t index, Value value) {
49+
if (index >= Array::Size)
5050
throw nb::index_error();
5151
a[index] = value;
5252
}, "index"_a, "value"_a)
@@ -56,7 +56,7 @@ auto register_vector_type(nb::module_ &m, const char *name) {
5656
[](Array &a, const Value &v) { a.y() = v; })
5757
.def("__dlpack__", [](nb::handle_t<Array> self) {
5858
const Array &a = nb::cast<const Array &>(self);
59-
const size_t shape[1] = { Size };
59+
const size_t shape[1] = { Array::Size };
6060
return nb::tensor<float>((void *) a.data(), 1, shape, self);
6161
})
6262
.def("__repr__", [](const Array &a) {

src/python/widget.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ int widget_tp_traverse_base(PyObject *self, visitproc visit, void *arg, PyTypeOb
3131
continue;
3232

3333
PyObject *args[] = { self };
34-
PyObject *value = PyObject_VectorcallMethod(
34+
PyObject *result = PyObject_VectorcallMethod(
3535
key, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, nullptr);
3636

37-
if (!value) {
37+
if (!result) {
3838
PyErr_Clear();
3939
continue;
4040
}
4141

42-
Py_VISIT(value);
43-
Py_DECREF(value);
42+
Py_VISIT(result);
43+
Py_DECREF(result);
4444
}
4545

4646
if (strcmp(tp->tp_name, "nanogui.Widget") != 0) {
@@ -73,8 +73,8 @@ int widget_tp_traverse(PyObject *self, visitproc visit, void *arg) {
7373
int widget_tp_clear(PyObject *self) {
7474
Widget *w = nb::inst_ptr<Widget>(self);
7575

76-
size_t count = w->child_count();
77-
for (size_t i = 0; i < count; ++i)
76+
int count = w->child_count();
77+
for (int i = 0; i < count; ++i)
7878
w->remove_child_at(count - 1 - i);
7979

8080
return 0;

0 commit comments

Comments
 (0)