Skip to content

Commit

Permalink
chore: initial parsing of options values
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Apr 30, 2024
1 parent 38aa208 commit 465292d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/colony_npapi/plugin/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ static PyObject *print_printer_base64(PyObject *self, PyObject *args, PyObject *
char *data;
char *printer;
char *input;
PyObject *options = NULL;
PyObject *value;
PyObject *options;
char *output_path;
size_t data_length;
static char *kwlist[] = {"options", NULL};

Expand All @@ -221,7 +223,18 @@ static PyObject *print_printer_base64(PyObject *self, PyObject *args, PyObject *
return NULL;
}

//@TODO é aqui que tenho de por o optional argument
// in case options were set then we can build the job
// options to be used in the print operation
if (options != NULL) {
PyObject *value = PyDict_GetItemString(options, "output_path");
if (value != NULL) {
#if PY_MAJOR_VERSION >= 3
output_path = PyUnicode_AsUTF8(value);
#else
output_path = PyString_AsString(value);
#endif
}
}

/* decodes the data value from the base 64 encoding
and then uses it to print the data */
Expand Down

0 comments on commit 465292d

Please sign in to comment.