Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 64-bit file support #541

Closed
michaelrsweet opened this issue Jan 23, 2004 · 4 comments
Closed

Add 64-bit file support #541

michaelrsweet opened this issue Jan 23, 2004 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-feature
CUPS.org User: mike

Please add support for large files (64-bit file ops, >2GB, etc.) for all programs and libs.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: jlovell

We added large jobs support with the attached patch. Beta users have reported it works well.
Thanks!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Hmm, just looking through the diff now - you are using a definition called PRIdMAX, which is only defined in inttypes.h and there is no fallback definition... :)

I don't think this is insurmountable, just that we might do some pretty wrapping and/or embed the definition in config.h so that it is always defined...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

Please review my changes (only tested on Linux so far...)

FWIW, your patch missed some spots (no mirroring to the old data_remaining member and you missed the "bytes" member of the client structure) and I've restructured things to support large files on more platforms (use long long instead of depending on inttypes and strtoimax). Also, I renamed the old data_remaining to _data_remaining and added some new APIs to simplify handling of 64-bit content lengths.

@michaelrsweet
Copy link
Collaborator Author

"largefile.diff":

RCS file: /cvs/root/cups/config.h.in,v
retrieving revision 1.9
retrieving revision 1.9.10.1
diff -u -d -b -w -r1.9 -r1.9.10.1
--- config.h.in 2003/09/05 01:14:49 1.9
+++ config.h.in 2004/01/23 01:37:45 1.9.10.1
@@ -210,6 +210,13 @@

/*

  • * Do we have <inttypes.h>?
  • /
    +
    +#undef HAVE_INTTYPES_H
    +
    +
    +/
    • Do we have mkstemp() and/or mkstemps()?
      */

RCS file: /cvs/root/cups/backend/lpd.c,v
retrieving revision 1.18
retrieving revision 1.18.6.3
diff -u -d -b -w -r1.18 -r1.18.6.3
--- lpd.c 2003/08/03 16:31:13 1.18
+++ lpd.c 2004/01/23 01:37:46 1.18.6.3
@@ -48,6 +48,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */

#ifdef WIN32

include <winsock.h>

@@ -221,7 +224,7 @@
*/

 int  fd;       /* Temporary file */
  • char buffer[8192]; /* Buffer for copying */
  • char buffer[65536]; /* Buffer for copying /
    int bytes; /
    Number of bytes read */

@@ -547,8 +550,8 @@
struct sockaddr_in addr; /* Socket address /
struct hostent *hostaddr; /
Host address /
int copy; /
Copies written */

  • size_t nbytes, /* Number of bytes written */

  •       tbytes;     /\* Total bytes written */
    
  • size_t nbytes; /* Number of bytes written */

  • off_t tbytes; /* Total bytes written /
    char buffer[8192]; /
    Output buffer /
    #if defined(APPLE)
    socklen_t addrlen; /
    Address length */
    @@ -766,13 +769,13 @@

  • Send the print file...
    */

  •  if (lpd_command(fd, timeout, "\003%u dfA%03.3d%s\n",
    
  •                  (unsigned)filestats.st_size, getpid() % 1000,
    
  •  if (lpd_command(fd, timeout, "\003%" PRIdMAX " dfA%03.3d%s\n",
    
  •                  (intmax_t)filestats.st_size, getpid() % 1000,
          localhost))
     return (1);
    
  •  fprintf(stderr, "INFO: Sending data file (%u bytes)\n",
    
  •          (unsigned)filestats.st_size);
    
  •  fprintf(stderr, "INFO: Sending data file (%" PRIdMAX " bytes)\n",
    
  •          (intmax_t)filestats.st_size);
    

    tbytes = 0;
    for (copy = 0; copy < manual_copies; copy ++)

    Index: berkeley/lpq.c

    RCS file: /cvs/root/cups/berkeley/lpq.c,v
    retrieving revision 1.1.1.11
    retrieving revision 1.1.1.11.10.3
    diff -u -d -b -w -r1.1.1.11 -r1.1.1.11.10.3
    --- lpq.c 2003/05/28 06:02:05 1.1.1.11
    +++ lpq.c 2004/01/23 01:37:46 1.1.1.11.10.3
    @@ -43,6 +43,9 @@
    #include <cups/cups.h>
    #include <cups/language.h>
    #include <cups/debug.h>
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /* HAVE_INTTYPES_H */

    /*
    @@ -228,8 +231,8 @@
    jobuser, / Pointer to job-originating-user-name /
    *jobname; /
    Pointer to job-name /
    ipp_jstate_t jobstate; /
    job-state */

  • off_t jobsize; /* job-k-octets /
    int jobid, /
    job-id */

  •   jobsize,    /* job-k-octets */
    

    #ifdef osf
    jobpriority, /* job-priority /
    #endif /
    osf */
    @@ -364,7 +367,7 @@

     if (strcmp(attr->name, "job-k-octets") == 0 &&
    attr->value_tag == IPP_TAG_INTEGER)
    
  • jobsize = attr->values[0].integer \* 1024;
    
  • jobsize = (off_t)attr->values[0].integer * 1024;
    

    #ifdef osf
    if (strcmp(attr->name, "job-priority") == 0 &&
    @@ -440,15 +443,15 @@
    strlcpy(namestr, jobname, sizeof(namestr));

     printf("%s: %-33.33s [job %d localhost]\n", jobuser, rankstr, jobid);
    
  •    printf("        %-39.39s %d bytes\n", namestr, jobsize);
    
  •    printf("        %-39.39s %" PRIdMAX " bytes\n", namestr, (intmax_t)jobsize);
    

    }
    else
    #ifdef osf

  •    printf("%-6s %-10.10s %-4d %-10d %-27.27s %d bytes\n", rankstr, jobuser,
    
  •      jobpriority, jobid, jobname, jobsize);
    
  •    printf("%-6s %-10.10s %-4d %-10d %-27.27s %" PRIdMAX " bytes\n", rankstr, jobuser,
    
  •      jobpriority, jobid, jobname, (intmax_t)jobsize);
    

    #else

  •    printf("%-7s %-7.7s %-7d %-31.31s %d bytes\n", rankstr, jobuser,
    
  •      jobid, jobname, jobsize);
    
  •    printf("%-7s %-7.7s %-7d %-31.31s %" PRIdMAX " bytes\n", rankstr, jobuser,
    
  •      jobid, jobname, (intmax_t)jobsize);
    

    #endif /* __osf */

     if (attr == NULL)
    

    Index: config-scripts/cups-common.m4

    RCS file: /cvs/root/cups/config-scripts/cups-common.m4,v
    retrieving revision 1.11
    retrieving revision 1.11.10.1
    diff -u -d -b -w -r1.11 -r1.11.10.1
    --- cups-common.m4 2003/09/05 01:14:50 1.11
    +++ cups-common.m4 2004/01/23 01:37:47 1.11.10.1
    @@ -124,6 +124,7 @@
    AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
    AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
    AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
    +AC_CHECK_HEADER(inttypes.h,AC_DEFINE(HAVE_INTTYPES_H))

    dnl Checks for string functions.
    AC_CHECK_FUNCS(strdup strcasecmp strncasecmp strlcat strlcpy)

    Index: cups/http.c

    RCS file: /cvs/root/cups/cups/http.c,v
    retrieving revision 1.1.1.16
    retrieving revision 1.1.1.16.10.3
    diff -u -d -b -w -r1.1.1.16 -r1.1.1.16.10.3
    --- http.c 2003/07/16 17:21:42 1.1.1.16
    +++ http.c 2004/01/23 01:37:47 1.1.1.16.10.3
    @@ -82,6 +82,9 @@
    #include "string.h"
    #include <fcntl.h>
    #include <errno.h>
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /* HAVE_INTTYPES_H */

    #include "http.h"
    #include "http-private.h"
    @@ -103,6 +106,9 @@

    define FNONBLK O_NONBLOCK

    #endif /* !FNONBLK */

+#ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+#endif /* !min */

/*

  • Local functions...
    @@ -875,7 +881,8 @@
    return (0);
    }
  • http->data_remaining = strtol(len, NULL, 16);
  • http->data_remaining = strtoimax(len, NULL, 16);
  • http->deprecated_data_remaining = min(INT_MAX, http->data_remaining);
    if (http->data_remaining < 0)
    {
    DEBUG_puts("httpRead: Negative chunk length!");
    @@ -883,7 +890,7 @@
    }
    }
  • DEBUG_printf(("httpRead: data_remaining = %d\n", http->data_remaining));
  • DEBUG_printf(("httpRead: data_remaining = %" PRIdMAX "\n", (intmax_t)http->data_remaining));

if (http->data_remaining <= 0)
{
@@ -903,7 +910,7 @@
return (0);
}
else if (length > http->data_remaining)

  • length = http->data_remaining;
  • length = (int)http->data_remaining;

if (http->used == 0 && length <= 256)
{
@@ -991,7 +998,10 @@
}

if (bytes > 0)

  • {
    http->data_remaining -= bytes;
  • http->deprecated_data_remaining = min(INT_MAX, http->data_remaining);
  • }
    else if (bytes < 0)
    {
    #ifdef WIN32
    @@ -1190,7 +1200,10 @@
    tbytes += bytes;
    length -= bytes;
    if (http->data_encoding == HTTP_ENCODE_LENGTH)
  • {
    http->data_remaining -= bytes;
  •  http->deprecated_data_remaining = min(INT_MAX, http->data_remaining);
    
  • }
    }

if (http->data_encoding == HTTP_ENCODE_CHUNKED)
@@ -1807,6 +1820,7 @@

http->data_encoding = HTTP_ENCODE_CHUNKED;
http->data_remaining = 0;

  • http->deprecated_data_remaining = 0;
    }
    else
    {
    @@ -1823,9 +1837,11 @@
    if (http->fields[HTTP_FIELD_CONTENT_LENGTH][0] == '\0')
    http->data_remaining = 2147483647;
    else
  •  http->data_remaining = atoi(http->fields[HTTP_FIELD_CONTENT_LENGTH]);
    
  •  http->data_remaining = strtoimax(http->fields[HTTP_FIELD_CONTENT_LENGTH], (char **)NULL, 10);
    
  • DEBUG_printf(("httpGetLength: content_length = %d\n", http->data_remaining));
  • http->deprecated_data_remaining = min(INT_MAX, http->data_remaining);
  • DEBUG_printf(("httpGetLength: content_length = %" PRIdMAX "\n", (intmax_t)http->data_remaining));
    }

return (http->data_remaining);

Index: cups/http.h

RCS file: /cvs/root/cups/cups/http.h,v
retrieving revision 1.1.1.13
retrieving revision 1.1.1.13.10.2
diff -u -d -b -w -r1.1.1.13 -r1.1.1.13.10.2
--- http.h 2003/05/14 05:23:46 1.1.1.13
+++ http.h 2004/01/23 01:37:47 1.1.1.13.10.2
@@ -270,7 +270,9 @@
/* Field values /
char *data; /
Pointer to data buffer /
http_encoding_t data_encoding; /
Chunked or not */

  • int data_remaining; /* Number of bytes left */
  • int deprecated_data_remaining;
  •               /\* DEPRECATED: mirrors data_remaining below as */
    
  •               /\*   min(INT_MAX, data_remaining) _/
    
    int used; /_ Number of bytes used in buffer /
    char buffer[HTTP_MAX_BUFFER];
    /
    Buffer for messages /
    @@ -285,6 +287,8 @@
    fd_set *input_set; /
    select() set for httpWait() /
    http_status_t expect; /
    Expect: header /
    char *cookie; /
    Cookie value(s) */
  • /**** New in CUPS 1.1.20+ ****/
  • off_t data_remaining; /* Number of bytes left */
    } http_t;

Index: cups/ipp.c

RCS file: /cvs/root/cups/cups/ipp.c,v
retrieving revision 1.1.1.16
retrieving revision 1.1.1.16.10.2
diff -u -d -b -w -r1.1.1.16 -r1.1.1.16.10.2
--- ipp.c 2003/07/16 17:21:42 1.1.1.16
+++ ipp.c 2004/01/23 01:37:47 1.1.1.16.10.2
@@ -76,8 +76,15 @@
#include "debug.h"
#include <ctype.h>
#include <errno.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */

+#ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+#endif /* !min /
+
/

  • Local functions...
    /
    @@ -824,8 +831,8 @@
    ippRead(http_t *http, /
    I - HTTP connection /
    ipp_t *ipp) /
    I - IPP data */
    {

    • DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=%d\n", http, ipp,
    •            http ? http->data_remaining : -1));
      
    • DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=%" PRIdMAX "\n", http, ipp,
    •            (intmax_t)(http ? http->data_remaining : -1)));
      

    if (http == NULL)
    return (IPP_ERROR);
    @@ -2460,6 +2467,7 @@

    http->used -= bytes;
    http->data_remaining -= bytes;

    •  http->deprecated_data_remaining = min(INT_MAX, http->data_remaining);
      

      if (http->used > 0)
      memmove(http->buffer, http->buffer + bytes, http->used);

      Index: cups/testhttp.c

      RCS file: /cvs/root/cups/cups/testhttp.c,v
      retrieving revision 1.1.1.8
      retrieving revision 1.1.1.8.10.2
      diff -u -d -b -w -r1.1.1.8 -r1.1.1.8.10.2
      --- testhttp.c 2003/04/11 21:07:19 1.1.1.8
      +++ testhttp.c 2004/01/23 01:37:47 1.1.1.8.10.2
      @@ -35,6 +35,10 @@
      #include <stdio.h>
      #include <stdlib.h>
      #include "http.h"
      +#include <config.h>
      +#ifdef HAVE_INTTYPES_H
      +# include <inttypes.h>
      +#endif /* HAVE_INTTYPES_H */

    /*
    @@ -56,7 +60,7 @@
    username[HTTP_MAX_URI],
    resource[HTTP_MAX_URI];
    int port;

    • long length, total;
    • off_t length, total;
      time_t start, current;

@@ -94,7 +98,8 @@

 start = time(NULL);
  • length = atoi(httpGetField(http, HTTP_FIELD_CONTENT_LENGTH));
  • length = strtoimax(httpGetField(http, HTTP_FIELD_CONTENT_LENGTH), (char **)NULL, 10);
    total = 0;

while ((bytes = httpRead(http, buffer, sizeof(buffer))) > 0)
@@ -105,8 +110,9 @@
{
current = time(NULL);
if (current == start) current ++;

  •    printf("\r%ld/%ld bytes (%ld bytes/sec)      ", total, length,
    
  •           total / (current - start));
    
  •    printf("\r%" PRIdMAX "/%" PRIdMAX " bytes (%ld bytes/sec)      ", 
    
  •       (intmax_t)total, (intmax_t)length,
    
  •           (long)(total / (current - start)));
     fflush(stdout);
    

    }
    }

    Index: cups/util.c

    RCS file: /cvs/root/cups/cups/util.c,v
    retrieving revision 1.10
    retrieving revision 1.10.10.2
    diff -u -d -b -w -r1.10 -r1.10.10.2
    --- util.c 2003/09/13 06:10:24 1.10
    +++ util.c 2004/01/23 01:37:47 1.10.10.2
    @@ -55,6 +55,9 @@
    #include <errno.h>
    #include <fcntl.h>
    #include <sys/stat.h>
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /* HAVE_INTTYPES_H */
    #if defined(WIN32) || defined(EMX)

    include <io.h>

    #else
    @@ -263,10 +266,10 @@
    */

    if (filename != NULL)

  •  sprintf(length, "%lu", (unsigned long)(ippLength(request) +
    
  •                                         (size_t)fileinfo.st_size));
    
  •  sprintf(length, "%" PRIdMAX "", (intmax_t)(ippLength(request) +
    
  •                                         fileinfo.st_size));
    

    else

  •  sprintf(length, "%lu", (unsigned long)ippLength(request));
    
  •  sprintf(length, "%" PRIdMAX "", (intmax_t)ippLength(request));
    

    httpClearFields(http);
    httpSetField(http, HTTP_FIELD_CONTENT_LENGTH, length);

    Index: doc/spm.html

    RCS file: /cvs/root/cups/doc/spm.html,v
    retrieving revision 1.1.1.11
    retrieving revision 1.1.1.11.10.1
    diff -u -d -b -w -r1.1.1.11 -r1.1.1.11.10.1
    --- spm.html 2003/04/11 21:07:30 1.1.1.11
    +++ spm.html 2004/01/23 01:37:48 1.1.1.11.10.1
    @@ -4092,7 +4092,7 @@

    datachar *Current byte in data buffer. data_encodinghttp_encoding_tThe transfer encoding for the request/response. -data_remainingintThe number of bytes remaining +data_remainingoff_tThe number of bytes remaining in the current request, response, or chunk. usedintThe number of bytes that are used in the buffer.

    Index: doc/spm.shtml

    RCS file: /cvs/root/cups/doc/spm.shtml,v
    retrieving revision 1.1.1.10
    retrieving revision 1.1.1.10.10.1
    diff -u -d -b -w -r1.1.1.10 -r1.1.1.10.10.1
    --- spm.shtml 2003/04/11 21:07:37 1.1.1.10
    +++ spm.shtml 2004/01/23 01:37:48 1.1.1.10.10.1
    @@ -2787,7 +2787,7 @@

    data_remaining
  • int
  • off_t
The number of bytes remaining in the current request, response, or chunk.

Index: scheduler/client.c

RCS file: /cvs/root/cups/scheduler/client.c,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.1.2.3
diff -u -d -b -w -r1.11.4.1 -r1.11.4.1.2.3
--- client.c 2003/11/14 23:48:30 1.11.4.1
+++ client.c 2004/01/23 01:37:49 1.11.4.1.2.3
@@ -52,6 +52,9 @@
#include <cups/http-private.h>
#include "cupsd.h"
#include <grp.h>
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */

/*
@@ -876,6 +879,7 @@
con->http.keep_alive = HTTP_KEEPALIVE_OFF;
con->http.data_encoding = HTTP_ENCODE_LENGTH;
con->http.data_remaining = 0;

  • con->http.deprecated_data_remaining = 0;
    con->operation = HTTP_WAITING;
    con->bytes = 0;
    con->file = 0;
    @@ -1343,7 +1347,7 @@
    LogMessage(L_DEBUG2, "CONTENT_TYPE = %s", con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
     if (con->http.fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
  •   atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) > MaxRequestSize &&
    
  •   strtoimax(con->http.fields[HTTP_FIELD_CONTENT_LENGTH], (char **)NULL, 10) > MaxRequestSize &&
    MaxRequestSize > 0)
    {
     /*
    

    @@ -1358,7 +1362,7 @@

      break;
         }
    
  •   else if (atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) < 0)
    
  •   else if (strtoimax(con->http.fields[HTTP_FIELD_CONTENT_LENGTH], (char **)NULL, 10) < 0)
    {
     /*
      * Negative content lengths are invalid!
    

    @@ -1487,7 +1491,7 @@
    LogMessage(L_DEBUG2, "CONTENT_TYPE = %s", con->http.fields[HTTP_FIELD_CONTENT_TYPE]);

         if (con->http.fields[HTTP_FIELD_CONTENT_LENGTH][0] &&
    
  •   atoi(con->http.fields[HTTP_FIELD_CONTENT_LENGTH]) > MaxRequestSize &&
    
  •   strtoimax(con->http.fields[HTTP_FIELD_CONTENT_LENGTH], (char **)NULL, 10) > MaxRequestSize &&
    MaxRequestSize > 0)
    {
     /*
    

    @@ -1643,8 +1647,8 @@
    return (0);
    }

  •     if (httpPrintf(HTTP(con), "Content-Length: %lu\r\n",
    
  •                    (unsigned long)filestats.st_size) < 0)
    
  •     if (httpPrintf(HTTP(con), "Content-Length: %" PRIdMAX "\r\n",
    
  •                    (intmax_t)filestats.st_size) < 0)
      {
    CloseClient(con);
    return (0);
    

    @@ -1675,10 +1679,10 @@
    switch (con->http.state)
    {
    case HTTP_PUT_RECV :

  •    LogMessage(L_DEBUG2, "ReadClient() %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
    
  •    LogMessage(L_DEBUG2, "ReadClient() %d con->data_encoding = %s, con->data_remaining = %" PRIdMAX ", con->file = %d",
       con->http.fd,
       con->http.data_encoding == HTTP_ENCODE_CHUNKED ? "chunked" : "length",
    
  •      con->http.data_remaining, con->file);
    
  •      (intmax_t)con->http.data_remaining, con->file);
    
     if ((bytes = httpRead(HTTP(con), line, sizeof(line))) < 0)
    

    {
    @@ -1718,8 +1722,8 @@

    fstat(con->file, &filestats);

  •      LogMessage(L_DEBUG2, "ReadClient() %d Closing data file %d, size = %d.",
    
  •                 con->http.fd, con->file, (int)filestats.st_size);
    
  •      LogMessage(L_DEBUG2, "ReadClient() %d Closing data file %d, size = %" PRIdMAX ".",
    
  •                 con->http.fd, con->file, (intmax_t)filestats.st_size);
    

    close(con->file);
    con->file = 0;
    @@ -1762,10 +1766,10 @@
    break;

    case HTTP_POST_RECV :

  •    LogMessage(L_DEBUG2, "ReadClient() %d con->data_encoding = %s, con->data_remaining = %d, con->file = %d",
    
  •    LogMessage(L_DEBUG2, "ReadClient() %d con->data_encoding = %s, con->data_remaining = %" PRIdMAX ", con->file = %d",
       con->http.fd,
       con->http.data_encoding == HTTP_ENCODE_CHUNKED ? "chunked" : "length",
    
  •      con->http.data_remaining, con->file);
    
  •      (intmax_t)con->http.data_remaining, con->file);
    
     if (con->request != NULL)
    

    {
    @@ -1865,8 +1869,8 @@
    {
    fstat(con->file, &filestats);

  •        LogMessage(L_DEBUG2, "ReadClient() %d Closing data file %d, size = %d.",
    
  •                   con->http.fd, con->file, (int)filestats.st_size);
    
  •        LogMessage(L_DEBUG2, "ReadClient() %d Closing data file %d, size = %" PRIdMAX ".",
    
  •                   con->http.fd, con->file, (intmax_t)filestats.st_size);
    
    close(con->file);
    con->file = 0;
    

    @@ -2100,8 +2104,8 @@

    if (httpPrintf(HTTP(con), "Last-Modified: %s\r\n", httpGetDateString(filestats->st_mtime)) < 0)
    return (0);

  • if (httpPrintf(HTTP(con), "Content-Length: %lu\r\n",

  •             (unsigned long)filestats->st_size) < 0)
    
  • if (httpPrintf(HTTP(con), "Content-Length: %" PRIdMAX "\r\n",

  •             (intmax_t)filestats->st_size) < 0)
    

    return (0);
    if (httpPrintf(HTTP(con), "\r\n") < 0)
    return (0);
    @@ -2561,8 +2565,8 @@
    }
    }

  • LogMessage(L_DEBUG2, "check_if_modified() %d sizes=%d,%d dates=%d,%d",

  •         con->http.fd, size, (int)filestats->st_size, (int)date,
    
  • LogMessage(L_DEBUG2, "check_if_modified() %d sizes=%d,%" PRIdMAX " dates=%d,%d",

  •         con->http.fd, size, (intmax_t)filestats->st_size, (int)date,
     (int)filestats->st_mtime);
    

    return ((size != filestats->st_size && size != 0) ||
    @@ -2710,8 +2714,8 @@
    status = stat(filename, filestats);
    }

  • LogMessage(L_DEBUG2, "get_file() %d filename=%s size=%d",

  •         con->http.fd, filename, status ? -1 : (int)filestats->st_size);
    
  • LogMessage(L_DEBUG2, "get_file() %d filename=%s size=%" PRIdMAX "",

  •         con->http.fd, filename, status ? -1 : (intmax_t)filestats->st_size);
    

    if (status)
    return (NULL);

    Index: scheduler/cups-lpd.c

    RCS file: /cvs/root/cups/scheduler/cups-lpd.c,v
    retrieving revision 1.1.1.11
    retrieving revision 1.1.1.11.10.3
    diff -u -d -b -w -r1.1.1.11 -r1.1.1.11.10.3
    --- cups-lpd.c 2003/05/28 06:02:42 1.1.1.11
    +++ cups-lpd.c 2004/01/23 01:37:49 1.1.1.11.10.3
    @@ -50,6 +50,9 @@
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /* HAVE_INTTYPES_H */

    /*
    @@ -926,8 +929,8 @@
    jobuser, / Pointer to job-originating-user-name /
    *jobname; /
    Pointer to job-name /
    ipp_jstate_t jobstate; /
    job-state */

  • off_t jobsize; /* job-k-octets /
    int jobid, /
    job-id */

  •   jobsize,        /* job-k-octets */
    jobcount,       /* Number of jobs */
    jobcopies,      /* Number of copies */
    rank;           /* Rank of job */
    

    @@ -1151,7 +1154,7 @@

     if (strcmp(attr->name, "job-k-octets") == 0 &&
    attr->value_tag == IPP_TAG_INTEGER)
    
  • jobsize = attr->values[0].integer \* 1024;
    
  • jobsize = (off_t)attr->values[0].integer * 1024;
    
     if (strcmp(attr->name, "job-state") == 0 &&
    attr->value_tag == IPP_TAG_ENUM)
    

    @@ -1217,11 +1220,11 @@
    strlcpy(namestr, jobname, sizeof(namestr));

     printf("%s: %-33.33s [job %d localhost]\n", jobuser, rankstr, jobid);
    
  •    printf("        %-39.39s %d bytes\n", namestr, jobsize);
    
  •    printf("        %-39.39s %" PRIdMAX " bytes\n", namestr, (intmax_t)jobsize);
    

    }
    else

  •    printf("%-7s %-7.7s %-7d %-31.31s %d bytes\n", rankstr, jobuser,
    
  •      jobid, jobname, jobsize);
    
  •    printf("%-7s %-7.7s %-7d %-31.31s %" PRIdMAX " bytes\n", rankstr, jobuser,
    
  •      jobid, jobname, (intmax_t)jobsize);
    

    if (attr == NULL)
    break;

    Index: scheduler/ipp.c

    RCS file: /cvs/root/cups/scheduler/ipp.c,v
    retrieving revision 1.15.4.1
    retrieving revision 1.15.4.1.2.2
    diff -u -d -b -w -r1.15.4.1 -r1.15.4.1.2.2
    --- ipp.c 2003/11/14 23:48:30 1.15.4.1
    +++ ipp.c 2004/01/23 01:37:49 1.15.4.1.2.2
    @@ -85,8 +85,15 @@
    #ifdef HAVE_LIBPAPER

    include <paper.h>

    #endif /* HAVE_LIBPAPER /
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /
    HAVE_INTTYPES_H */

+#ifndef min
+# define min(a,b) ((a) < (b) ? (a) : (b))
+#endif /* !min /
+
/

  • PPD default choice structure...
    */
    @@ -475,9 +482,10 @@
    {
    con->http.data_encoding = HTTP_ENCODE_LENGTH;
    con->http.data_remaining = ippLength(con->response);

    •  con->http.deprecated_data_remaining = min(INT_MAX, con->http.data_remaining);
      
  •  httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
    
  •        con->http.data_remaining);
    
  •  httpPrintf(HTTP(con), "Content-Length: %" PRIdMAX "\r\n\r\n",
    
  •        (intmax_t)con->http.data_remaining);
    

    }

    LogMessage(L_DEBUG2, "ProcessIPPRequest: Adding fd %d to OutputSet...",

    Index: systemv/lpstat.c

    RCS file: /cvs/root/cups/systemv/lpstat.c,v
    retrieving revision 1.1.1.10
    retrieving revision 1.1.1.10.10.3
    diff -u -d -b -w -r1.1.1.10 -r1.1.1.10.10.3
    --- lpstat.c 2003/07/16 17:22:07 1.1.1.10
    +++ lpstat.c 2004/01/23 01:37:50 1.1.1.10.10.3
    @@ -45,6 +45,9 @@
    #include <cups/language.h>
    #include <cups/debug.h>
    #include <cups/string.h>
    +#ifdef HAVE_INTTYPES_H
    +# include <inttypes.h>
    +#endif /* HAVE_INTTYPES_H */

    /*
    @@ -1416,8 +1419,8 @@
    username, / Pointer to job-originating-user-name /
    *title; /
    Pointer to job-name /
    int rank, /
    Rank in queue */

  •   jobid,          /\* job-id */
    
  •   size;           /\* job-k-octets */
    
  •   jobid;          /\* job-id */
    
  • off_t size; /* job-k-octets /
    time_t jobtime; /
    time-at-creation /
    struct tm *jobdate; /
    Date & time /
    const char *dptr, /
    Pointer into destination list */
    @@ -1528,7 +1531,7 @@

 if (strcmp(attr->name, "job-k-octets") == 0 &&
attr->value_tag == IPP_TAG_INTEGER)
  • size = attr->values[0].integer \* 1024;
    
  • size = (off_t)attr->values[0].integer * 1024;
    
     if (strcmp(attr->name, "time-at-creation") == 0 &&
    attr->value_tag == IPP_TAG_INTEGER)
    

    @@ -1670,19 +1673,19 @@

    strftime(date, sizeof(date), "%b %d %H:%M", jobdate);

  • printf("%s;%s;%d;%s;%s\n", temp, username ? username : "unknown",
    
  •        size, title ? title : "unknown", date);
    
  • printf("%s;%s;%" PRIdMAX ";%s;%s\n", temp, username ? username : "unknown",
    
  •        (intmax_t)size, title ? title : "unknown", date);
    

    }
    else
    {
    strftime(date, sizeof(date), CUPS_STRFTIME_FORMAT, jobdate);

       if (ranking)
    
  •   printf("%3d %-21s %-13s %8d %s\n", rank, temp,
    
  •          username ? username : "unknown", size, date);
    
  •   printf("%3d %-21s %-13s %8" PRIdMAX " %s\n", rank, temp,
    
  •          username ? username : "unknown", (intmax_t)size, date);
       else
    
  •   printf("%-23s %-13s %8d   %s\n", temp,
    
  •          username ? username : "unknown", size, date);
    
  •   printf("%-23s %-13s %8" PRIdMAX "   %s\n", temp,
    
  •          username ? username : "unknown", (intmax_t)size, date);
       if (long_status)
    printf("\tqueued for %s\n", dest);
    

    }

@michaelrsweet michaelrsweet added the enhancement New feature or request label Mar 17, 2016
@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant