Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save GamesTrap/cf643445b3e7c64164262bc251665e38 to your computer and use it in GitHub Desktop.
Save GamesTrap/cf643445b3e7c64164262bc251665e38 to your computer and use it in GitHub Desktop.
Additional fixes for the AUR cnijfilter-mg3100 package to compile with gcc 14.1.1
--- cnijfilter-source-3.60-1/cngpij/cngpij/bjcups.c
+++ cnijfilter-source-3.60-1/cngpij/cngpij/bjcups.c
@@ -692,8 +692,8 @@ static short getDeviceURI( char *pDestName, char *pDeviceURI, short bufSize)
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = CUPS_GET_PRINTERS;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, CUPS_GET_PRINTERS);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -702,29 +702,29 @@ static short getDeviceURI( char *pDestName, char *pDeviceURI, short bufSize)
ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, NULL);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
fputs("ERROR: IPP ERROR\n", stderr);
goto onErr;
}
else {
- pAttribute = pResponse->attrs;
+ pAttribute = ippFirstAttribute(pResponse);
while (pAttribute != NULL) {
- while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) {
- pAttribute = pAttribute->next;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_PRINTER) {
+ pAttribute = ippNextAttribute(pResponse);
}
if (pAttribute == NULL) {
break;
}
- while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) {
- if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
- pPrinter = pAttribute->values[0].string.text;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) {
+ if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) {
+ pPrinter = ippGetString(pAttribute, 0, NULL);
}
- if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
- pDUri = pAttribute->values[0].string.text;
+ if (strcmp(ippGetName(pAttribute), "device-uri") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) {
+ pDUri = ippGetString(pAttribute, 0, NULL);
}
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
if (strcasecmp(pDestName, pPrinter) == 0) {
@@ -733,7 +733,7 @@ static short getDeviceURI( char *pDestName, char *pDeviceURI, short bufSize)
}
if (pAttribute != NULL)
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
}
--- cnijfilter-source-3.60-1/cngpij/cngpij/getipc.c
+++ cnijfilter-source-3.60-1/cngpij/cngpij/getipc.c
@@ -40,7 +40,7 @@ int GetIPCData(LPIPCU pipc, char *sname)
int server_fd;
int client_fd;
char buf[128];
- size_t len;
+ socklen_t len;
short ret = RET_ERROR;
if( (server_fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0 )
--- cnijfilter-source-3.60-1/cngpijmon/cnijnpr/cnijnpr/cnijnpr.c
+++ cnijfilter-source-3.60-1/cngpijmon/cnijnpr/cnijnpr/cnijnpr.c
@@ -28,12 +28,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <netinet/in.h>
#include <errno.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <net/if.h>
-#include <sys/sysctl.h>
#include <config.h>
#include <dlfcn.h>
--- cnijfilter-source-3.60-1/cngpijmon/src/bjcupsmon_cups.c
+++ cnijfilter-source-3.60-1/cngpijmon/src/bjcupsmon_cups.c
@@ -216,8 +216,8 @@ PRIVATE gint checkPrinterState(gchar *pDestName, gchar *pURI, gchar *pServerName
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, IPP_GET_PRINTER_ATTRIBUTES);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -226,12 +226,12 @@ PRIVATE gint checkPrinterState(gchar *pDestName, gchar *pURI, gchar *pServerName
ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, pURI);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
else {
if ((pAttribute = ippFindAttribute(pResponse, "printer-state", IPP_TAG_ENUM)) != NULL) {
- printerState = (ipp_state_t)pAttribute->values[0].integer;
+ printerState = (ipp_state_t)ippGetInteger(pAttribute, 0);
}
}
@@ -289,8 +289,8 @@ PUBLIC gint getPrinterStatus(gchar *pDestName, gchar *pStatus, gint bufSize)
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, IPP_GET_PRINTER_ATTRIBUTES);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -299,7 +299,7 @@ PUBLIC gint getPrinterStatus(gchar *pDestName, gchar *pStatus, gint bufSize)
ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printerURI);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
else {
@@ -311,7 +311,7 @@ PUBLIC gint getPrinterStatus(gchar *pDestName, gchar *pStatus, gint bufSize)
//}
pAttribute = ippFindAttribute(pResponse, "printer-state-message", IPP_TAG_TEXT);
if (pAttribute != NULL) {
- strncpy(pStatus, pAttribute->values[0].string.text, bufSize);
+ strncpy(pStatus, ippGetString(pAttribute, 0, NULL), bufSize);
}
}
ippDelete(pResponse);
@@ -370,8 +370,8 @@ PUBLIC gint removeJob(gchar *pDestName)
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = IPP_CANCEL_JOB;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, IPP_CANCEL_JOB);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -382,7 +382,7 @@ PUBLIC gint removeJob(gchar *pDestName)
ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/jobs/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
ippDelete(pResponse);
@@ -445,8 +445,8 @@ PRIVATE gint getJobID(gchar *pDestName, gchar *pURI, gchar *pServerName, gint *p
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = IPP_GET_JOBS;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, IPP_GET_JOBS);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -457,31 +457,31 @@ PRIVATE gint getJobID(gchar *pDestName, gchar *pURI, gchar *pServerName, gint *p
ippAddStrings(pRequest, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes",(int)(sizeof(jobattrs) / sizeof(jobattrs[0])), NULL, jobattrs);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
else {
- pAttribute = pResponse->attrs;
+ pAttribute = ippFirstAttribute(pResponse);
while (pAttribute != NULL) {
- while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_JOB) {
- pAttribute = pAttribute->next;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_JOB) {
+ pAttribute = ippNextAttribute(pResponse);
}
if (pAttribute == NULL) {
break;
}
- while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_JOB) {
- if (strcmp(pAttribute->name, "job-id") == 0 && pAttribute->value_tag == IPP_TAG_INTEGER) {
- jobID = pAttribute->values[0].integer;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_JOB) {
+ if (strcmp(ippGetName(pAttribute), "job-id") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_INTEGER) {
+ jobID = ippGetInteger(pAttribute, 0);
}
- if (strcmp(pAttribute->name, "job-state") == 0 && pAttribute->value_tag == IPP_TAG_ENUM) {
- jobState = (ipp_jstate_t)pAttribute->values[0].integer;
+ if (strcmp(ippGetName(pAttribute), "job-state") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_ENUM) {
+ jobState = (ipp_jstate_t)ippGetInteger(pAttribute, 0);
}
- if (strcmp(pAttribute->name, "job-originating-user-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
- pJobUserName = pAttribute->values[0].string.text;
+ if (strcmp(ippGetName(pAttribute), "job-originating-user-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) {
+ pJobUserName = ippGetString(pAttribute, 0, NULL);
}
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
if (jobState == IPP_JOB_PROCESSING) {
if (pJobUserName != NULL) {
@@ -498,7 +498,7 @@ PRIVATE gint getJobID(gchar *pDestName, gchar *pURI, gchar *pServerName, gint *p
}
if (pAttribute != NULL)
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
}
@@ -556,8 +556,8 @@ PRIVATE gint getPrinterURI(gchar *pDestName, gchar *pURI, gchar *pServerName, gi
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = CUPS_GET_PRINTERS;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, CUPS_GET_PRINTERS);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -566,28 +566,28 @@ PRIVATE gint getPrinterURI(gchar *pDestName, gchar *pURI, gchar *pServerName, gi
ippAddStrings(pRequest, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(attributes) / sizeof(attributes[0]), NULL, attributes);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
else {
- pAttribute = pResponse->attrs;
+ pAttribute = ippFirstAttribute(pResponse);
while (pAttribute != NULL) {
- while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) {
- pAttribute = pAttribute->next;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_PRINTER) {
+ pAttribute = ippNextAttribute(pResponse);
}
if (pAttribute == NULL) {
break;
}
- while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) {
- if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
- pPrinter = pAttribute->values[0].string.text;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) {
+ if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) {
+ pPrinter = ippGetString(pAttribute, 0, NULL);
}
- if (strcmp(pAttribute->name, "printer-uri-supported") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
- pUri = pAttribute->values[0].string.text;
+ if (strcmp(ippGetName(pAttribute), "printer-uri-supported") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) {
+ pUri = ippGetString(pAttribute, 0, NULL);
}
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
// Tora 020418: Compare two printer names ignoring the character case.
@@ -604,7 +604,7 @@ PRIVATE gint getPrinterURI(gchar *pDestName, gchar *pURI, gchar *pServerName, gi
}
if (pAttribute != NULL)
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
}
@@ -659,8 +659,8 @@ PUBLIC gint getDeviceURI(gchar *pDestName, gchar *pDeviceURI, gint bufSize)
else {
pRequest = ippNew();
- pRequest->request.op.operation_id = CUPS_GET_PRINTERS;
- pRequest->request.op.request_id = 1;
+ ippSetOperation(pRequest, CUPS_GET_PRINTERS);
+ ippSetRequestId(pRequest, 1);
pLanguage = bjcupsLangDefault(); // cupsLangDefault() -> bjcupsLangDefault() for cups-1.1.19
@@ -669,28 +669,28 @@ PUBLIC gint getDeviceURI(gchar *pDestName, gchar *pDeviceURI, gint bufSize)
ippAddString(pRequest, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, NULL);
if ((pResponse = cupsDoRequest(pHTTP, pRequest, "/")) != NULL) {
- if (pResponse->request.status.status_code > IPP_OK_CONFLICT) {
+ if (ippGetStatusCode(pResponse) > IPP_OK_CONFLICT) {
retVal = ID_ERR_CUPS_API_FAILED;
}
else {
- pAttribute = pResponse->attrs;
+ pAttribute = ippFirstAttribute(pResponse);
while (pAttribute != NULL) {
- while (pAttribute != NULL && pAttribute->group_tag != IPP_TAG_PRINTER) {
- pAttribute = pAttribute->next;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) != IPP_TAG_PRINTER) {
+ pAttribute = ippNextAttribute(pResponse);
}
if (pAttribute == NULL) {
break;
}
- while (pAttribute != NULL && pAttribute->group_tag == IPP_TAG_PRINTER) {
- if (strcmp(pAttribute->name, "printer-name") == 0 && pAttribute->value_tag == IPP_TAG_NAME) {
- pPrinter = pAttribute->values[0].string.text;
+ while (pAttribute != NULL && ippGetGroupTag(pAttribute) == IPP_TAG_PRINTER) {
+ if (strcmp(ippGetName(pAttribute), "printer-name") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_NAME) {
+ pPrinter = ippGetString(pAttribute, 0, NULL);
}
- if (strcmp(pAttribute->name, "device-uri") == 0 && pAttribute->value_tag == IPP_TAG_URI) {
- pDUri = pAttribute->values[0].string.text;
+ if (strcmp(ippGetName(pAttribute), "device-uri") == 0 && ippGetValueTag(pAttribute) == IPP_TAG_URI) {
+ pDUri = ippGetString(pAttribute, 0, NULL);
}
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
if (strcasecmp(pDestName, pPrinter) == 0) {
@@ -699,7 +699,7 @@ PUBLIC gint getDeviceURI(gchar *pDestName, gchar *pDeviceURI, gint bufSize)
}
if (pAttribute != NULL)
- pAttribute = pAttribute->next;
+ pAttribute = ippNextAttribute(pResponse);
}
}
--- cnijfilter-source-3.60-1/cnijfilter/src/bjfilter.c
+++ cnijfilter-source-3.60-1/cnijfilter/src/bjfilter.c
@@ -34,6 +34,7 @@
#include <sys/wait.h>
#include <signal.h>
#include <fcntl.h>
+#include <ctype.h>
#define BJFTEMPFILE "/tmp/bjtmpXXXXXX"
#define CIFTEMPFILEINPUT "/tmp/ciftmpXXXXXX"
--- cnijfilter-source-3.60-1/cnijfilter/src/bjfimage.c
+++ cnijfilter-source-3.60-1/cnijfilter/src/bjfimage.c
@@ -39,6 +39,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <png.h>
#include "cpktypes.h"
@@ -1585,7 +1587,7 @@ static short png_image_init( LPBJF_IMAGEINFO lpbjfimage )
png_read_info( png_p, info_p );
- png_get_IHDR( png_p, info_p, (unsigned long *)&width, (unsigned long *)&length, &bit_depth,
+ png_get_IHDR( png_p, info_p, (png_uint_32 *)&width, (png_uint_32 *)&length, &bit_depth,
&color_type, &interlace_type, NULL, NULL);
/* not support Interlace */
--- cnijfilter-source-3.60-1/cnijfilter/src/bjfimage.c.orig
+++ cnijfilter-source-3.60-1/cnijfilter/src/bjfimage.c.orig
@@ -39,6 +39,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <png.h>
#include "cpktypes.h"
--- cnijfilter-source-3.60-1/cnijfilter/src/bjfoption.c
+++ cnijfilter-source-3.60-1/cnijfilter/src/bjfoption.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <popt.h>
#include <string.h>
+#include <ctype.h>
#include "cncl.h"
#include "cncldef.h"
--- cnijfilter-source-3.60-1/cnijfilter/src/bjfpos.h
+++ cnijfilter-source-3.60-1/cnijfilter/src/bjfpos.h
@@ -84,6 +84,7 @@ typedef struct BJF_MARGIN_INFO /* borderless information */
extern void bjf_pos_img_init( LPBJF_POS_IMGINFO lpimginfo );
extern void bjf_pos_prn_init( LPBJF_POS_PRNINFO lpprninfo );
extern void bjf_pos_init( LPBJF_POSINFO lpposinfo );
+extern void bjf_margin_init( LPBJF_MARGIN_INFO );
extern short bjf_pos_imageresolution( LPBJF_POS_IMGINFO, LPBJF_POS_PRNINFO, LPBJF_POSINFO );
extern short bjf_pos_imageresolution_fit( LPBJF_POS_IMGINFO, LPBJF_POS_PRNINFO, LPBJF_POSINFO );
extern short bjf_pos_imageresolution_center( LPBJF_POS_IMGINFO, LPBJF_POS_PRNINFO, LPBJF_POSINFO );
@@ -121,6 +122,7 @@ extern short ImageCenter( LPBJF_POS_IMGINFO, LPBJF_POS_PRNINFO, LPBJF_POSINFO, L
extern short ImageCut( LPBJF_POS_IMGINFO, LPBJF_POS_PRNINFO, LPBJF_POSINFO, LPBJF_MARGIN_INFO );
extern short MarginInit(LPBJF_POS_PRNINFO, LPBJF_POSINFO, LPBJF_MARGIN_INFO);
extern short SetExtMargin(LPBJF_POS_PRNINFO, LPBJF_POSINFO, LPBJF_MARGIN_INFO, LPBJFLTOVERMARGININFO);
+extern short SetExtLevel( LPBJF_MARGIN_INFO, short);
extern short SetBbox(LPBJF_OPTINFO , LPBJF_POS_IMGINFO , LPBJF_POSINFO , LPBJF_MARGIN_INFO , int , int);
short bjf_pos_set_paperwidth( LPBJF_MARGIN_INFO , long );
short bjf_pos_set_paperlength( LPBJF_MARGIN_INFO , long );
--- cnijfilter-source-3.60-1/cnijfilter/src/getipc.c
+++ cnijfilter-source-3.60-1/cnijfilter/src/getipc.c
@@ -43,7 +43,7 @@ short GetIPCData(LPIPCU pipc, char *sname)
struct sockaddr_un sun;
int s, c;
char buf[128];
- size_t adrlen;
+ socklen_t adrlen;
short ret = RET_ERROR;
if ((s = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
--- cnijfilter-source-3.60-1/printui/src/colordlg2.c
+++ cnijfilter-source-3.60-1/printui/src/colordlg2.c
@@ -165,7 +165,7 @@ static short SetGammaCombo(UIColorDialog2* dialog, short gamma)
}
/* Ver.2.90 */
-static short CofirmSpinValue( spinbutton )
+static short CofirmSpinValue( GtkSpinButton* spinbutton )
{
short result = 0;
--- cnijfilter-source-3.60-1/printui/src/util_parse_dialogstr.c
+++ cnijfilter-source-3.60-1/printui/src/util_parse_dialogstr.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <libxml/parser.h>
#include "util_parse_dialogstr.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment