Advertisement
h3xx

gtklp-1.3.0_cups_1.5.2+_compat_fix.patch

Jul 24th, 2013
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 11.77 KB | None | 0 0
  1. diff -ru gtklp-1.3.0.orig/gtklp/gtklp_functions.c gtklp-1.3.0/gtklp/gtklp_functions.c
  2. --- gtklp-1.3.0.orig/gtklp/gtklp_functions.c    2013-03-12 12:18:31.000000000 -0500
  3. +++ gtklp-1.3.0/gtklp/gtklp_functions.c 2013-07-24 13:40:28.000000000 -0500
  4. @@ -172,9 +172,8 @@
  5.     if(z1 != NULL)
  6.         *z1='/';
  7.  
  8. -   request=ippNew();
  9. -   ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
  10. -   ippSetRequestId(request, 1);
  11. +   request=ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
  12. +   request->request.op.request_id = 1;
  13.     ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(cupsLanguage));
  14.     ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,cupsLanguage->language);
  15.     ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,URI);
  16. @@ -194,7 +193,7 @@
  17.     }
  18.     else
  19.     {
  20. -       bannerAnz=ippGetCount(attr);
  21. +       bannerAnz=attr->num_values;
  22.         if(bannerAnz > MAX_BANNER)
  23.         {
  24.             if(DEBUG)
  25. @@ -206,8 +205,8 @@
  26.         for(i1=0;i1<bannerAnz;i1++)
  27.         {
  28.             if(DEBUG)
  29. -           printf("  %s\n",ippGetString (attr, i1, NULL));
  30. -           strncpy(Banners[i1],(char *)ippGetString (attr, i1, NULL),(size_t)MAXLINE);
  31. +           printf("  %s\n",attr->values[i1].string.text);
  32. +           strncpy(Banners[i1],(char *)attr->values[i1].string.text,(size_t)MAXLINE);
  33.             bannerList=g_list_append(bannerList,(gchar *)str2str(Banners[i1]));
  34.         }
  35.     }
  36. diff -ru gtklp-1.3.0.orig/gtklpq/printer.c gtklp-1.3.0/gtklpq/printer.c
  37. --- gtklp-1.3.0.orig/gtklpq/printer.c   2013-03-12 12:18:31.000000000 -0500
  38. +++ gtklp-1.3.0/gtklpq/printer.c    2013-07-24 13:58:19.000000000 -0500
  39. @@ -344,9 +344,7 @@
  40.       gtk_statusbar_remove ((GtkStatusbar *) statbar, c_id_state, m_id_state);
  41.     }
  42.  
  43. -  request = ippNew ();
  44. -  ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
  45. -  ippSetRequestId(request, 1);
  46. +  request = ippNewRequest (IPP_GET_PRINTER_ATTRIBUTES);
  47.    ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
  48.         "attributes-charset", NULL, cupsLangEncoding (cupsLanguage));
  49.    ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
  50. @@ -360,7 +358,7 @@
  51.       != NULL)
  52.     {
  53.         aktPrinterHold=0;
  54. -     switch (ippGetInteger (attr, 0))
  55. +     switch (attr->values[0].integer)
  56.         {
  57.         case IPP_PRINTER_IDLE:
  58.           strncpy (toolstring, str2str(_("Printer Idle")),(size_t)MAXLINE);
  59. @@ -373,17 +371,17 @@
  60.                 aktPrinterHold=1;
  61.           break;
  62.         default:
  63. -         snprintf (toolstring, (size_t)MAXLINE, "%i", ippGetInteger (attr, 0));
  64. +         snprintf (toolstring, (size_t)MAXLINE, "%i", attr->values[0].integer);
  65.           break;
  66.         }
  67.  
  68.         jobsRejected=0;
  69.         attr = ippFindAttribute (response, "printer-is-accepting-jobs", IPP_TAG_ZERO);
  70.         if(attr != NULL) {
  71. -           if(ippGetInteger (attr, 0) == 0)
  72. +           if(attr->values[0].integer == 0)
  73.                 jobsRejected=1;
  74.             if(DEBUG)
  75. -               printf("Attr=printer-is-accepting-jobs: %i\n",ippGetInteger (attr, 0));
  76. +               printf("Attr=printer-is-accepting-jobs: %i\n",attr->values[0].integer);
  77.         }
  78.  
  79.         if(nox == 0) {
  80. @@ -429,8 +427,8 @@
  81.  
  82.    if ( (attr = ippFindAttribute (response, "printer-state-message", IPP_TAG_ZERO)) != NULL)
  83.     {
  84. -       if ((strlen (toolstring) + strlen (ippGetString (attr, 0, NULL))) < MAXLINE)
  85. -       snprintf (toolstring, (size_t)MAXLINE, "%s - %s", toolstring, ippGetString (attr, 0, NULL));
  86. +       if ((strlen (toolstring) + strlen (attr->values[0].string.text)) < MAXLINE)
  87. +       snprintf (toolstring, (size_t)MAXLINE, "%s - %s", toolstring, attr->values[0].string.text);
  88.         }
  89.         if(nox == 0)
  90.        m_id_state = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_state, (const char *) str2str(toolstring));
  91. @@ -520,7 +518,7 @@
  92.     }
  93.    
  94.    request = ippNewRequest(IPP_GET_JOBS);
  95. -  ippSetRequestId(request, 1);
  96. +  request->request.op.request_id = 1;
  97.  
  98.  
  99.    language = cupsLangDefault ();
  100. @@ -563,12 +561,12 @@
  101.  
  102.    if ((response = cupsDoRequest (cupsHttp, request, "/")) != NULL)
  103.      {
  104. -      if (ippGetStatusCode(response) > IPP_OK_CONFLICT)
  105. +      if (response->request.status.status_code > IPP_OK_CONFLICT)
  106.     {
  107.         if(nox == 0)
  108. -         m_id_upd = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_upd, str2str((char *)ippErrorString(ippGetStatusCode(response))));
  109. +         m_id_upd = gtk_statusbar_push ((GtkStatusbar *) statbar, c_id_upd, str2str((char *)ippErrorString(response->request.status.status_code)));
  110.         else
  111. -           g_print("[%s] %s: %s\n\n",PrinterNames[PrinterChoice], str2str(_("Error")),ippErrorString (ippGetStatusCode(response)));
  112. +           g_print("[%s] %s: %s\n\n",PrinterNames[PrinterChoice], str2str(_("Error")),ippErrorString (response->request.status.status_code));
  113.       ippDelete (response);
  114.       return(FALSE);
  115.     }
  116. @@ -637,10 +635,10 @@
  117.         }
  118.  
  119.        rank = 1;
  120. -      for (attr = ippFirstAttribute (response); attr != NULL; attr = ippNextAttribute (response))
  121. +      for (attr = response->attrs; attr != NULL; attr = attr->next)
  122.     {
  123. -     while (attr != NULL && ippGetGroupTag (attr) != IPP_TAG_JOB)
  124. -       attr = ippNextAttribute (response);
  125. +     while (attr != NULL && attr->group_tag != IPP_TAG_JOB)
  126. +       attr = attr->next;
  127.  
  128.       if (attr == NULL)
  129.         break;
  130. @@ -653,32 +651,32 @@
  131.       jobdest = NULL;
  132.       jobcopies = 1;
  133.  
  134. -     while (attr != NULL && ippGetGroupTag (attr) == IPP_TAG_JOB)
  135. +     while (attr != NULL && attr->group_tag == IPP_TAG_JOB)
  136.         {
  137. -    if (strcmp (ippGetName (attr), "job-id") == 0 && ippGetValueTag (attr) == IPP_TAG_INTEGER)
  138. -      jobid = ippGetInteger (attr, 0);
  139. +    if (strcmp (attr->name, "job-id") == 0 && attr->value_tag == IPP_TAG_INTEGER)
  140. +      jobid = attr->values[0].integer;
  141.  
  142.  
  143. -    if (strcmp (ippGetName (attr), "job-k-octets") == 0 && ippGetValueTag (attr) == IPP_TAG_INTEGER)
  144. -      jobsize = ippGetInteger (attr, 0) * 1024;
  145. +    if (strcmp (attr->name, "job-k-octets") == 0 && attr->value_tag == IPP_TAG_INTEGER)
  146. +      jobsize = attr->values[0].integer * 1024;
  147.  
  148. -    if (strcmp (ippGetName (attr), "job-state") == 0 && ippGetValueTag (attr) == IPP_TAG_ENUM)
  149. -      jobstate = (ipp_jstate_t) ippGetInteger (attr, 0);
  150. +    if (strcmp (attr->name, "job-state") == 0 && attr->value_tag == IPP_TAG_ENUM)
  151. +      jobstate = (ipp_jstate_t) attr->values[0].integer;
  152.  
  153. -    if (strcmp (ippGetName (attr), "job-printer-uri") == 0 && ippGetValueTag (attr) == IPP_TAG_URI)
  154. -      if ((jobdest = strrchr (ippGetString (attr, 0, NULL), '/')) != NULL)
  155. +    if (strcmp (attr->name, "job-printer-uri") == 0 && attr->value_tag == IPP_TAG_URI)
  156. +      if ((jobdest = strrchr (attr->values[0].string.text, '/')) != NULL)
  157.             jobdest++;
  158.  
  159. -    if (strcmp (ippGetName (attr), "job-originating-user-name") == 0 && ippGetValueTag (attr) == IPP_TAG_NAME)
  160. -      jobuser = ippGetString (attr, 0, NULL);
  161. +    if (strcmp (attr->name, "job-originating-user-name") == 0 && attr->value_tag == IPP_TAG_NAME)
  162. +      jobuser = attr->values[0].string.text;
  163.  
  164. -    if (strcmp (ippGetName (attr), "job-name") == 0 && ippGetValueTag (attr) == IPP_TAG_NAME)
  165. -      jobname = ippGetString (attr, 0, NULL);
  166. +    if (strcmp (attr->name, "job-name") == 0 && attr->value_tag == IPP_TAG_NAME)
  167. +      jobname = attr->values[0].string.text;
  168.  
  169. -    if (strcmp (ippGetName (attr), "copies") == 0 && ippGetValueTag (attr) == IPP_TAG_INTEGER)
  170. -      jobcopies = ippGetInteger (attr, 0);
  171. +    if (strcmp (attr->name, "copies") == 0 && attr->value_tag == IPP_TAG_INTEGER)
  172. +      jobcopies = attr->values[0].integer;
  173.  
  174. -         attr = ippNextAttribute (response);
  175. +         attr = attr->next;
  176.         }
  177.  
  178.       if (jobdest == NULL || jobid == 0)
  179. @@ -1085,9 +1083,8 @@
  180.     char    uri[MAX_URI+1];
  181.     cups_lang_t *language;
  182.  
  183. -   request = ippNew();
  184. -  ippSetOperation(request, IPP_SET_JOB_ATTRIBUTES);
  185. -  ippSetRequestId(request, 1);
  186. +   request = ippNewRequest(IPP_SET_JOB_ATTRIBUTES);
  187. +   request->request.op.request_id = 1;
  188.    
  189.  
  190.     language = cupsLangDefault ();
  191. @@ -1115,10 +1112,10 @@
  192.    
  193.     if ((response = cupsDoRequest(cupsHttp, request, "/jobs")) != NULL)
  194.     {
  195. -       if (ippGetStatusCode (response) > IPP_OK_CONFLICT)
  196. +       if (response->request.status.status_code > IPP_OK_CONFLICT)
  197.         {
  198.             if(DEBUG)
  199. -               printf("set-job-attributes failed(1): %s\n",ippErrorString(ippGetStatusCode (response)));
  200. +               printf("set-job-attributes failed(1): %s\n",ippErrorString(response->request.status.status_code));
  201.             quick_message(str2str(_("Unable to change priority!")),2);
  202.             ippDelete(response);
  203.             return (1);
  204. @@ -1239,9 +1236,8 @@
  205.     if(dialog != (GtkWidget *)NULL)
  206.         gtk_widget_destroy (dialog);
  207.    
  208. -   request = ippNew ();
  209. -   ippSetOperation(request, op);
  210. -   ippSetRequestId(request, 1);
  211. +   request = ippNewRequest (op);
  212. +   request->request.op.request_id = 1;
  213.     language = cupsLangDefault ();
  214.     ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
  215.               "attributes-charset", NULL,
  216. @@ -1307,7 +1303,7 @@
  217.  
  218.     if (response != NULL)
  219.       {
  220. -       switch (ippGetStatusCode (response))
  221. +       switch (response->request.status.status_code)
  222.           {
  223.           case IPP_NOT_FOUND:
  224.                     quick_message(str2str(_("Job or printer not found!")),2);
  225. @@ -1319,7 +1315,7 @@
  226.                     quick_message(str2str(_("You don't own this job!")),2);
  227.         break;
  228.       default:
  229. -         if (ippGetStatusCode (response) > IPP_OK_CONFLICT)
  230. +         if (response->request.status.status_code > IPP_OK_CONFLICT)
  231.                     quick_message(str2str(_("Unable to do so!")),2);
  232.         break;
  233.           }
  234. diff -ru gtklp-1.3.0.orig/libgtklp/libgtklp.c gtklp-1.3.0/libgtklp/libgtklp.c
  235. --- gtklp-1.3.0.orig/libgtklp/libgtklp.c    2013-03-12 12:18:31.000000000 -0500
  236. +++ gtklp-1.3.0/libgtklp/libgtklp.c 2013-07-24 13:40:38.000000000 -0500
  237. @@ -407,9 +407,8 @@
  238.                 PrinterChoice=i1-droppedPrinters;
  239.         }
  240.         snprintf(URI,(size_t)MAX_URI,"ipp://%s/printers/%s",ServerAddr,dests[i1].name);
  241. -       request=ippNew();
  242. -       ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
  243. -       ippSetRequestId(request, 1);
  244. +       request=ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
  245. +       request->request.op.request_id = 1;
  246.         ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(cupsLanguage));
  247.         ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,cupsLanguage->language);
  248.         ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,URI);
  249. @@ -422,9 +421,9 @@
  250.         if((attr=ippFindAttribute(response,"job-sheets-default",IPP_TAG_ZERO)) != NULL)
  251.         {
  252.             if(DEBUG)
  253. -              printf("Job-Sheets-Default for %s\n  Start: %s\n  Stop: %s\n",dests[i1].name,ippGetString (attr, 0, NULL),ippGetString (attr, 1, NULL));
  254. -           strncpy(PrinterBannerStart[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
  255. -      strncpy(PrinterBannerEnd[i1-droppedPrinters],ippGetString (attr, 1, NULL),(size_t)MAXLINE);
  256. +              printf("Job-Sheets-Default for %s\n  Start: %s\n  Stop: %s\n",dests[i1].name,attr->values[0].string.text,attr->values[1].string.text);  
  257. +           strncpy(PrinterBannerStart[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
  258. +      strncpy(PrinterBannerEnd[i1-droppedPrinters],attr->values[1].string.text,(size_t)MAXLINE);
  259.            
  260.         }
  261.         else
  262. @@ -437,8 +436,8 @@
  263.         if((attr=ippFindAttribute(response,"printer-location",IPP_TAG_ZERO)) != NULL)
  264.         {
  265.             if(DEBUG)
  266. -               printf("Location: %s\n",ippGetString (attr, 0, NULL));
  267. -           strncpy(PrinterLocations[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
  268. +               printf("Location: %s\n",attr->values[0].string.text);
  269. +           strncpy(PrinterLocations[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
  270.         }
  271.         else
  272.         {
  273. @@ -448,8 +447,8 @@
  274.         if((attr=ippFindAttribute(response,"printer-info",IPP_TAG_ZERO)) != NULL)
  275.         {
  276.             if(DEBUG)
  277. -             printf("Info: %s\n",ippGetString (attr, 0, NULL));   
  278. -           strncpy(PrinterInfos[i1-droppedPrinters],ippGetString (attr, 0, NULL),(size_t)MAXLINE);
  279. +             printf("Info: %s\n",attr->values[0].string.text);
  280. +           strncpy(PrinterInfos[i1-droppedPrinters],attr->values[0].string.text,(size_t)MAXLINE);
  281.         }
  282.         else
  283.         {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement