Skip to content

Commit

Permalink
chore: small fixes in argument printing
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Apr 30, 2024
1 parent 1f93d3b commit 92eec58
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/colony_npapi/plugin/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,14 @@ NPError nevv(NPMIMEType plugin_type, NPP instance, uint16_t mode, int16_t argc,

#ifdef COLONY_PLATFORM_MACOSX
NPBool has_cg = false;
if (npnfuncs->getvalue(instance, NPNVsupportsCoreGraphicsBool, &has_cg) == NPERR_NO_ERROR && has_cg) {
if(npnfuncs->getvalue(instance, NPNVsupportsCoreGraphicsBool, &has_cg) == NPERR_NO_ERROR && has_cg) {
npnfuncs->setvalue(instance, NPPVpluginDrawingModel, (void *) NPDrawingModelCoreGraphics);
} else {
return NPERR_INCOMPATIBLE_VERSION_ERROR;
}

NPBool has_cocoa = false;
if (npnfuncs->getvalue(instance, NPNVsupportsCocoaBool, &has_cocoa) == NPERR_NO_ERROR && has_cocoa) {
if(npnfuncs->getvalue(instance, NPNVsupportsCocoaBool, &has_cocoa) == NPERR_NO_ERROR && has_cocoa) {
npnfuncs->setvalue(instance, NPPVpluginEventModel, (void *) NPEventModelCocoa);
} else {
return NPERR_INCOMPATIBLE_VERSION_ERROR;
Expand Down
11 changes: 6 additions & 5 deletions src/colony_npapi/plugin/python.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ static PyObject *print_printer_base64(PyObject *self, PyObject *args, PyObject *
char *printer;
char *input;
PyObject *value;
PyObject *options;
size_t data_length;
PyObject *options = NULL;
struct job_t job = {NULL, 0};
static char *kwlist[] = {"options", NULL};
static char *kwlist[] = {"printer", "data", "options", NULL};

/* tries to parse the provided sequence of arguments
as a single string value that is going to be used as
Expand All @@ -215,6 +215,7 @@ static PyObject *print_printer_base64(PyObject *self, PyObject *args, PyObject *
args,
kwargs,
"ss|O!",
kwlist,
&printer,
&input,
&PyDict_Type,
Expand All @@ -225,9 +226,9 @@ static PyObject *print_printer_base64(PyObject *self, PyObject *args, PyObject *

// in case options were set then we can build the job
// options to be used in the print operation
if (options != NULL) {
if(options != NULL) {
value = PyDict_GetItemString(options, "output_path");
if (value != NULL) {
if(value != NULL) {
#if PY_MAJOR_VERSION >= 3
job.output_path = (char *) PyUnicode_AsUTF8(value);
#else
Expand Down Expand Up @@ -261,7 +262,7 @@ static PyMethodDef colony_functions[] = {
{"print_devices", print_devices, METH_NOARGS, "Prints the complete set of devices to stdout."},
{"print_hello", print_hello, METH_NOARGS, "Prints an hello message to default printer."},
{"print_base64", print_base64, METH_VARARGS, "Prints a Base64 based sequence of data to default printer."},
{"print_printer_base64", (PyCFunction) print_printer_base64, METH_VARARGS | METH_KEYWORDS, "Prints a Base64 based sequence of data in a specific printer."},
{"print_printer_base64", (PyCFunction) print_printer_base64, METH_VARARGS | METH_KEYWORDS, "Prints a Base64 based sequence of data in a specific printer with optional options."},
{NULL, NULL, 0, NULL}
};

Expand Down
6 changes: 5 additions & 1 deletion src/colony_npapi/print/print_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ int print_printer(
DOCINFO document_information;
document_information.cbSize = sizeof(DOCINFO);
document_information.lpszDocName = document_header->title;
document_information.lpszOutput = NULL;
if(config == NULL || config->output_path == NULL) {
document_information.lpszOutput = NULL;
} else {
document_information.lpszOutput = config->output_path;
}
document_information.fwType = 0;

/* builds the document information and prints
Expand Down

0 comments on commit 92eec58

Please sign in to comment.