Skip to content

Commit

Permalink
Fix JSON output from ipptool.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jan 11, 2024
1 parent 0eb74c0 commit 753ce8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ libcups v3.0rc1 (TBD)
- Now use NotoSansMono font for `ipptransform` text conversions.
- The `ipptransform` program now supports uncollated copies.
- Fixed PCL output from `ipptransform` (Issue #72)
- Fixed JSON output from `ipptool`.


libcups v3.0b2 (October 5, 2023)
Expand Down
8 changes: 4 additions & 4 deletions tools/ipptool.c
Original file line number Diff line number Diff line change
Expand Up @@ -4575,7 +4575,7 @@ print_json_attr(
{
int upper, lower = ippGetRange(attr, 0, &upper);

cupsFilePrintf(data->outfile, ": {\n%*s\"lower\": %d,\n%*s\"upper\":%d\n%*s}", indent + 4, "", lower, indent + 4, "", upper, indent, "");
cupsFilePrintf(data->outfile, ": {\n%*s\"lower\": %d,\n%*s\"upper\": %d\n%*s}", indent + 4, "", lower, indent + 4, "", upper, indent, "");
}
else
{
Expand All @@ -4584,7 +4584,7 @@ print_json_attr(
{
int upper, lower = ippGetRange(attr, i, &upper);

cupsFilePrintf(data->outfile, "%*s{\n%*s\"lower\": %d,\n%*s\"upper\":%d\n%*s},\n", indent + 4, "", indent + 8, "", lower, indent + 8, "", upper, indent + 4, "");
cupsFilePrintf(data->outfile, "%*s{\n%*s\"lower\": %d,\n%*s\"upper\": %d\n%*s},\n", indent + 4, "", indent + 8, "", lower, indent + 8, "", upper, indent + 4, "");
}
cupsFilePrintf(data->outfile, "%*s]", indent, "");
}
Expand All @@ -4596,7 +4596,7 @@ print_json_attr(
ipp_res_t units;
int yres, xres = ippGetResolution(attr, 0, &yres, &units);

cupsFilePrintf(data->outfile, ": {\n%*s\"units\": \"%s\",\n%*s\"xres\": %d,\n%*s\"yres\":%d\n%*s}", indent + 4, "", units == IPP_RES_PER_INCH ? "dpi" : "dpcm", indent + 4, "", xres, indent + 4, "", yres, indent, "");
cupsFilePrintf(data->outfile, ": {\n%*s\"units\": \"%s\",\n%*s\"xres\": %d,\n%*s\"yres\": %d\n%*s}", indent + 4, "", units == IPP_RES_PER_INCH ? "dpi" : "dpcm", indent + 4, "", xres, indent + 4, "", yres, indent, "");
}
else
{
Expand All @@ -4606,7 +4606,7 @@ print_json_attr(
ipp_res_t units;
int yres, xres = ippGetResolution(attr, i, &yres, &units);

cupsFilePrintf(data->outfile, "%*s{\n%*s\"units\": \"%s\",\n%*s\"xres\": %d,\n%*s\"yres\":%d\n%*s},\n", indent + 4, "", indent + 8, "", units == IPP_RES_PER_INCH ? "dpi" : "dpcm", indent + 8, "", xres, indent + 8, "", yres, indent + 4, "");
cupsFilePrintf(data->outfile, "%*s{\n%*s\"units\": \"%s\",\n%*s\"xres\": %d,\n%*s\"yres\": %d\n%*s}%s", indent + 4, "", indent + 8, "", units == IPP_RES_PER_INCH ? "dpi" : "dpcm", indent + 8, "", xres, indent + 8, "", yres, indent + 4, "", (i + 1) < count ? ",\n" : "\n");
}
cupsFilePrintf(data->outfile, "%*s]", indent, "");
}
Expand Down

0 comments on commit 753ce8c

Please sign in to comment.