Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet d63b19a5da Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.1.19@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
76 arquivos alterados com 1177 adições e 585 exclusões
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
CGI - CUPS v1.1.19 - 03/14/2003
CGI - CUPS v1.1.19 - 05/27/2003
-------------------------------
This file describes the experimental scripting/CGI support
+69 -1
Ver Arquivo
@@ -1,6 +1,74 @@
CHANGES.txt - 04/28/2003
CHANGES.txt - 05/27/2003
------------------------
CHANGES IN CUPS V1.1.19
- The GNU TLS code incorrectly used
gnutls_check_pending() instead of
gnutls_record_check_pending() (STR #128)
- The ppdEmit() functions output "PageSize Custom"
instead of "CustomPageSize True" in the DSC comments.
Also, the custom page size code did not use the
ParamCustomPageSize attributes (STR #127)
- The cupstestppd command did not list the conflicting
options (STR #123)
- The lpq command did not ensure that there was
whitespace between the fields in the job listing (STR
#117)
- The German web templates had errors (STR #119)
- The configure script didn't specify the static
libraries properly when configuring with the
--disable-shared option (STR #104)
- The cups.list file used file dependencies for package
formats other than portable, RPM, and Debian (STR #98)
- cupsLangGet() didn't use its language cache (STR #97)
- "lpq -P" would segfault instead of showing a usage
message (STR #94)
- Fixed compiler warnings in pdftops filter (STR #96)
CHANGES IN CUPS V1.1.19rc5
- Jobs with banner pages that were printed to implicit
classes would get double banner pages for each
file/banner in the job (STR #68)
- The mime.convs file was missing the filter definition
for Windows BMP (image/x-bitmap) files (STR #85)
- The scheduler allowed some READ-ONLY job attributes to
be set, which could cause the scheduler to fail on the
next restart (STR #82)
- The lp and lpr commands did not report when the
scheduler was not responding; instead, the user would
incorrectly see a "no default destination" error (STR
#70)
- cupsLangGet() could fail on OSX due to a corrupt
language preference (STR #78)
- Added more checks for HTTP request timeouts.
- The scheduler dropped the first non-alpha character
after an open brace when doing attribute substitutions
in banner pages (STR #77)
- The scheduler child might send SIGUSR1 to the parent
before the signal handler was installed; this didn't
prevent the scheduler from starting but produced an
annoying error message (STR #45)
CHANGES IN CUPS V1.1.19rc4
- The lp command did not accept "-" for printing from
the standard input as required by POSIX 1003.1 (STR
#59)
- Added the job-originating-host-name information for
the page_log file documentation in the SAM (STR #31)
- The German web interface templates did not use the
right paths for job operations (STR #54)
- The scheduler would consume all available CPU if
started with a pending job in the queue (STR #35)
- The polling daemon allocated an extra localization
buffer but did not free it, causing cups-polld to
eventually use all available memory (STR #40)
CHANGES IN CUPS V1.1.19rc3
- The scheduler could get in an infinite loop cancelling
+14 -10
Ver Arquivo
@@ -1,5 +1,5 @@
ENCRYPTION - CUPS v1.1.7 - 02/21/2001
-------------------------------------
ENCRYPTION - CUPS v1.1.19 - 05/27/2003
--------------------------------------
This file describes the encryption support provided by CUPS.
@@ -17,15 +17,16 @@ LEGAL STUFF
BEFORE USING THE ENCRYPTION SUPPORT, PLEASE VERIFY THAT IT IS
LEGAL TO DO SO IN YOUR COUNTRY. CUPS by itself doesn't include
any encryption code, but it can link against the OpenSSL library
which does.
any encryption code, but it can link against the OpenSSL, GNU
TLS, or CDSA libraries which do.
OVERVIEW OF ENCRYPTION SUPPORT IN CUPS
CUPS supports SSL/2.0, SSL/3.0, and TLS/1.0 encryption using
keys as large as 128-bits. Encryption support is provided via
the OpenSSL library and some new hooks in the CUPS code.
the OpenSSL, GNU TLS, or CDSA libraries and some new hooks in
the CUPS code.
CUPS provides support for dedicated (https) and "upgrade" (TLS)
encryption of sessions. The "HTTP Upgrade" method is described
@@ -79,19 +80,22 @@ to /etc/cups/cupsd.conf.
BEFORE YOU BEGIN
You'll need the OpenSSL library from:
You'll need the OpenSSL, GNU TLS, or CDSA libraries from:
http://www.openssl.org
http://www.openssl.org/
http://www.gnutls.org/
http://www.intel.com/labs/archive/cdsa.htm
CONFIGURING WITH ENCRYPTION SUPPORT
Once you have the OpenSSL library installed, you'll need to
configure CUPS to use it with the "--enable-ssl" option:
Once you have the OpenSSL, GNU TLS, or CDSA libraries installed,
you'll need to configure CUPS to use it with the "--enable-ssl"
option:
./configure --enable-ssl
If the OpenSSL stuff is not in a standard location, make sure to
If the library stuff is not in a standard location, make sure to
define the CFLAGS, CXXFLAGS, and LDFLAGS environment variables
with the appropriate compiler and linker options first.
+2 -7
Ver Arquivo
@@ -1,10 +1,5 @@
INSTALL - CUPS v1.1.19rc3 - 04/28/2003
--------------------------------------
**** THIS IS A RELEASE CANDIDATE AND NOT A PRODUCTION ****
**** RELEASE. REPORT ALL PROBLEMS USING THE FORM AT: ****
**** ****
**** http://www.cups.org/str.php ****
INSTALL - CUPS v1.1.19 - 05/27/2003
-----------------------------------
This file describes how to compile and install CUPS from source
code. For more information on CUPS see the file called
+2 -7
Ver Arquivo
@@ -1,10 +1,5 @@
README - CUPS v1.1.19rc3 - 04/28/2003
-------------------------------------
**** THIS IS A RELEASE CANDIDATE AND NOT A PRODUCTION ****
**** RELEASE. REPORT ALL PROBLEMS USING THE FORM AT: ****
**** ****
**** http://www.cups.org/str.php ****
README - CUPS v1.1.19 - 05/27/2003
----------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
instead...
+30 -6
Ver Arquivo
@@ -26,6 +26,7 @@
* main() - Parse options and commands.
* show_jobs() - Show jobs.
* show_printer() - Show printer status.
* usage() - Show program usage.
*/
/*
@@ -51,6 +52,7 @@
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
static void usage(void);
/*
@@ -128,6 +130,15 @@ main(int argc, /* I - Number of command-line arguments */
else
{
i ++;
if (i >= argc)
{
httpClose(http);
cupsFreeDests(num_dests, dests);
usage();
}
dest = argv[i];
}
@@ -155,10 +166,11 @@ main(int argc, /* I - Number of command-line arguments */
break;
default :
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
httpClose(http);
cupsFreeDests(num_dests, dests);
return (1);
cupsFreeDests(num_dests, dests);
usage();
break;
}
}
else if (isdigit(argv[i][0]))
@@ -427,15 +439,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */
else
strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
printf("%s: %-33.33s [job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-39.39s %d bytes\n", namestr, jobsize);
}
else
#ifdef __osf__
printf("%-6s %-10.10s %-4d %-10d %-27.27s %d bytes\n", rankstr, jobuser,
jobpriority, jobid, jobname, jobsize);
#else
printf("%-7s %-8.8s%-8d%-32.32s%d bytes\n", rankstr, jobuser,
printf("%-7s %-7.7s %-7d %-31.31s %d bytes\n", rankstr, jobuser,
jobid, jobname, jobsize);
#endif /* __osf */
@@ -544,6 +556,18 @@ show_printer(http_t *http, /* I - HTTP connection to server */
}
/*
* 'usage()' - Show program usage.
*/
static void
usage(void)
{
fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
exit(1);
}
/*
* End of "$Id$".
*/
+5 -1
Ver Arquivo
@@ -321,7 +321,11 @@ main(int argc, /* I - Number of command-line arguments */
if (printer == NULL)
{
fputs("lpr: error - no default destination available.\n", stderr);
if (cupsLastError() >= IPP_BAD_REQUEST)
fputs("lpr: error - scheduler not responding!\n", stderr);
else
fputs("lpr: error - no default destination available.\n", stderr);
return (1);
}
+5 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: client.conf 3041 2002-12-17 19:00:27Z swdev $"
# "$Id: client.conf 3705 2003-05-09 19:14:44Z mike $"
#
# Sample client configuration file for the Common UNIX Printing System
# (CUPS).
@@ -34,7 +34,9 @@
#
# ServerName: the hostname of your server. By default CUPS will use the
# hostname of the system or the value of the CUPS_SERVER environment
# variable.
# variable. ONLY ONE SERVER NAME MAY BE SPECIFIED AT A TIME. To use
# more than one server you must use a local scheduler with browsing
# and possibly polling.
#
#ServerName myhost.domain.com
@@ -61,5 +63,5 @@
#
# End of "$Id: client.conf 3041 2002-12-17 19:00:27Z swdev $".
# End of "$Id: client.conf 3705 2003-05-09 19:14:44Z mike $".
#
+6 -4
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.convs 3041 2002-12-17 19:00:27Z swdev $"
# "$Id: mime.convs 3709 2003-05-12 17:38:18Z mike $"
#
# MIME converts file for the Common UNIX Printing System (CUPS).
#
@@ -55,6 +55,7 @@ image/gif application/vnd.cups-postscript 66 imagetops
image/png application/vnd.cups-postscript 66 imagetops
image/jpeg application/vnd.cups-postscript 66 imagetops
image/tiff application/vnd.cups-postscript 66 imagetops
image/x-bitmap application/vnd.cups-postscript 66 imagetops
image/x-photocd application/vnd.cups-postscript 66 imagetops
image/x-portable-anymap application/vnd.cups-postscript 66 imagetops
image/x-portable-bitmap application/vnd.cups-postscript 66 imagetops
@@ -63,7 +64,7 @@ image/x-portable-pixmap application/vnd.cups-postscript 66 imagetops
image/x-sgi-rgb application/vnd.cups-postscript 66 imagetops
image/x-xbitmap application/vnd.cups-postscript 66 imagetops
image/x-xpixmap application/vnd.cups-postscript 66 imagetops
image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
#image/x-xwindowdump application/vnd.cups-postscript 66 imagetops
image/x-sun-raster application/vnd.cups-postscript 66 imagetops
@@ -86,6 +87,7 @@ image/gif application/vnd.cups-raster 100 imagetoraster
image/png application/vnd.cups-raster 100 imagetoraster
image/jpeg application/vnd.cups-raster 100 imagetoraster
image/tiff application/vnd.cups-raster 100 imagetoraster
image/x-bitmap application/vnd.cups-raster 100 imagetoraster
image/x-photocd application/vnd.cups-raster 100 imagetoraster
image/x-portable-anymap application/vnd.cups-raster 100 imagetoraster
image/x-portable-bitmap application/vnd.cups-raster 100 imagetoraster
@@ -94,7 +96,7 @@ image/x-portable-pixmap application/vnd.cups-raster 100 imagetoraster
image/x-sgi-rgb application/vnd.cups-raster 100 imagetoraster
image/x-xbitmap application/vnd.cups-raster 100 imagetoraster
image/x-xpixmap application/vnd.cups-raster 100 imagetoraster
image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
# pstoraster is now part of ESP Ghostscript...
@@ -112,5 +114,5 @@ image/x-sun-raster application/vnd.cups-raster 100 imagetoraster
#application/octet-stream application/vnd.cups-raw 0 -
#
# End of "$Id: mime.convs 3041 2002-12-17 19:00:27Z swdev $".
# End of "$Id: mime.convs 3709 2003-05-12 17:38:18Z mike $".
#
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 3643 2003-04-18 15:23:37Z mike $"
dnl "$Id: cups-common.m4 3724 2003-05-14 18:24:38Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -29,7 +29,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.1.19rc3"
CUPS_VERSION="1.1.19"
AC_SUBST(CUPS_VERSION)
AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION")
@@ -202,5 +202,5 @@ AC_SUBST(BACKLIBS)
AC_SUBST(COMMONLIBS)
dnl
dnl End of "$Id: cups-common.m4 3643 2003-04-18 15:23:37Z mike $".
dnl End of "$Id: cups-common.m4 3724 2003-05-14 18:24:38Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-sharedlibs.m4 3255 2003-01-28 15:33:18Z mike $"
dnl "$Id: cups-sharedlibs.m4 3737 2003-05-16 19:07:15Z mike $"
dnl
dnl Shared library support for the Common UNIX Printing System (CUPS).
dnl
@@ -87,8 +87,8 @@ AC_SUBST(LIBCUPS)
AC_SUBST(LIBCUPSIMAGE)
if test x$enable_shared = xno; then
LINKCUPS="-lcups \$(SSLLIBS)"
LINKCUPSIMAGE="-lcupsimage"
LINKCUPS="../cups/libcups.a \$(SSLLIBS)"
LINKCUPSIMAGE="../filter/libcupsimage.a"
else
if test $uname = AIX; then
LINKCUPS="-lcups_s"
@@ -152,5 +152,5 @@ AC_SUBST(IMGLIBS)
AC_SUBST(EXPORT_LDFLAGS)
dnl
dnl End of "$Id: cups-sharedlibs.m4 3255 2003-01-28 15:33:18Z mike $".
dnl End of "$Id: cups-sharedlibs.m4 3737 2003-05-16 19:07:15Z mike $".
dnl
+5 -2
Ver Arquivo
@@ -42,11 +42,14 @@
%provides cupsys-client
%provides cupsys-devel
%provides libcups1
%provides libcups.so.2
%provides libcupsimage.so.2
%provides libcupsys2
%provides libcupsys2-dev
%format rpm deb portable
%provides libcups.so.2
%provides libcupsimage.so.2
%format all
#
# GNU variables...
#
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: cups.spec 3643 2003-04-18 15:23:37Z mike $"
# "$Id: cups.spec 3724 2003-05-14 18:24:38Z mike $"
#
# RPM "spec" file for the Common UNIX Printing System (CUPS).
#
@@ -26,7 +26,7 @@
Summary: Common Unix Printing System
Name: cups
Version: 1.1.19rc3
Version: 1.1.19
Release: 1
Copyright: GPL
Group: System Environment/Daemons
@@ -215,5 +215,5 @@ rm -rf $RPM_BUILD_ROOT
/usr/lib/*.so*
#
# End of "$Id: cups.spec 3643 2003-04-18 15:23:37Z mike $".
# End of "$Id: cups.spec 3724 2003-05-14 18:24:38Z mike $".
#
+100 -24
Ver Arquivo
@@ -196,26 +196,52 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice) < 0)
{
free(choices);
return (-1);
}
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
{
/*
* Variable size; write out standard size options (this should
* eventually be changed to use the parameter positions defined
* in the PPD file...)
* Variable size; write out standard size options, using the
* parameter positions defined in the PPD file...
*/
ppd_attr_t *attr; /* PPD attribute */
int pos, /* Position of custom value */
values[5]; /* Values for custom command */
fputs("%%BeginFeature: *CustomPageSize True\n", fp);
size = ppdPageSize(ppd, "Custom");
fprintf(fp, "%.0f %.0f 0 0 0\n", size->width, size->length);
memset(values, 0, sizeof(values));
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 0;
}
else
pos = 0;
values[pos] = (int)size->width;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 1;
}
else
pos = 1;
values[pos] = (int)size->length;
fprintf(fp, "%d %d %d %d %d\n", values[0], values[1],
values[2], values[3], values[4]);
if (choices[i]->code == NULL)
{
@@ -228,6 +254,13 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
fputs(ppd_custom_code, fp);
}
}
else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice) < 0)
{
free(choices);
return (-1);
}
if (choices[i]->code != NULL && choices[i]->code[0] != '\0')
{
@@ -274,7 +307,8 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
ppd_section_t section) /* I - Section to write */
{
int i, /* Looping var */
count; /* Number of choices */
count, /* Number of choices */
custom_size; /* Non-zero if this option is a custom size */
ppd_choice_t **choices; /* Choices */
ppd_size_t *size; /* Custom page size */
char buf[1024]; /* Output buffer for feature */
@@ -311,9 +345,22 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
* Send DSC comments with option...
*/
snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice);
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
{
custom_size = 1;
strcpy(buf, "%%BeginFeature: *CustomPageSize True\n");
}
else
{
custom_size = 0;
snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n",
((ppd_option_t *)choices[i]->option)->keyword,
choices[i]->choice);
}
if (write(fd, buf, strlen(buf)) < 1)
{
@@ -321,19 +368,48 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */
return (-1);
}
if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 ||
strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) &&
strcasecmp(choices[i]->choice, "Custom") == 0)
if (custom_size)
{
/*
* Variable size; write out standard size options (this should
* eventually be changed to use the parameter positions defined
* in the PPD file...)
* Variable size; write out standard size options, using the
* parameter positions defined in the PPD file...
*/
ppd_attr_t *attr; /* PPD attribute */
int pos, /* Position of custom value */
values[5]; /* Values for custom command */
size = ppdPageSize(ppd, "Custom");
snprintf(buf, sizeof(buf), "%.0f %.0f 0 0 0\n", size->width,
size->length);
memset(values, 0, sizeof(values));
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 0;
}
else
pos = 0;
values[pos] = (int)size->width;
if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL)
{
pos = atoi(attr->value) - 1;
if (pos < 0 || pos > 4)
pos = 1;
}
else
pos = 1;
values[pos] = (int)size->length;
snprintf(buf, sizeof(buf), "%d %d %d %d %d\n", values[0], values[1],
values[2], values[3], values[4]);
if (write(fd, buf, strlen(buf)) < 1)
{
+39 -3
Ver Arquivo
@@ -909,6 +909,9 @@ httpRead(http_t *http, /* I - HTTP data */
* Buffer small reads for better performance...
*/
if (!http->blocking && !httpWait(http, 1000))
return (0);
if (http->data_remaining > sizeof(http->buffer))
bytes = sizeof(http->buffer);
else
@@ -945,7 +948,10 @@ httpRead(http_t *http, /* I - HTTP data */
#endif /* WIN32 */
}
else
{
http->error = EPIPE;
return (0);
}
}
if (http->used > 0)
@@ -965,10 +971,18 @@ httpRead(http_t *http, /* I - HTTP data */
}
#ifdef HAVE_SSL
else if (http->tls)
{
if (!http->blocking && !httpWait(http, 1000))
return (0);
bytes = http_read_ssl(http, buffer, length);
}
#endif /* HAVE_SSL */
else
{
if (!http->blocking && !httpWait(http, 1000))
return (0);
DEBUG_printf(("httpRead: reading %d bytes from socket...\n", length));
bytes = recv(http->fd, buffer, length, 0);
DEBUG_printf(("httpRead: read %d bytes from socket...\n", bytes));
@@ -987,6 +1001,11 @@ httpRead(http_t *http, /* I - HTTP data */
http->error = errno;
#endif /* WIN32 */
}
else
{
http->error = EPIPE;
return (0);
}
if (http->data_remaining == 0)
{
@@ -1084,6 +1103,24 @@ httpWait(http_t *http, /* I - HTTP data */
if (http->used)
return (1);
#ifdef HAVE_SSL
if (http->tls)
{
# ifdef HAVE_LIBSSL
if (SSL_pending((SSL *)(http->tls)))
return (1);
# elif defined(HAVE_GNUTLS)
if (gnutls_record_check_pending(((http_tls_t *)(http->tls))->session))
return (1);
# elif defined(HAVE_CDSASSL)
size_t bytes; /* Bytes that are available */
if (!SSLGetBufferedReadSize((SSLContextRef)http->tls, &bytes) && bytes > 0)
return;
# endif /* HAVE_LIBSSL */
}
#endif /* HAVE_SSL */
/*
* Then try doing a select() to poll the socket...
*/
@@ -1326,7 +1363,7 @@ httpGets(char *line, /* I - Line to read into */
bytes = http_read_ssl(http, bufend, HTTP_MAX_BUFFER - http->used);
else
#endif /* HAVE_SSL */
bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
bytes = recv(http->fd, bufend, HTTP_MAX_BUFFER - http->used, 0);
if (bytes < 0)
{
@@ -1358,8 +1395,7 @@ httpGets(char *line, /* I - Line to read into */
}
else if (bytes == 0)
{
if (http->blocking)
http->error = EPIPE;
http->error = EPIPE;
return (NULL);
}
+1 -1
Ver Arquivo
@@ -332,7 +332,6 @@ extern void httpSetField(http_t *http, http_field_t field,
extern const char *httpStatus(http_status_t status);
extern int httpTrace(http_t *http, const char *uri);
extern http_status_t httpUpdate(http_t *http);
extern int httpWait(http_t *http, int msec);
extern int httpWrite(http_t *http, const char *buffer, int length);
extern char *httpEncode64(char *out, const char *in);
extern char *httpDecode64(char *out, const char *in);
@@ -347,6 +346,7 @@ extern char *httpMD5String(const md5_byte_t *, char [33]);
extern void httpClearCookie(http_t *http);
#define httpGetCookie(http) ((http)->cookie)
extern void httpSetCookie(http_t *http, const char *cookie);
extern int httpWait(http_t *http, int msec);
/*
+8 -1
Ver Arquivo
@@ -2467,7 +2467,14 @@ ipp_read_http(http_t *http, /* I - Client connection */
if (http->data_remaining == 0)
{
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
httpGets(len, sizeof(len), http);
{
/*
* Get the trailing CR LF after the chunk...
*/
if (!httpGets(len, sizeof(len), http))
return (-1);
}
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
{
+142 -74
Ver Arquivo
@@ -25,11 +25,13 @@
*
* Contents:
*
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
* for the given language.
* cupsLangFlush() - Flush all language data out of the cache.
* cupsLangFree() - Free language data.
* cupsLangGet() - Get a language.
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
* for the given language.
* cupsLangFlush() - Flush all language data out of the cache.
* cupsLangFree() - Free language data.
* cupsLangGet() - Get a language.
* appleLangDefault() - Get the default locale string.
* cups_cache_lookup() - Lookup a language in the cache...
*/
/*
@@ -47,20 +49,30 @@
#include "string.h"
#include "language.h"
/*
* Local functions...
*/
#ifdef __APPLE__
# include <CoreFoundation/CoreFoundation.h>
static const char *appleLangDefault(void);
static const char *appleLangDefault(void);
#endif /* __APPLE__ */
static cups_lang_t *cups_cache_lookup(const char *name,
cups_encoding_t encoding);
/*
* Local globals...
*/
static cups_lang_t *lang_cache = NULL; /* Language string cache */
static const char lang_blank[] = ""; /* Blank constant string */
static const char * const lang_encodings[] = /* Encoding strings */
{
static cups_lang_t *lang_cache = NULL;
/* Language string cache */
static const char lang_blank[] = "";
/* Blank constant string */
static const char * const lang_encodings[] =
{ /* Encoding strings */
"us-ascii",
"iso-8859-1",
"iso-8859-2",
@@ -89,8 +101,8 @@ static const char * const lang_encodings[] = /* Encoding strings */
"koi8-r",
"koi8-u"
};
static const char * const lang_default[] = /* Default POSIX locale */
{
static const char * const lang_default[] =
{ /* Default POSIX locale */
#include "cups_C.h"
NULL
};
@@ -118,20 +130,34 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */
void
cupsLangFlush(void)
{
int i; /* Looping var */
cups_lang_t *lang, /* Current language */
*next; /* Next language */
int i; /* Looping var */
cups_lang_t *lang, /* Current language */
*next; /* Next language */
/*
* Free all languages in the cache...
*/
for (lang = lang_cache; lang != NULL; lang = next)
{
/*
* Free all messages...
*/
for (i = 0; i < CUPS_MSG_MAX; i ++)
if (lang->messages[i] != NULL && lang->messages[i] != lang_blank)
free(lang->messages[i]);
/*
* Then free the language structure itself...
*/
next = lang->next;
free(lang);
}
lang_cache = NULL;
}
@@ -172,35 +198,35 @@ cupsLangGet(const char *language) /* I - Language or locale */
cups_lang_t *lang; /* Current language... */
const char *oldlocale; /* Old locale name */
static const char * const locale_encodings[] =
{ /* Locale charset names */
"ASCII",
"ISO8859-1",
"ISO8859-2",
"ISO8859-3",
"ISO8859-4",
"ISO8859-5",
"ISO8859-6",
"ISO8859-7",
"ISO8859-8",
"ISO8859-9",
"ISO8859-10",
"UTF-8",
"ISO8859-13",
"ISO8859-14",
"ISO8859-15",
"CP874",
"CP1250",
"CP1251",
"CP1252",
"CP1253",
"CP1254",
"CP1255",
"CP1256",
"CP1257",
"CP1258",
"KOI8R",
"KOI8U"
};
{ /* Locale charset names */
"ASCII",
"ISO8859-1",
"ISO8859-2",
"ISO8859-3",
"ISO8859-4",
"ISO8859-5",
"ISO8859-6",
"ISO8859-7",
"ISO8859-8",
"ISO8859-9",
"ISO8859-10",
"UTF-8",
"ISO8859-13",
"ISO8859-14",
"ISO8859-15",
"CP874",
"CP1250",
"CP1251",
"CP1252",
"CP1253",
"CP1254",
"CP1255",
"CP1256",
"CP1257",
"CP1258",
"KOI8R",
"KOI8U"
};
#ifdef __APPLE__
@@ -295,6 +321,16 @@ cupsLangGet(const char *language) /* I - Language or locale */
}
}
/*
* Restore the locale...
*/
#if defined(__APPLE__) || !defined(LC_CTYPE)
setlocale(LC_ALL, oldlocale);
#else
setlocale(LC_CTYPE, oldlocale);
#endif /* __APPLE__ || !LC_CTYPE */
/*
* Figure out the desired encoding...
*/
@@ -315,41 +351,41 @@ cupsLangGet(const char *language) /* I - Language or locale */
if ((localedir = getenv("LOCALEDIR")) == NULL)
localedir = CUPS_LOCALEDIR;
snprintf(filename, sizeof(filename), "%s/%s_%s/cups_%s_%s", localedir,
langname, country, langname, country);
if (!access(filename, 0))
snprintf(real, sizeof(real), "%s_%s", langname, country);
else
/*
* See if we already have this language/country loaded...
*/
snprintf(real, sizeof(real), "%s_%s", langname, country);
if ((lang = cups_cache_lookup(real, encoding)) != NULL)
return (lang);
snprintf(filename, sizeof(filename), "%s/%s/cups_%s", localedir, real, real);
if (access(filename, 0))
{
/*
* Country localization not available, look for generic localization...
*/
if ((lang = cups_cache_lookup(langname, encoding)) != NULL)
return (lang);
snprintf(filename, sizeof(filename), "%s/%s/cups_%s", localedir,
langname, langname);
if (!access(filename, 0))
strcpy(real, langname);
else
strcpy(real, "C");
}
/*
* Restore the locale...
*/
#if defined(__APPLE__) || !defined(LC_CTYPE)
setlocale(LC_ALL, oldlocale);
#else
setlocale(LC_CTYPE, oldlocale);
#endif /* __APPLE__ || !LC_CTYPE */
/*
* See if we already have this language loaded...
*/
for (lang = lang_cache; lang != NULL; lang = lang->next)
if (!strcmp(lang->language, real) == 0 && encoding == lang->encoding)
if (access(filename, 0))
{
lang->used ++;
/*
* No generic localization, so use POSIX...
*/
return (lang);
strcpy(real, "C");
snprintf(filename, sizeof(filename), "%s/C/cups_C", localedir);
}
else
strcpy(real, langname);
}
/*
* Open the messages file; the first line contains the default
@@ -369,7 +405,10 @@ cupsLangGet(const char *language) /* I - Language or locale */
* All leading whitespace is deleted.
*/
fp = fopen(filename, "r");
if (strcmp(real, "C"))
fp = fopen(filename, "r");
else
fp = NULL;
if (fp == NULL)
strlcpy(line, lang_default[0], sizeof(line));
@@ -614,7 +653,8 @@ appleLangDefault(void)
kCFPreferencesCurrentApplication);
if (localizationList != NULL &&
CFGetTypeID(localizationList) == CFArrayGetTypeID())
CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
CFArrayGetCount(localizationList) > 0)
{
localizationName = CFArrayGetValueAtIndex(localizationList, 0);
@@ -661,6 +701,34 @@ appleLangDefault(void)
#endif /* __APPLE__ */
/*
* 'cups_cache_lookup()' - Lookup a language in the cache...
*/
static cups_lang_t * /* O - Language data or NULL */
cups_cache_lookup(const char *name,/* I - Name of locale */
cups_encoding_t encoding)
/* I - Encoding of locale */
{
cups_lang_t *lang; /* Current language */
/*
* Loop through the cache and return a match if found...
*/
for (lang = lang_cache; lang != NULL; lang = lang->next)
if (!strcmp(lang->language, name) && encoding == lang->encoding)
{
lang->used ++;
return (lang);
}
return (NULL);
}
/*
* End of "$Id$".
*/
-1
Ver Arquivo
@@ -103,7 +103,6 @@ all: $(DOCUMENTS:.shtml=.pdf) $(DOCUMENTS:.shtml=.html) overview.pdf
#
ps: $(DOCUMENTS:.shtml=.ps) overview.ps
cd de; $(MAKE) $(MFLAGS) ps
cd fr; $(MAKE) $(MFLAGS) ps
+6 -3
Ver Arquivo
@@ -4185,9 +4185,9 @@ I [20/May/1999:19:22:24 +0000] Job 2 was cancelled by 'mike'.
printer. Each line contains the following information:</P>
<UL>
<PRE>
printer user job-id date-time page-number num-copies job-billing
printer user job-id date-time page-number num-copies job-billing hostname
DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 0 acme-123
DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 0 acme-123 localhost
</PRE>
</UL>
<P>The<I> printer</I> field contains the name of the printer that
@@ -4208,7 +4208,10 @@ requesting-user-name</CODE> attribute) that submitted this file for
will always be 1.</P>
<P>The<I> job-billing</I> field contains a copy of the <CODE>job-billing</CODE>
attribute provided with the IPP <CODE>create-job</CODE> or <CODE>
print-job</CODE> requests or &quot;-&quot; if none was provided.
print-job</CODE> requests or &quot;-&quot; if none was provided.</P>
<P>The<I> hostname</I> field contains the name of the host (the IPP <CODE>
job-originating-host-name</CODE> attribute) that originated the print
job.
<!-- NEW PAGE -->
</P>
<H2><A NAME="FILE_TYPING_FILTERING">File Typing and Filtering</A></H2>
BIN
Ver Arquivo
Arquivo binário não exibido.
+10 -4
Ver Arquivo
@@ -625,8 +625,10 @@ quotas:</P>
<UL>
<PRE>
<B>/usr/sbin/lpadmin -p <I>printer</I> -o job-quota-period=604800 -o job-k-limit=1024 <I>ENTER</I></B>
<B>/usr/sbin/lpadmin -p <I>printer</I> -o job-quota-period=604800 -o job-page-limit=100 <I>ENTER</I></B>
<B>/usr/sbin/lpadmin -p <I>printer</I> -o job-quota-period=604800 \
-o job-k-limit=1024 <I>ENTER</I></B>
<B>/usr/sbin/lpadmin -p <I>printer</I> -o job-quota-period=604800 \
-o job-page-limit=100 <I>ENTER</I></B>
</PRE>
</UL>
@@ -4491,9 +4493,9 @@ field in the <VAR>access_log</VAR> file.
Each line contains the following information:
<UL><PRE>
printer user job-id date-time page-number num-copies job-billing
printer user job-id date-time page-number num-copies job-billing hostname
DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 0 acme-123
DeskJet root 2 [20/May/1999:19:21:05 +0000] 1 0 acme-123 localhost
</PRE></UL>
<P>The <I>printer</I> field contains the name of the printer that
@@ -4521,6 +4523,10 @@ produce copies on their own, the <I>num-pages</I> field will always be 1.
<CODE>create-job</CODE> or <CODE>print-job</CODE> requests or "-" if none
was provided.
<P>The <I>hostname</I> field contains the name of the host (the
IPP <CODE>job-originating-host-name</CODE> attribute) that
originated the print job.
<!-- NEW PAGE -->
<H2><A NAME="FILE_TYPING_FILTERING">File Typing and Filtering</A></H2>
+5 -4
Ver Arquivo
@@ -1,5 +1,5 @@
.\"
.\" "$Id: lp.man 3152 2003-01-27 14:44:41Z mike $"
.\" "$Id: lp.man 3687 2003-05-01 18:40:05Z mike $"
.\"
.\" lp/cancel man page for the Common UNIX Printing System (CUPS).
.\"
@@ -21,7 +21,7 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lp 1 "Common UNIX Printing System" "24 January 2003" "Easy Software Products"
.TH lp 1 "Common UNIX Printing System" "1 May 2003" "Easy Software Products"
.SH NAME
lp \- print files
.br
@@ -80,7 +80,8 @@ cancel \- cancel jobs
.I destination-id
]
.SH DESCRIPTION
\fBlp\fR submits files for printing or alters a pending job.
\fBlp\fR submits files for printing or alters a pending job. Use
a filename of "-" to force printing from the standard input.
.LP
\fBcancel\fR cancels existing print jobs. The \fI-a\fR option will remove
all jobs from the specified destination.
@@ -176,5 +177,5 @@ http://localhost:631/documentation.html
.SH COPYRIGHT
Copyright 1993-2003 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lp.man 3152 2003-01-27 14:44:41Z mike $".
.\" End of "$Id: lp.man 3687 2003-05-01 18:40:05Z mike $".
.\"
+3 -3
Ver Arquivo
@@ -39,7 +39,7 @@ BuiltinFontWidths::~BuiltinFontWidths() {
gfree(tab);
}
GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) {
GBool BuiltinFontWidths::getWidth(const char *name, Gushort *width) {
int h;
BuiltinFontWidth *p;
@@ -53,8 +53,8 @@ GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) {
return gFalse;
}
int BuiltinFontWidths::hash(char *name) {
char *p;
int BuiltinFontWidths::hash(const char *name) {
const char *p;
unsigned int h;
h = 0;
+5 -5
Ver Arquivo
@@ -23,8 +23,8 @@ class BuiltinFontWidths;
//------------------------------------------------------------------------
struct BuiltinFont {
char *name;
char **defaultBaseEnc;
const char *name;
const char **defaultBaseEnc;
short ascent;
short descent;
short bbox[4];
@@ -34,7 +34,7 @@ struct BuiltinFont {
//------------------------------------------------------------------------
struct BuiltinFontWidth {
char *name;
const char *name;
Gushort width;
BuiltinFontWidth *next;
};
@@ -44,11 +44,11 @@ public:
BuiltinFontWidths(BuiltinFontWidth *widths, int sizeA);
~BuiltinFontWidths();
GBool getWidth(char *name, Gushort *width);
GBool getWidth(const char *name, Gushort *width);
private:
int hash(char *name);
int hash(const char *name);
BuiltinFontWidth **tab;
int size;
+2 -2
Ver Arquivo
@@ -154,7 +154,7 @@ CMap::CMap(GString *collectionA, GString *cMapNameA, int wModeA) {
refCnt = 1;
}
void CMap::useCMap(CMapCache *cache, char *useName) {
void CMap::useCMap(CMapCache *cache, const char *useName) {
GString *useNameStr;
CMap *subCMap;
@@ -279,7 +279,7 @@ GBool CMap::match(GString *collectionA, GString *cMapNameA) {
return !collection->cmp(collectionA) && !cMapName->cmp(cMapNameA);
}
CID CMap::getCID(char *s, int len, int *nUsed) {
CID CMap::getCID(const char *s, int len, int *nUsed) {
CMapVectorEntry *vec;
int n, i;
+2 -2
Ver Arquivo
@@ -47,7 +47,7 @@ public:
// Return the CID corresponding to the character code starting at
// <s>, which contains <len> bytes. Sets *<nUsed> to the number of
// bytes used by the char code.
CID getCID(char *s, int len, int *nUsed);
CID getCID(const char *s, int len, int *nUsed);
// Return the writing mode (0=horizontal, 1=vertical).
int getWMode() { return wMode; }
@@ -56,7 +56,7 @@ private:
CMap(GString *collectionA, GString *cMapNameA);
CMap(GString *collectionA, GString *cMapNameA, int wModeA);
void useCMap(CMapCache *cache, char *useName);
void useCMap(CMapCache *cache, const char *useName);
void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
Guint nBytes);
+1 -1
Ver Arquivo
@@ -9,7 +9,7 @@
#ifndef COMPACTFONTINFO_H
#define COMPACTFONTINFO_H
static char *type1CStdStrings[391] = {
static const char *type1CStdStrings[391] = {
".notdef",
"space",
"exclam",
+7 -7
Ver Arquivo
@@ -34,13 +34,13 @@ Dict::~Dict() {
int i;
for (i = 0; i < length; ++i) {
gfree(entries[i].key);
gfree((void *)entries[i].key);
entries[i].val.free();
}
gfree(entries);
}
void Dict::add(char *key, Object *val) {
void Dict::add(const char *key, Object *val) {
if (length + 1 > size) {
size += 8;
entries = (DictEntry *)grealloc(entries, size * sizeof(DictEntry));
@@ -50,7 +50,7 @@ void Dict::add(char *key, Object *val) {
++length;
}
inline DictEntry *Dict::find(char *key) {
inline DictEntry *Dict::find(const char *key) {
int i;
for (i = 0; i < length; ++i) {
@@ -60,25 +60,25 @@ inline DictEntry *Dict::find(char *key) {
return NULL;
}
GBool Dict::is(char *type) {
GBool Dict::is(const char *type) {
DictEntry *e;
return (e = find("Type")) && e->val.isName(type);
}
Object *Dict::lookup(char *key, Object *obj) {
Object *Dict::lookup(const char *key, Object *obj) {
DictEntry *e;
return (e = find(key)) ? e->val.fetch(xref, obj) : obj->initNull();
}
Object *Dict::lookupNF(char *key, Object *obj) {
Object *Dict::lookupNF(const char *key, Object *obj) {
DictEntry *e;
return (e = find(key)) ? e->val.copy(obj) : obj->initNull();
}
char *Dict::getKey(int i) {
const char *Dict::getKey(int i) {
return entries[i].key;
}
+7 -7
Ver Arquivo
@@ -22,7 +22,7 @@
//------------------------------------------------------------------------
struct DictEntry {
char *key;
const char *key;
Object val;
};
@@ -43,18 +43,18 @@ public:
int getLength() { return length; }
// Add an entry. NB: does not copy key.
void add(char *key, Object *val);
void add(const char *key, Object *val);
// Check if dictionary is of specified type.
GBool is(char *type);
GBool is(const char *type);
// Look up an entry and return the value. Returns a null object
// if <key> is not in the dictionary.
Object *lookup(char *key, Object *obj);
Object *lookupNF(char *key, Object *obj);
Object *lookup(const char *key, Object *obj);
Object *lookupNF(const char *key, Object *obj);
// Iterative accessors.
char *getKey(int i);
const char *getKey(int i);
Object *getVal(int i, Object *obj);
Object *getValNF(int i, Object *obj);
@@ -71,7 +71,7 @@ private:
int length; // number of entries in dictionary
int ref; // reference count
DictEntry *find(char *key);
DictEntry *find(const char *key);
};
#endif
+3 -3
Ver Arquivo
@@ -7,9 +7,9 @@
//========================================================================
static struct {
char *name;
char *xlfd;
char *encoding;
const char *name;
const char *xlfd;
const char *encoding;
} displayFontTab[] = {
{"Courier", "-*-courier-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", "Latin1"},
{"Courier-Bold", "-*-courier-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", "Latin1"},
+1 -1
Ver Arquivo
@@ -18,7 +18,7 @@
#include "GlobalParams.h"
#include "Error.h"
void CDECL error(int pos, char *msg, ...) {
void CDECL error(int pos, const char *msg, ...) {
va_list args;
// NB: this can be called before the globalParams object is created
+1 -1
Ver Arquivo
@@ -18,6 +18,6 @@
#include <stdio.h>
#include "config.h"
extern void CDECL error(int pos, char *msg, ...);
extern void CDECL error(int pos, const char *msg, ...);
#endif
+7 -7
Ver Arquivo
@@ -10,7 +10,7 @@
#include <stdlib.h>
#include "FontEncodingTables.h"
char *macRomanEncoding[256] = {
const char *macRomanEncoding[256] = {
NULL,
NULL,
NULL,
@@ -269,7 +269,7 @@ char *macRomanEncoding[256] = {
"caron"
};
char *macExpertEncoding[256] = {
const char *macExpertEncoding[256] = {
NULL,
NULL,
NULL,
@@ -528,7 +528,7 @@ char *macExpertEncoding[256] = {
NULL
};
char *winAnsiEncoding[256] = {
const char *winAnsiEncoding[256] = {
NULL,
NULL,
NULL,
@@ -787,7 +787,7 @@ char *winAnsiEncoding[256] = {
"ydieresis"
};
char *standardEncoding[256] = {
const char *standardEncoding[256] = {
NULL,
NULL,
NULL,
@@ -1046,7 +1046,7 @@ char *standardEncoding[256] = {
NULL
};
char *expertEncoding[256] = {
const char *expertEncoding[256] = {
NULL,
NULL,
NULL,
@@ -1305,7 +1305,7 @@ char *expertEncoding[256] = {
"Ydieresissmall"
};
char *symbolEncoding[256] = {
const char *symbolEncoding[256] = {
NULL,
NULL,
NULL,
@@ -1564,7 +1564,7 @@ char *symbolEncoding[256] = {
NULL
};
char *zapfDingbatsEncoding[256] = {
const char *zapfDingbatsEncoding[256] = {
NULL,
NULL,
NULL,
+7 -7
Ver Arquivo
@@ -9,12 +9,12 @@
#ifndef FONTENCODINGTABLES_H
#define FONTENCODINGTABLES_H
extern char *macRomanEncoding[];
extern char *macExpertEncoding[];
extern char *winAnsiEncoding[];
extern char *standardEncoding[];
extern char *expertEncoding[];
extern char *symbolEncoding[];
extern char *zapfDingbatsEncoding[];
extern const char *macRomanEncoding[];
extern const char *macExpertEncoding[];
extern const char *winAnsiEncoding[];
extern const char *standardEncoding[];
extern const char *expertEncoding[];
extern const char *symbolEncoding[];
extern const char *zapfDingbatsEncoding[];
#endif
+33 -32
Ver Arquivo
@@ -29,7 +29,7 @@
//------------------------------------------------------------------------
static inline char *nextLine(char *line, char *end) {
static inline const char *nextLine(const char *line, const char *end) {
while (line < end && *line != '\n' && *line != '\r')
++line;
while (line < end && *line == '\n' || *line == '\r')
@@ -37,7 +37,7 @@ static inline char *nextLine(char *line, char *end) {
return line;
}
static char hexChars[17] = "0123456789ABCDEF";
static const char hexChars[17] = "0123456789ABCDEF";
//------------------------------------------------------------------------
// FontFile
@@ -53,8 +53,9 @@ FontFile::~FontFile() {
// Type1FontFile
//------------------------------------------------------------------------
Type1FontFile::Type1FontFile(char *file, int len) {
char *line, *line1, *p, *p2;
Type1FontFile::Type1FontFile(const char *file, int len) {
const char *line, *line1;
char *p, *p2;
GBool haveEncoding;
char buf[256];
char c;
@@ -188,7 +189,7 @@ struct Type1CPrivateDict {
GBool nominalWidthXFP;
};
Type1CFontFile::Type1CFontFile(char *fileA, int lenA) {
Type1CFontFile::Type1CFontFile(const char *fileA, int lenA) {
Guchar *nameIdxPtr, *idxPtr0, *idxPtr1;
file = fileA;
@@ -228,15 +229,15 @@ Type1CFontFile::~Type1CFontFile() {
}
}
char *Type1CFontFile::getName() {
const char *Type1CFontFile::getName() {
return name->getCString();
}
char **Type1CFontFile::getEncoding() {
const char **Type1CFontFile::getEncoding() {
if (!encoding) {
readNameAndEncoding();
}
return encoding;
return (const char **)encoding;
}
void Type1CFontFile::readNameAndEncoding() {
@@ -595,7 +596,7 @@ void Type1CFontFile::convertToType1(FontFileOutputFunc outputFuncA,
}
}
void Type1CFontFile::convertToCIDType0(char *psName,
void Type1CFontFile::convertToCIDType0(const char *psName,
FontFileOutputFunc outputFuncA,
void *outputStreamA) {
Type1CTopDict dict;
@@ -883,7 +884,7 @@ void Type1CFontFile::convertToCIDType0(char *psName,
gfree(fdSelect);
}
void Type1CFontFile::convertToType0(char *psName,
void Type1CFontFile::convertToType0(const char *psName,
FontFileOutputFunc outputFuncA,
void *outputStreamA) {
Type1CTopDict dict;
@@ -1405,7 +1406,7 @@ Gushort *Type1CFontFile::readCharset(int charset, int nGlyphs) {
return glyphNames;
}
void Type1CFontFile::eexecWrite(char *s) {
void Type1CFontFile::eexecWrite(const char *s) {
Guchar *p;
Guchar x;
@@ -1422,7 +1423,7 @@ void Type1CFontFile::eexecWrite(char *s) {
}
}
void Type1CFontFile::eexecCvtGlyph(char *glyphName, Guchar *s, int n) {
void Type1CFontFile::eexecCvtGlyph(const char *glyphName, Guchar *s, int n) {
char eBuf[256];
cvtGlyph(s, n);
@@ -2098,7 +2099,7 @@ void Type1CFontFile::eexecWriteCharstring(Guchar *s, int n) {
}
}
void Type1CFontFile::getDeltaInt(char *buf, char *key, double *opA,
void Type1CFontFile::getDeltaInt(char *buf, const char *key, double *opA,
int n) {
int x, i;
@@ -2113,7 +2114,7 @@ void Type1CFontFile::getDeltaInt(char *buf, char *key, double *opA,
sprintf(buf, "] def\n");
}
void Type1CFontFile::getDeltaReal(char *buf, char *key, double *opA,
void Type1CFontFile::getDeltaReal(char *buf, const char *key, double *opA,
int n) {
double x;
int i;
@@ -2318,7 +2319,7 @@ struct TTFontTableHdr {
};
struct T42Table {
char *tag; // 4-byte tag
const char *tag; // 4-byte tag
GBool required; // required by the TrueType spec?
};
@@ -2344,7 +2345,7 @@ static T42Table t42Tables[nT42Tables] = {
// Glyph names in some arbitrary standard that Apple uses for their
// TrueType fonts.
static char *macGlyphNames[258] = {
static const char *macGlyphNames[258] = {
".notdef",
"null",
"CR",
@@ -2618,7 +2619,7 @@ struct TrueTypeLoca {
int length;
};
TrueTypeFontFile::TrueTypeFontFile(char *fileA, int lenA) {
TrueTypeFontFile::TrueTypeFontFile(const char *fileA, int lenA) {
int pos, i, idx, n, length;
Guint size, startPos, endPos;
@@ -2704,11 +2705,11 @@ TrueTypeFontFile::~TrueTypeFontFile() {
gfree(tableHdrs);
}
char *TrueTypeFontFile::getName() {
const char *TrueTypeFontFile::getName() {
return NULL;
}
char **TrueTypeFontFile::getEncoding() {
const char **TrueTypeFontFile::getEncoding() {
int cmap[256];
int nCmaps, cmapPlatform, cmapEncoding, cmapFmt;
int cmapLen, cmapOffset, cmapFirst;
@@ -2719,7 +2720,7 @@ char **TrueTypeFontFile::getEncoding() {
int stringIdx, stringPos, n;
if (encoding) {
return encoding;
return (const char **)encoding;
}
//----- construct the (char code) -> (glyph idx) mapping
@@ -2877,10 +2878,10 @@ char **TrueTypeFontFile::getEncoding() {
}
}
return encoding;
return (const char **)encoding;
}
void TrueTypeFontFile::convertToType42(char *name, char **encodingA,
void TrueTypeFontFile::convertToType42(const char *name, const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
@@ -2913,7 +2914,7 @@ void TrueTypeFontFile::convertToType42(char *name, char **encodingA,
(*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40);
}
void TrueTypeFontFile::convertToCIDType2(char *name, Gushort *cidMap,
void TrueTypeFontFile::convertToCIDType2(const char *name, Gushort *cidMap,
int nCIDs,
FontFileOutputFunc outputFunc,
void *outputStream) {
@@ -3021,7 +3022,7 @@ void TrueTypeFontFile::convertToCIDType2(char *name, Gushort *cidMap,
56);
}
void TrueTypeFontFile::convertToType0(char *name, Gushort *cidMap,
void TrueTypeFontFile::convertToType0(const char *name, Gushort *cidMap,
int nCIDs,
FontFileOutputFunc outputFunc,
void *outputStream) {
@@ -3157,7 +3158,7 @@ double TrueTypeFontFile::getFixed(int pos) {
return (double)x + (double)y / 65536;
}
int TrueTypeFontFile::seekTable(char *tag) {
int TrueTypeFontFile::seekTable(const char *tag) {
int i;
for (i = 0; i < nTables; ++i) {
@@ -3168,7 +3169,7 @@ int TrueTypeFontFile::seekTable(char *tag) {
return -1;
}
int TrueTypeFontFile::seekTableIdx(char *tag) {
int TrueTypeFontFile::seekTableIdx(const char *tag) {
int i;
for (i = 0; i < nTables; ++i) {
@@ -3179,10 +3180,10 @@ int TrueTypeFontFile::seekTableIdx(char *tag) {
return -1;
}
void TrueTypeFontFile::cvtEncoding(char **encodingA, GBool pdfFontHasEncoding,
void TrueTypeFontFile::cvtEncoding(const char **encodingA, GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
void *outputStream) {
char *name;
const char *name;
char buf[64];
int i;
@@ -3206,7 +3207,7 @@ void TrueTypeFontFile::cvtEncoding(char **encodingA, GBool pdfFontHasEncoding,
(*outputFunc)(outputStream, "readonly def\n", 13);
}
void TrueTypeFontFile::cvtCharStrings(char **encodingA,
void TrueTypeFontFile::cvtCharStrings(const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
@@ -3214,7 +3215,7 @@ void TrueTypeFontFile::cvtCharStrings(char **encodingA,
int unicodeCmap, macRomanCmap, msSymbolCmap;
int nCmaps, cmapPlatform, cmapEncoding, cmapFmt, cmapOffset;
T42FontIndexMode mode;
char *name;
const char *name;
char buf[64], buf2[16];
Unicode u;
int pos, i, j, k;
@@ -3607,7 +3608,7 @@ void TrueTypeFontFile::cvtSfnts(FontFileOutputFunc outputFunc,
gfree(locaTable);
}
void TrueTypeFontFile::dumpString(char *s, int length,
void TrueTypeFontFile::dumpString(const char *s, int length,
FontFileOutputFunc outputFunc,
void *outputStream) {
char buf[64];
@@ -3635,7 +3636,7 @@ void TrueTypeFontFile::dumpString(char *s, int length,
(*outputFunc)(outputStream, "00>\n", 4);
}
Guint TrueTypeFontFile::computeTableChecksum(char *data, int length) {
Guint TrueTypeFontFile::computeTableChecksum(const char *data, int length) {
Guint checksum, word;
int i;
+29 -29
Ver Arquivo
@@ -24,7 +24,7 @@ class CharCodeToUnicode;
//------------------------------------------------------------------------
typedef void (*FontFileOutputFunc)(void *stream, char *data, int len);
typedef void (*FontFileOutputFunc)(void *stream, const char *data, int len);
//------------------------------------------------------------------------
// FontFile
@@ -38,11 +38,11 @@ public:
// Returns the font name, as specified internally by the font file.
// Returns NULL if no name is available.
virtual char *getName() = 0;
virtual const char *getName() = 0;
// Returns the custom font encoding, or NULL if the encoding is not
// available.
virtual char **getEncoding() = 0;
virtual const char **getEncoding() = 0;
};
//------------------------------------------------------------------------
@@ -52,10 +52,10 @@ public:
class Type1FontFile: public FontFile {
public:
Type1FontFile(char *file, int len);
Type1FontFile(const char *file, int len);
virtual ~Type1FontFile();
virtual char *getName() { return name; }
virtual char **getEncoding() { return encoding; }
virtual const char *getName() { return name; }
virtual const char **getEncoding() { return (const char **)encoding; }
private:
@@ -73,11 +73,11 @@ struct Type1CPrivateDict;
class Type1CFontFile: public FontFile {
public:
Type1CFontFile(char *fileA, int lenA);
Type1CFontFile(const char *fileA, int lenA);
virtual ~Type1CFontFile();
virtual char *getName();
virtual char **getEncoding();
virtual const char *getName();
virtual const char **getEncoding();
// Convert to a Type 1 font, suitable for embedding in a PostScript
// file. The name will be used as the PostScript font name.
@@ -86,13 +86,13 @@ public:
// Convert to a Type 0 CIDFont, suitable for embedding in a
// PostScript file. The name will be used as the PostScript font
// name.
void convertToCIDType0(char *psName,
void convertToCIDType0(const char *psName,
FontFileOutputFunc outputFuncA, void *outputStreamA);
// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. The name will be used as the
// PostScript font name.
void convertToType0(char *psName,
void convertToType0(const char *psName,
FontFileOutputFunc outputFuncA, void *outputStreamA);
private:
@@ -102,16 +102,16 @@ private:
void readPrivateDict(Type1CPrivateDict *privateDict,
int offset, int size);
Gushort *readCharset(int charset, int nGlyphs);
void eexecWrite(char *s);
void eexecCvtGlyph(char *glyphName, Guchar *s, int n);
void eexecWrite(const char *s);
void eexecCvtGlyph(const char *glyphName, Guchar *s, int n);
void cvtGlyph(Guchar *s, int n);
void cvtGlyphWidth(GBool useOp);
void eexecDumpNum(double x, GBool fpA);
void eexecDumpOp1(int opA);
void eexecDumpOp2(int opA);
void eexecWriteCharstring(Guchar *s, int n);
void getDeltaInt(char *buf, char *key, double *opA, int n);
void getDeltaReal(char *buf, char *key, double *opA, int n);
void getDeltaInt(char *buf, const char *key, double *opA, int n);
void getDeltaReal(char *buf, const char *key, double *opA, int n);
int getIndexLen(Guchar *indexPtr);
Guchar *getIndexValPtr(Guchar *indexPtr, int i);
Guchar *getIndexEnd(Guchar *indexPtr);
@@ -119,7 +119,7 @@ private:
double getNum(Guchar **ptr, GBool *fp);
char *getString(int sid, char *buf);
char *file;
const char *file;
int len;
GString *name;
@@ -153,22 +153,22 @@ struct TTFontTableHdr;
class TrueTypeFontFile: public FontFile {
public:
TrueTypeFontFile(char *fileA, int lenA);
TrueTypeFontFile(const char *fileA, int lenA);
~TrueTypeFontFile();
// This always returns NULL, since it's probably better to trust the
// font name in the PDF file rather than the one in the TrueType
// font file.
virtual char *getName();
virtual const char *getName();
virtual char **getEncoding();
virtual const char **getEncoding();
// Convert to a Type 42 font, suitable for embedding in a PostScript
// file. The name will be used as the PostScript font name (so we
// don't need to depend on the 'name' table in the font). The
// encoding is needed because the PDF Font object can modify the
// encoding.
void convertToType42(char *name, char **encodingA,
void convertToType42(const char *name, const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
@@ -177,14 +177,14 @@ public:
// PostScript file. The name will be used as the PostScript font
// name (so we don't need to depend on the 'name' table in the
// font).
void convertToCIDType2(char *name, Gushort *cidMap, int nCIDs,
void convertToCIDType2(const char *name, Gushort *cidMap, int nCIDs,
FontFileOutputFunc outputFunc, void *outputStream);
// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. The name will be used as the
// PostScript font name (so we don't need to depend on the 'name'
// table in the font).
void convertToType0(char *name, Gushort *cidMap, int nCIDs,
void convertToType0(const char *name, Gushort *cidMap, int nCIDs,
FontFileOutputFunc outputFunc, void *outputStream);
// Write a TTF file, filling in any missing tables that are required
@@ -194,7 +194,7 @@ public:
private:
char *file;
const char *file;
int len;
char **encoding;
@@ -212,19 +212,19 @@ private:
int getShort(int pos);
Guint getULong(int pos);
double getFixed(int pos);
int seekTable(char *tag);
int seekTableIdx(char *tag);
void cvtEncoding(char **encodingA, GBool pdfFontHasEncoding,
int seekTable(const char *tag);
int seekTableIdx(const char *tag);
void cvtEncoding(const char **encodingA, GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
void cvtCharStrings(char **encodingA, CharCodeToUnicode *toUnicode,
void cvtCharStrings(const char **encodingA, CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
int getCmapEntry(int cmapFmt, int pos, int code);
void cvtSfnts(FontFileOutputFunc outputFunc, void *outputStream,
GString *name);
void dumpString(char *s, int length,
void dumpString(const char *s, int length,
FontFileOutputFunc outputFunc, void *outputStream);
Guint computeTableChecksum(char *data, int length);
Guint computeTableChecksum(const char *data, int length);
};
#endif
+1 -1
Ver Arquivo
@@ -720,7 +720,7 @@ enum PSOp {
// Note: 'if' and 'ifelse' are parsed separately.
// The rest are listed here in alphabetical order.
// The index in this table is equivalent to the entry in PSOp.
char *psOpNames[] = {
const char *psOpNames[] = {
"abs",
"add",
"and",
+13 -13
Ver Arquivo
@@ -31,8 +31,8 @@
//------------------------------------------------------------------------
struct StdFontMapEntry {
char *altName;
char *properName;
const char *altName;
const char *properName;
};
static StdFontMapEntry stdFontMap[] = {
@@ -90,7 +90,7 @@ static StdFontMapEntry stdFontMap[] = {
// GfxFont
//------------------------------------------------------------------------
GfxFont *GfxFont::makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict) {
GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict) {
GString *nameA;
GfxFont *font;
Object obj1;
@@ -126,7 +126,7 @@ GfxFont *GfxFont::makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict) {
return font;
}
GfxFont::GfxFont(char *tagA, Ref idA, GString *nameA) {
GfxFont::GfxFont(const char *tagA, Ref idA, GString *nameA) {
ok = gFalse;
tag = new GString(tagA);
id = idA;
@@ -373,18 +373,18 @@ char *GfxFont::readEmbFontFile(XRef *xref, int *len) {
// Gfx8BitFont
//------------------------------------------------------------------------
Gfx8BitFont::Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Dict *fontDict):
GfxFont(tagA, idA, nameA)
{
BuiltinFont *builtinFont;
char **baseEnc;
const char **baseEnc;
GBool baseEncFromFontFile;
char *buf;
int len;
FontFile *fontFile;
int code, code2;
char *charName;
const char *charName;
GBool missing, hex;
Unicode toUnicode[256];
double mul;
@@ -601,7 +601,7 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
} else if (obj3.isName()) {
if (code < 256) {
if (encFree[code]) {
gfree(enc[code]);
gfree((void *)enc[code]);
}
enc[code] = copyString(obj3.getName());
encFree[code] = gTrue;
@@ -777,7 +777,7 @@ Gfx8BitFont::~Gfx8BitFont() {
for (i = 0; i < 256; ++i) {
if (encFree[i] && enc[i]) {
gfree(enc[i]);
gfree((void *)enc[i]);
}
}
ctu->decRefCnt();
@@ -789,7 +789,7 @@ Gfx8BitFont::~Gfx8BitFont() {
}
}
int Gfx8BitFont::getNextChar(char *s, int len, CharCode *code,
int Gfx8BitFont::getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) {
CharCode c;
@@ -837,7 +837,7 @@ static int cmpWidthExcepV(const void *w1, const void *w2) {
((GfxFontCIDWidthExcepV *)w2)->first;
}
GfxCIDFont::GfxCIDFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
Dict *fontDict):
GfxFont(tagA, idA, nameA)
{
@@ -1153,7 +1153,7 @@ GfxCIDFont::~GfxCIDFont() {
}
}
int GfxCIDFont::getNextChar(char *s, int len, CharCode *code,
int GfxCIDFont::getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) {
CID cid;
@@ -1292,7 +1292,7 @@ GfxFontDict::~GfxFontDict() {
gfree(fonts);
}
GfxFont *GfxFontDict::lookup(char *tag) {
GfxFont *GfxFontDict::lookup(const char *tag) {
int i;
for (i = 0; i < numFonts; ++i) {
+12 -12
Ver Arquivo
@@ -84,9 +84,9 @@ class GfxFont {
public:
// Build a GfxFont object.
static GfxFont *makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict);
static GfxFont *makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict);
GfxFont(char *tagA, Ref idA, GString *nameA);
GfxFont(const char *tagA, Ref idA, GString *nameA);
virtual ~GfxFont();
@@ -99,7 +99,7 @@ public:
Ref *getID() { return &id; }
// Does this font match the tag?
GBool matches(char *tagA) { return !tag->cmp(tagA); }
GBool matches(const char *tagA) { return !tag->cmp(tagA); }
// Get base font name.
GString *getName() { return name; }
@@ -151,7 +151,7 @@ public:
// is the number of entries available in <u>, and <uLen> is set to
// the number actually used. Returns the number of bytes used by
// the char code.
virtual int getNextChar(char *s, int len, CharCode *code,
virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) = 0;
@@ -184,23 +184,23 @@ protected:
class Gfx8BitFont: public GfxFont {
public:
Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Dict *fontDict);
virtual ~Gfx8BitFont();
virtual int getNextChar(char *s, int len, CharCode *code,
virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy);
// Return the encoding.
char **getEncoding() { return enc; }
const char **getEncoding() { return enc; }
// Return the Unicode map.
CharCodeToUnicode *getToUnicode();
// Return the character name associated with <code>.
char *getCharName(int code) { return enc[code]; }
const char *getCharName(int code) { return enc[code]; }
// Returns true if the PDF font specified an encoding.
GBool getHasEncoding() { return hasEncoding; }
@@ -219,7 +219,7 @@ public:
private:
char *enc[256]; // char code --> char name
const char *enc[256]; // char code --> char name
char encFree[256]; // boolean for each char name: if set,
// the string is malloc'ed
CharCodeToUnicode *ctu; // char code --> Unicode
@@ -236,14 +236,14 @@ private:
class GfxCIDFont: public GfxFont {
public:
GfxCIDFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
Dict *fontDict);
virtual ~GfxCIDFont();
virtual GBool isCIDFont() { return gTrue; }
virtual int getNextChar(char *s, int len, CharCode *code,
virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy);
@@ -285,7 +285,7 @@ public:
~GfxFontDict();
// Get the specified font.
GfxFont *lookup(char *tag);
GfxFont *lookup(const char *tag);
// Iterative access.
int getNumFonts() { return numFonts; }
+2 -2
Ver Arquivo
@@ -30,7 +30,7 @@ static inline double clip01(double x) {
//------------------------------------------------------------------------
static char *gfxColorSpaceModeNames[] = {
static const char *gfxColorSpaceModeNames[] = {
"DeviceGray",
"CalGray",
"DeviceRGB",
@@ -121,7 +121,7 @@ int GfxColorSpace::getNumColorSpaceModes() {
return nGfxColorSpaceModes;
}
char *GfxColorSpace::getColorSpaceModeName(int idx) {
const char *GfxColorSpace::getColorSpaceModeName(int idx) {
return gfxColorSpaceModeNames[idx];
}
+1 -1
Ver Arquivo
@@ -97,7 +97,7 @@ public:
static int getNumColorSpaceModes();
// Return the name of the <idx>th color space mode.
static char *getColorSpaceModeName(int idx);
static const char *getColorSpaceModeName(int idx);
private:
};
+18 -18
Ver Arquivo
@@ -70,7 +70,7 @@ DisplayFontParam::DisplayFontParam(GString *nameA,
}
}
DisplayFontParam::DisplayFontParam(char *nameA, char *xlfdA, char *encodingA) {
DisplayFontParam::DisplayFontParam(const char *nameA, const char *xlfdA, const char *encodingA) {
name = new GString(nameA);
kind = displayFontX;
x.xlfd = new GString(xlfdA);
@@ -125,7 +125,7 @@ PSFontParam::~PSFontParam() {
// parsing
//------------------------------------------------------------------------
GlobalParams::GlobalParams(char *cfgFileName) {
GlobalParams::GlobalParams(const char *cfgFileName) {
UnicodeMap *map;
DisplayFontParam *dfp;
GString *fileName;
@@ -157,7 +157,7 @@ GlobalParams::GlobalParams(char *cfgFileName) {
displayCIDFonts = new GHash();
displayNamedCIDFonts = new GHash();
#if HAVE_PAPER_H
char *paperName;
const char *paperName;
const struct paper *paperType;
paperinit();
if ((paperName = systempapername())) {
@@ -644,7 +644,7 @@ void GlobalParams::parsePSFont(GList *tokens, GString *fileName, int line) {
psFonts->add(param->pdfFontName, param);
}
void GlobalParams::parsePSFont16(char *cmdName, GList *fontList,
void GlobalParams::parsePSFont16(const char *cmdName, GList *fontList,
GList *tokens, GString *fileName, int line) {
PSFontParam *param;
int wMode;
@@ -724,7 +724,7 @@ void GlobalParams::parseInitialZoom(GList *tokens,
initialZoom = ((GString *)tokens->get(1))->copy();
}
void GlobalParams::parseFontRastControl(char *cmdName, FontRastControl *val,
void GlobalParams::parseFontRastControl(const char *cmdName, FontRastControl *val,
GList *tokens, GString *fileName,
int line) {
GString *tok;
@@ -741,7 +741,7 @@ void GlobalParams::parseFontRastControl(char *cmdName, FontRastControl *val,
}
}
void GlobalParams::parseCommand(char *cmdName, GString **val,
void GlobalParams::parseCommand(const char *cmdName, GString **val,
GList *tokens, GString *fileName, int line) {
if (tokens->getLength() != 2) {
error(-1, "Bad '%s' config file command (%s:%d)",
@@ -754,7 +754,7 @@ void GlobalParams::parseCommand(char *cmdName, GString **val,
*val = ((GString *)tokens->get(1))->copy();
}
void GlobalParams::parseYesNo(char *cmdName, GBool *flag,
void GlobalParams::parseYesNo(const char *cmdName, GBool *flag,
GList *tokens, GString *fileName, int line) {
GString *tok;
@@ -826,11 +826,11 @@ GlobalParams::~GlobalParams() {
// accessors
//------------------------------------------------------------------------
CharCode GlobalParams::getMacRomanCharCode(char *charName) {
CharCode GlobalParams::getMacRomanCharCode(const char *charName) {
return macRomanReverseMap->lookup(charName);
}
Unicode GlobalParams::mapNameToUnicode(char *charName) {
Unicode GlobalParams::mapNameToUnicode(const char *charName) {
return nameToUnicode->lookup(charName);
}
@@ -1076,7 +1076,7 @@ GBool GlobalParams::getTextKeepTinyChars() {
}
GString *GlobalParams::findFontFile(GString *fontName,
char *ext1, char *ext2) {
const char *ext1, const char *ext2) {
GString *dir, *fileName;
FILE *f;
int i;
@@ -1221,7 +1221,7 @@ void GlobalParams::addDisplayFont(DisplayFontParam *param) {
globalParamsUnlock;
}
void GlobalParams::setPSFile(char *file) {
void GlobalParams::setPSFile(const char *file) {
globalParamsLock;
if (psFile) {
delete psFile;
@@ -1239,7 +1239,7 @@ void GlobalParams::setPSImageableArea(int left, int bottom, int right, int top)
globalParamsUnlock;
}
GBool GlobalParams::setPSPaperSize(char *size) {
GBool GlobalParams::setPSPaperSize(const char *size) {
globalParamsLock;
if (!strcmp(size, "letter")) {
psPaperWidth = 612;
@@ -1332,14 +1332,14 @@ void GlobalParams::setPSASCIIHex(GBool hex) {
globalParamsUnlock;
}
void GlobalParams::setTextEncoding(char *encodingName) {
void GlobalParams::setTextEncoding(const char *encodingName) {
globalParamsLock;
delete textEncoding;
textEncoding = new GString(encodingName);
globalParamsUnlock;
}
GBool GlobalParams::setTextEOL(char *s) {
GBool GlobalParams::setTextEOL(const char *s) {
globalParamsLock;
if (!strcmp(s, "unix")) {
textEOL = eolUnix;
@@ -1361,14 +1361,14 @@ void GlobalParams::setTextKeepTinyChars(GBool keep) {
globalParamsUnlock;
}
void GlobalParams::setInitialZoom(char *s) {
void GlobalParams::setInitialZoom(const char *s) {
globalParamsLock;
delete initialZoom;
initialZoom = new GString(s);
globalParamsUnlock;
}
GBool GlobalParams::setT1libControl(char *s) {
GBool GlobalParams::setT1libControl(const char *s) {
GBool ok;
globalParamsLock;
@@ -1377,7 +1377,7 @@ GBool GlobalParams::setT1libControl(char *s) {
return ok;
}
GBool GlobalParams::setFreeTypeControl(char *s) {
GBool GlobalParams::setFreeTypeControl(const char *s) {
GBool ok;
globalParamsLock;
@@ -1386,7 +1386,7 @@ GBool GlobalParams::setFreeTypeControl(char *s) {
return ok;
}
GBool GlobalParams::setFontRastControl(FontRastControl *val, char *s) {
GBool GlobalParams::setFontRastControl(FontRastControl *val, const char *s) {
if (!strcmp(s, "none")) {
*val = fontRastNone;
} else if (!strcmp(s, "plain")) {
+17 -17
Ver Arquivo
@@ -69,7 +69,7 @@ public:
};
DisplayFontParam(GString *nameA, DisplayFontParamKind kindA);
DisplayFontParam(char *nameA, char *xlfdA, char *encodingA);
DisplayFontParam(const char *nameA, const char *xlfdA, const char *encodingA);
~DisplayFontParam();
};
@@ -125,15 +125,15 @@ public:
// Initialize the global parameters by attempting to read a config
// file.
GlobalParams(char *cfgFileName);
GlobalParams(const char *cfgFileName);
~GlobalParams();
//----- accessors
CharCode getMacRomanCharCode(char *charName);
CharCode getMacRomanCharCode(const char *charName);
Unicode mapNameToUnicode(char *charName);
Unicode mapNameToUnicode(const char *charName);
FILE *getCIDToUnicodeFile(GString *collection);
UnicodeMap *getResidentUnicodeMap(GString *encodingName);
FILE *getUnicodeMapFile(GString *encodingName);
@@ -157,7 +157,7 @@ public:
GBool getPSASCIIHex();
EndOfLineKind getTextEOL();
GBool getTextKeepTinyChars();
GString *findFontFile(GString *fontName, char *ext1, char *ext2);
GString *findFontFile(GString *fontName, const char *ext1, const char *ext2);
GString *getInitialZoom();
FontRastControl getT1libControl();
FontRastControl getFreeTypeControl();
@@ -175,8 +175,8 @@ public:
//----- functions to set parameters
void addDisplayFont(DisplayFontParam *param);
void setPSFile(char *file);
GBool setPSPaperSize(char *size);
void setPSFile(const char *file);
GBool setPSPaperSize(const char *size);
void setPSImageableArea(int left, int bottom, int right, int top);
void setPSPaperWidth(int width);
void setPSPaperHeight(int height);
@@ -188,12 +188,12 @@ public:
void setPSEmbedCIDTrueType(GBool embed);
void setPSOPI(GBool opi);
void setPSASCIIHex(GBool hex);
void setTextEncoding(char *encodingName);
GBool setTextEOL(char *s);
void setTextEncoding(const char *encodingName);
GBool setTextEOL(const char *s);
void setTextKeepTinyChars(GBool keep);
void setInitialZoom(char *s);
GBool setT1libControl(char *s);
GBool setFreeTypeControl(char *s);
void setInitialZoom(const char *s);
GBool setT1libControl(const char *s);
GBool setFreeTypeControl(const char *s);
void setMapNumericCharNames(GBool map);
void setPrintCommands(GBool printCommandsA);
void setErrQuiet(GBool errQuietA);
@@ -213,20 +213,20 @@ private:
void parsePSPaperSize(GList *tokens, GString *fileName, int line);
void parsePSLevel(GList *tokens, GString *fileName, int line);
void parsePSFont(GList *tokens, GString *fileName, int line);
void parsePSFont16(char *cmdName, GList *fontList,
void parsePSFont16(const char *cmdName, GList *fontList,
GList *tokens, GString *fileName, int line);
void parseTextEncoding(GList *tokens, GString *fileName, int line);
void parseTextEOL(GList *tokens, GString *fileName, int line);
void parseFontDir(GList *tokens, GString *fileName, int line);
void parseInitialZoom(GList *tokens, GString *fileName, int line);
void parseFontRastControl(char *cmdName, FontRastControl *val,
void parseFontRastControl(const char *cmdName, FontRastControl *val,
GList *tokens, GString *fileName, int line);
void parseCommand(char *cmdName, GString **val,
void parseCommand(const char *cmdName, GString **val,
GList *tokens, GString *fileName, int line);
void parseYesNo(char *cmdName, GBool *flag,
void parseYesNo(const char *cmdName, GBool *flag,
GList *tokens, GString *fileName, int line);
UnicodeMap *getUnicodeMap2(GString *encodingName);
GBool setFontRastControl(FontRastControl *val, char *s);
GBool setFontRastControl(FontRastControl *val, const char *s);
//----- static tables
+1 -1
Ver Arquivo
@@ -1452,7 +1452,7 @@ int JBIG2Stream::lookChar() {
return EOF;
}
GString *JBIG2Stream::getPSFilter(char *indent) {
GString *JBIG2Stream::getPSFilter(const char *indent) {
return NULL;
}
+1 -1
Ver Arquivo
@@ -39,7 +39,7 @@ public:
virtual void reset();
virtual int getChar();
virtual int lookChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
+4 -4
Ver Arquivo
@@ -47,7 +47,7 @@ NameToCharCode::~NameToCharCode() {
gfree(tab);
}
void NameToCharCode::add(char *name, CharCode c) {
void NameToCharCode::add(const char *name, CharCode c) {
NameToCharCodeEntry *oldTab;
int h, i, oldSize;
@@ -89,7 +89,7 @@ void NameToCharCode::add(char *name, CharCode c) {
++len;
}
CharCode NameToCharCode::lookup(char *name) {
CharCode NameToCharCode::lookup(const char *name) {
int h;
h = hash(name);
@@ -104,8 +104,8 @@ CharCode NameToCharCode::lookup(char *name) {
return 0;
}
int NameToCharCode::hash(char *name) {
char *p;
int NameToCharCode::hash(const char *name) {
const char *p;
unsigned int h;
h = 0;
+3 -3
Ver Arquivo
@@ -27,12 +27,12 @@ public:
NameToCharCode();
~NameToCharCode();
void add(char *name, CharCode c);
CharCode lookup(char *name);
void add(const char *name, CharCode c);
CharCode lookup(const char *name);
private:
int hash(char *name);
int hash(const char *name);
NameToCharCodeEntry *tab;
int size;
+1 -1
Ver Arquivo
@@ -8,7 +8,7 @@
static struct {
Unicode u;
char *name;
const char *name;
} nameToUnicodeTab[] = {
{0x0021, "!"},
{0x0023, "#"},
+2 -2
Ver Arquivo
@@ -24,7 +24,7 @@
// Object
//------------------------------------------------------------------------
char *objTypeNames[numObjTypes] = {
const char *objTypeNames[numObjTypes] = {
"boolean",
"integer",
"real",
@@ -134,7 +134,7 @@ void Object::free() {
type = objNone;
}
char *Object::getTypeName() {
const char *Object::getTypeName() {
return objTypeNames[type];
}
+21 -21
Ver Arquivo
@@ -89,7 +89,7 @@ public:
{ initObj(objReal); real = realA; return this; }
Object *initString(GString *stringA)
{ initObj(objString); string = stringA; return this; }
Object *initName(char *nameA)
Object *initName(const char *nameA)
{ initObj(objName); name = copyString(nameA); return this; }
Object *initNull()
{ initObj(objNull); return this; }
@@ -98,7 +98,7 @@ public:
Object *initStream(Stream *streamA);
Object *initRef(int numA, int genA)
{ initObj(objRef); ref.num = numA; ref.gen = genA; return this; }
Object *initCmd(char *cmdA)
Object *initCmd(const char *cmdA)
{ initObj(objCmd); cmd = copyString(cmdA); return this; }
Object *initError()
{ initObj(objError); return this; }
@@ -134,11 +134,11 @@ public:
GBool isNone() { return type == objNone; }
// Special type checking.
GBool isName(char *nameA)
GBool isName(const char *nameA)
{ return type == objName && !strcmp(name, nameA); }
GBool isDict(char *dictType);
GBool isStream(char *dictType);
GBool isCmd(char *cmdA)
GBool isDict(const char *dictType);
GBool isStream(const char *dictType);
GBool isCmd(const char *cmdA)
{ return type == objCmd && !strcmp(cmd, cmdA); }
// Accessors. NB: these assume object is of correct type.
@@ -164,16 +164,16 @@ public:
// Dict accessors.
int dictGetLength();
void dictAdd(char *key, Object *val);
GBool dictIs(char *dictType);
Object *dictLookup(char *key, Object *obj);
Object *dictLookupNF(char *key, Object *obj);
char *dictGetKey(int i);
void dictAdd(const char *key, Object *val);
GBool dictIs(const char *dictType);
Object *dictLookup(const char *key, Object *obj);
Object *dictLookupNF(const char *key, Object *obj);
const char *dictGetKey(int i);
Object *dictGetVal(int i, Object *obj);
Object *dictGetValNF(int i, Object *obj);
// Stream accessors.
GBool streamIs(char *dictType);
GBool streamIs(const char *dictType);
void streamReset();
void streamClose();
int streamGetChar();
@@ -184,7 +184,7 @@ public:
Dict *streamGetDict();
// Output.
char *getTypeName();
const char *getTypeName();
void print(FILE *f = stdout);
// Memory testing.
@@ -239,22 +239,22 @@ inline Object *Object::arrayGetNF(int i, Object *obj)
inline int Object::dictGetLength()
{ return dict->getLength(); }
inline void Object::dictAdd(char *key, Object *val)
inline void Object::dictAdd(const char *key, Object *val)
{ dict->add(key, val); }
inline GBool Object::dictIs(char *dictType)
inline GBool Object::dictIs(const char *dictType)
{ return dict->is(dictType); }
inline GBool Object::isDict(char *dictType)
inline GBool Object::isDict(const char *dictType)
{ return type == objDict && dictIs(dictType); }
inline Object *Object::dictLookup(char *key, Object *obj)
inline Object *Object::dictLookup(const char *key, Object *obj)
{ return dict->lookup(key, obj); }
inline Object *Object::dictLookupNF(char *key, Object *obj)
inline Object *Object::dictLookupNF(const char *key, Object *obj)
{ return dict->lookupNF(key, obj); }
inline char *Object::dictGetKey(int i)
inline const char *Object::dictGetKey(int i)
{ return dict->getKey(i); }
inline Object *Object::dictGetVal(int i, Object *obj)
@@ -269,10 +269,10 @@ inline Object *Object::dictGetValNF(int i, Object *obj)
#include "Stream.h"
inline GBool Object::streamIs(char *dictType)
inline GBool Object::streamIs(const char *dictType)
{ return stream->getDict()->is(dictType); }
inline GBool Object::isStream(char *dictType)
inline GBool Object::isStream(const char *dictType)
{ return type == objStream && streamIs(dictType); }
inline void Object::streamReset()
+22 -22
Ver Arquivo
@@ -44,7 +44,7 @@
// PostScript prolog and setup
//------------------------------------------------------------------------
static char *prolog[] = {
static const char *prolog[] = {
"/xpdf 75 dict def xpdf begin",
"% PDF special state",
"/pdfDictSize 14 def",
@@ -353,7 +353,7 @@ static char *prolog[] = {
NULL
};
static char *cmapProlog[] = {
static const char *cmapProlog[] = {
"/CIDInit /ProcSet findresource begin",
"10 dict begin",
" begincmap",
@@ -403,11 +403,11 @@ static char *cmapProlog[] = {
//------------------------------------------------------------------------
struct PSSubstFont {
char *psName; // PostScript name
const char *psName; // PostScript name
double mWidth; // width of 'm' character
};
static char *psFonts[] = {
static const char *psFonts[] = {
"Courier",
"Courier-Bold",
"Courier-Oblique",
@@ -494,11 +494,11 @@ extern "C" {
typedef void (*SignalFunc)(int);
}
static void outputToFile(void *stream, char *data, int len) {
static void outputToFile(void *stream, const char *data, int len) {
fwrite(data, 1, len, (FILE *)stream);
}
PSOutputDev::PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
PSOutputDev::PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage, PSOutMode modeA) {
FILE *f;
PSFileType fileTypeA;
@@ -566,7 +566,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
PDFRectangle *box;
Dict *resDict;
Annots *annots;
char **p;
const char **p;
int pg;
Object obj1, obj2;
int i;
@@ -872,10 +872,10 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
GString *name;
PSFontParam *fontParam;
GString *psNameStr;
char *psName;
const char *psName;
char type3Name[64], buf[16];
UnicodeMap *uMap;
char *charName;
const char *charName;
double xs, ys;
int code;
double w1, w2;
@@ -1086,9 +1086,9 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
}
}
writePS("/");
writePSName(charName ? charName : (char *)".notdef");
writePSName(charName ? charName : ".notdef");
}
writePS((i == 256-8) ? (char *)"]\n" : (char *)"\n");
writePS((i == 256-8) ? "]\n" : "\n");
}
writePS("pdfMakeFont\n");
}
@@ -1098,7 +1098,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
}
}
void PSOutputDev::setupEmbeddedType1Font(Ref *id, char *psName) {
void PSOutputDev::setupEmbeddedType1Font(Ref *id, const char *psName) {
static char hexChar[17] = "0123456789abcdef";
Object refObj, strObj, obj1, obj2;
Dict *dict;
@@ -1223,7 +1223,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, char *psName) {
//~ This doesn't handle .pfb files or binary eexec data (which only
//~ happens in pfb files?).
void PSOutputDev::setupExternalType1Font(GString *fileName, char *psName) {
void PSOutputDev::setupExternalType1Font(GString *fileName, const char *psName) {
FILE *fontFile;
int c;
int i;
@@ -1264,7 +1264,7 @@ void PSOutputDev::setupExternalType1Font(GString *fileName, char *psName) {
}
void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id,
char *psName) {
const char *psName) {
char *fontBuf;
int fontLen;
Type1CFontFile *t1cFile;
@@ -1302,7 +1302,7 @@ void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id,
}
void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id,
char *psName) {
const char *psName) {
char *fontBuf;
int fontLen;
TrueTypeFontFile *ttFile;
@@ -1344,7 +1344,7 @@ void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id,
writePS("%%EndResource\n");
}
void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, char *psName) {
void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, const char *psName) {
GString *fileName;
char *fontBuf;
int fontLen;
@@ -1390,7 +1390,7 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, char *psName) {
}
void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id,
char *psName) {
const char *psName) {
char *fontBuf;
int fontLen;
Type1CFontFile *t1cFile;
@@ -1434,7 +1434,7 @@ void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id,
}
void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id,
char *psName) {
const char *psName) {
char *fontBuf;
int fontLen;
TrueTypeFontFile *ttFile;
@@ -1481,7 +1481,7 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id,
writePS("%%EndResource\n");
}
void PSOutputDev::setupType3Font(GfxFont *font, char *psName,
void PSOutputDev::setupType3Font(GfxFont *font, const char *psName,
Dict *parentResDict) {
Dict *resDict;
Dict *charProcs;
@@ -3254,7 +3254,7 @@ void PSOutputDev::writePSChar(char c) {
}
}
void PSOutputDev::writePS(char *s) {
void PSOutputDev::writePS(const char *s) {
if (t3String) {
t3String->append(s);
} else {
@@ -3300,8 +3300,8 @@ void PSOutputDev::writePSString(GString *s) {
writePSChar(')');
}
void PSOutputDev::writePSName(char *s) {
char *p;
void PSOutputDev::writePSName(const char *s) {
const char *p;
char c;
p = s;
+12 -12
Ver Arquivo
@@ -45,13 +45,13 @@ enum PSFileType {
psGeneric // write to a generic stream
};
typedef void (*PSOutputFunc)(void *stream, char *data, int len);
typedef void (*PSOutputFunc)(void *stream, const char *data, int len);
class PSOutputDev: public OutputDev {
public:
// Open a PostScript output file, and write the prolog.
PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage, PSOutMode modeA);
// Open a PSOutputDev that will write to a generic stream.
@@ -156,14 +156,14 @@ private:
void setupResources(Dict *resDict);
void setupFonts(Dict *resDict);
void setupFont(GfxFont *font, Dict *parentResDict);
void setupEmbeddedType1Font(Ref *id, char *psName);
void setupExternalType1Font(GString *fileName, char *psName);
void setupEmbeddedType1CFont(GfxFont *font, Ref *id, char *psName);
void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, char *psName);
void setupExternalTrueTypeFont(GfxFont *font, char *psName);
void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, char *psName);
void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, char *psName);
void setupType3Font(GfxFont *font, char *psName, Dict *parentResDict);
void setupEmbeddedType1Font(Ref *id, const char *psName);
void setupExternalType1Font(GString *fileName, const char *psName);
void setupEmbeddedType1CFont(GfxFont *font, Ref *id, const char *psName);
void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, const char *psName);
void setupExternalTrueTypeFont(GfxFont *font, const char *psName);
void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, const char *psName);
void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, const char *psName);
void setupType3Font(GfxFont *font, const char *psName, Dict *parentResDict);
void setupImages(Dict *resDict);
void setupImage(Ref id, Stream *str);
void addProcessColor(double c, double m, double y, double k);
@@ -187,10 +187,10 @@ private:
GBool getFileSpec(Object *fileSpec, Object *fileName);
#endif
void writePSChar(char c);
void writePS(char *s);
void writePS(const char *s);
void writePSFmt(const char *fmt, ...);
void writePSString(GString *s);
void writePSName(char *s);
void writePSName(const char *s);
GString *filterPSName(GString *name);
PSLevel level; // PostScript level (1, 2, separation)
+1 -1
Ver Arquivo
@@ -122,7 +122,7 @@ PageAttrs::~PageAttrs() {
resources.free();
}
GBool PageAttrs::readBox(Dict *dict, char *key, PDFRectangle *box) {
GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) {
PDFRectangle tmp;
Object obj1, obj2;
GBool ok;
+1 -1
Ver Arquivo
@@ -78,7 +78,7 @@ public:
private:
GBool readBox(Dict *dict, char *key, PDFRectangle *box);
GBool readBox(Dict *dict, const char *key, PDFRectangle *box);
PDFRectangle mediaBox;
PDFRectangle cropBox;
+10 -10
Ver Arquivo
@@ -84,7 +84,7 @@ char *Stream::getLine(char *buf, int size) {
return buf;
}
GString *Stream::getPSFilter(char *indent) {
GString *Stream::getPSFilter(const char *indent) {
return new GString();
}
@@ -132,7 +132,7 @@ Stream *Stream::addFilters(Object *dict) {
return str;
}
Stream *Stream::makeFilter(char *name, Stream *str, Object *params) {
Stream *Stream::makeFilter(const char *name, Stream *str, Object *params) {
int pred; // parameters
int colors;
int bits;
@@ -880,7 +880,7 @@ int ASCIIHexStream::lookChar() {
return buf;
}
GString *ASCIIHexStream::getPSFilter(char *indent) {
GString *ASCIIHexStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
@@ -958,7 +958,7 @@ int ASCII85Stream::lookChar() {
return b[index];
}
GString *ASCII85Stream::getPSFilter(char *indent) {
GString *ASCII85Stream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
@@ -1137,7 +1137,7 @@ int LZWStream::getCode() {
return code;
}
GString *LZWStream::getPSFilter(char *indent) {
GString *LZWStream::getPSFilter(const char *indent) {
GString *s;
if (pred) {
@@ -1174,7 +1174,7 @@ void RunLengthStream::reset() {
eof = gFalse;
}
GString *RunLengthStream::getPSFilter(char *indent) {
GString *RunLengthStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
@@ -1724,7 +1724,7 @@ short CCITTFaxStream::lookBits(int n) {
return (inputBuf >> (inputBits - n)) & (0xffff >> (16 - n));
}
GString *CCITTFaxStream::getPSFilter(char *indent) {
GString *CCITTFaxStream::getPSFilter(const char *indent) {
GString *s;
char s1[50];
@@ -3086,7 +3086,7 @@ int DCTStream::read16() {
return (c1 << 8) + c2;
}
GString *DCTStream::getPSFilter(char *indent) {
GString *DCTStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
@@ -3276,7 +3276,7 @@ int FlateStream::getRawChar() {
return c;
}
GString *FlateStream::getPSFilter(char *indent) {
GString *FlateStream::getPSFilter(const char *indent) {
return NULL;
}
@@ -3684,7 +3684,7 @@ void ASCIIHexEncoder::close() {
}
GBool ASCIIHexEncoder::fillBuf() {
static char *hex = "0123456789abcdef";
static const char hex[] = "0123456789abcdef";
int c;
if (eof) {
+14 -14
Ver Arquivo
@@ -87,7 +87,7 @@ public:
virtual void setPos(Guint pos, int dir = 0) = 0;
// Get PostScript command for the filter(s).
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
// Does this stream type potentially contain non-printable chars?
virtual GBool isBinary(GBool last = gTrue) = 0;
@@ -107,7 +107,7 @@ public:
private:
Stream *makeFilter(char *name, Stream *str, Object *params);
Stream *makeFilter(const char *name, Stream *str, Object *params);
int ref; // reference count
};
@@ -370,7 +370,7 @@ public:
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -393,7 +393,7 @@ public:
virtual int getChar()
{ int ch = lookChar(); ++index; return ch; }
virtual int lookChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -419,7 +419,7 @@ public:
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -463,7 +463,7 @@ public:
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -494,7 +494,7 @@ public:
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -564,7 +564,7 @@ public:
virtual void reset();
virtual int getChar();
virtual int lookChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
Stream *getRawStream() { return str; }
@@ -663,7 +663,7 @@ public:
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
virtual GString *getPSFilter(char *indent);
virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
@@ -712,7 +712,7 @@ public:
virtual void reset() {}
virtual int getChar() { return EOF; }
virtual int lookChar() { return EOF; }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
};
@@ -730,7 +730,7 @@ public:
virtual void close();
virtual int getChar();
virtual int lookChar();
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
@@ -756,7 +756,7 @@ public:
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
@@ -787,7 +787,7 @@ public:
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
@@ -818,7 +818,7 @@ public:
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
virtual GString *getPSFilter(char *indent) { return NULL; }
virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
+2 -2
Ver Arquivo
@@ -118,7 +118,7 @@ UnicodeMap::UnicodeMap(GString *encodingNameA) {
refCnt = 1;
}
UnicodeMap::UnicodeMap(char *encodingNameA, GBool unicodeOutA,
UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapRange *rangesA, int lenA) {
encodingName = new GString(encodingNameA);
unicodeOut = unicodeOutA;
@@ -130,7 +130,7 @@ UnicodeMap::UnicodeMap(char *encodingNameA, GBool unicodeOutA,
refCnt = 1;
}
UnicodeMap::UnicodeMap(char *encodingNameA, GBool unicodeOutA,
UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapFunc funcA) {
encodingName = new GString(encodingNameA);
unicodeOut = unicodeOutA;
+2 -2
Ver Arquivo
@@ -49,12 +49,12 @@ public:
static UnicodeMap *parse(GString *encodingNameA);
// Create a resident UnicodeMap.
UnicodeMap(char *encodingNameA, GBool unicodeOutA,
UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapRange *rangesA, int lenA);
// Create a resident UnicodeMap that uses a function instead of a
// list of ranges.
UnicodeMap(char *encodingNameA, GBool unicodeOutA,
UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapFunc funcA);
~UnicodeMap();
+9 -9
Ver Arquivo
@@ -108,7 +108,7 @@ GString *getCurrentDir() {
return new GString();
}
GString *appendToPath(GString *path, char *fileName) {
GString *appendToPath(GString *path, const char *fileName) {
#if defined(VMS)
//---------- VMS ----------
//~ this should handle everything necessary for file
@@ -274,7 +274,7 @@ GString *appendToPath(GString *path, char *fileName) {
#endif
}
GString *grabPath(char *fileName) {
GString *grabPath(const char *fileName) {
#ifdef VMS
//---------- VMS ----------
char *p;
@@ -315,7 +315,7 @@ GString *grabPath(char *fileName) {
#else
//---------- Unix ----------
char *p;
const char *p;
if ((p = strrchr(fileName, '/')))
return new GString(fileName, p - fileName);
@@ -323,7 +323,7 @@ GString *grabPath(char *fileName) {
#endif
}
GBool isAbsolutePath(char *path) {
GBool isAbsolutePath(const char *path) {
#ifdef VMS
//---------- VMS ----------
return strchr(path, ':') ||
@@ -429,7 +429,7 @@ GString *makePathAbsolute(GString *path) {
#endif
}
time_t getModTime(char *fileName) {
time_t getModTime(const char *fileName) {
#ifdef WIN32
//~ should implement this, but it's (currently) only used in xpdf
return 0;
@@ -443,7 +443,7 @@ time_t getModTime(char *fileName) {
#endif
}
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
GBool openTempFile(GString **name, FILE **f, const char *mode, const char *ext) {
#if defined(WIN32)
//---------- Win32 ----------
char *s;
@@ -528,7 +528,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
#endif
}
GBool executeCommand(char *cmd) {
GBool executeCommand(const char *cmd) {
#ifdef VMS
return system(cmd) ? gTrue : gFalse;
#else
@@ -569,7 +569,7 @@ char *getLine(char *buf, int size, FILE *f) {
// GDir and GDirEntry
//------------------------------------------------------------------------
GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) {
GDirEntry::GDirEntry(const char *dirPath, const char *nameA, GBool doStat) {
#ifdef VMS
char *p;
#elif defined(WIN32)
@@ -608,7 +608,7 @@ GDirEntry::~GDirEntry() {
delete name;
}
GDir::GDir(char *name, GBool doStatA) {
GDir::GDir(const char *name, GBool doStatA) {
path = new GString(name);
doStat = doStatA;
#if defined(WIN32)
+7 -7
Ver Arquivo
@@ -60,14 +60,14 @@ extern GString *getCurrentDir();
// Append a file name to a path string. <path> may be an empty
// string, denoting the current directory). Returns <path>.
extern GString *appendToPath(GString *path, char *fileName);
extern GString *appendToPath(GString *path, const char *fileName);
// Grab the path from the front of the file name. If there is no
// directory component in <fileName>, returns an empty string.
extern GString *grabPath(char *fileName);
extern GString *grabPath(const char *fileName);
// Is this an absolute path or file name?
extern GBool isAbsolutePath(char *path);
extern GBool isAbsolutePath(const char *path);
// Make this path absolute by prepending current directory (if path is
// relative) or prepending user's directory (if path starts with '~').
@@ -83,10 +83,10 @@ extern time_t getModTime(char *fileName);
// should be done to the returned file pointer; the file may be
// reopened later for reading, but not for writing. The <mode> string
// should be "w" or "wb". Returns true on success.
extern GBool openTempFile(GString **name, FILE **f, char *mode, char *ext);
extern GBool openTempFile(GString **name, FILE **f, const char *mode, const char *ext);
// Execute <command>. Returns true on success.
extern GBool executeCommand(char *cmd);
extern GBool executeCommand(const char *cmd);
// Just like fgets, but handles Unix, Mac, and/or DOS end-of-line
// conventions.
@@ -99,7 +99,7 @@ extern char *getLine(char *buf, int size, FILE *f);
class GDirEntry {
public:
GDirEntry(char *dirPath, char *nameA, GBool doStat);
GDirEntry(const char *dirPath, const char *nameA, GBool doStat);
~GDirEntry();
GString *getName() { return name; }
GBool isDir() { return dir; }
@@ -113,7 +113,7 @@ private:
class GDir {
public:
GDir(char *name, GBool doStatA = gTrue);
GDir(const char *name, GBool doStatA = gTrue);
~GDir();
GDirEntry *getNextEntry();
void rewind();
+1 -1
Ver Arquivo
@@ -195,7 +195,7 @@ void gMemReport(FILE *f) {
}
#endif
char *copyString(char *s) {
char *copyString(const char *s) {
char *s1;
s1 = (char *)gmalloc(strlen(s) + 1);
+1 -1
Ver Arquivo
@@ -44,7 +44,7 @@ extern void gMemReport(FILE *f);
/*
* Allocate memory and copy a string into it.
*/
extern char *copyString(char *s);
extern char *copyString(const char *s);
#ifdef __cplusplus
}
+1 -1
Ver Arquivo
@@ -41,7 +41,7 @@ GBool parseArgs(ArgDesc *args, int *argc, char *argv[]) {
void printUsage(char *program, char *otherArgs, ArgDesc *args) {
ArgDesc *arg;
char *typ;
const char *typ;
int w, w1;
w = 0;
+4
Ver Arquivo
@@ -1845,6 +1845,10 @@ ReadClient(client_t *con) /* I - Client to read from */
}
}
}
else if (con->http.state == HTTP_POST_RECV)
{
return (0);
}
else if (con->http.state != HTTP_POST_SEND)
{
CloseClient(con);
+3 -3
Ver Arquivo
@@ -1216,11 +1216,11 @@ send_state(const char *dest, /* I - Destination */
else
strlcpy(namestr, jobname, sizeof(namestr));
printf("%s: %-34.34s[job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-40.40s%d bytes\n", namestr, jobsize);
printf("%s: %-33.33s [job %d localhost]\n", jobuser, rankstr, jobid);
printf(" %-39.39s %d bytes\n", namestr, jobsize);
}
else
printf("%-7s %-8.8s%-8d%-32.32s%d bytes\n", rankstr, jobuser,
printf("%-7s %-7.7s %-7d %-31.31s %d bytes\n", rankstr, jobuser,
jobid, jobname, jobsize);
if (attr == NULL)
+28 -14
Ver Arquivo
@@ -71,7 +71,7 @@ cups_hstrerror(int error) /* I - Error number */
*/
int poll_server(http_t *http, cups_lang_t *language, ipp_op_t op,
int sock, int port, int interval);
int sock, int port, int interval, const char *prefix);
/*
@@ -90,10 +90,11 @@ main(int argc, /* I - Number of command-line arguments */
int val; /* Socket option value */
int seconds, /* Seconds left from poll */
remain; /* Total remaining time to sleep */
char prefix[1024]; /* Prefix for log messages */
/*
* Don't buffer errors...
* Don't buffer log messages...
*/
setbuf(stderr, NULL);
@@ -113,13 +114,18 @@ main(int argc, /* I - Number of command-line arguments */
interval = atoi(argv[3]);
port = atoi(argv[4]);
if (interval < 2)
interval = 2;
snprintf(prefix, sizeof(prefix), "[cups-polld %s:%d]", argv[1], atoi(argv[2]));
/*
* Open a broadcast socket...
*/
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
{
fprintf(stderr, "cups-polld: Unable to open broadcast socket: %s\n",
fprintf(stderr, "ERROR: %s Unable to open broadcast socket: %s\n", prefix,
strerror(errno));
return (1);
}
@@ -131,8 +137,8 @@ main(int argc, /* I - Number of command-line arguments */
val = 1;
if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &val, sizeof(val)))
{
fprintf(stderr, "cups-polld: Unable to put socket in broadcast mode: %s\n",
strerror(errno));
fprintf(stderr, "ERROR: %s Unable to put socket in broadcast mode: %s\n",
prefix, strerror(errno));
close(sock);
return (1);
@@ -145,8 +151,9 @@ main(int argc, /* I - Number of command-line arguments */
while ((http = httpConnectEncrypt(argv[1], atoi(argv[2]),
cupsEncryption())) == NULL)
{
fprintf(stderr, "cups-polld: Unable to connect to %s on port %s: %s\n",
argv[1], argv[2], h_errno ? hstrerror(h_errno) : strerror(errno));
fprintf(stderr, "ERROR: %s Unable to connect to %s on port %s: %s\n",
prefix, argv[1], argv[2],
h_errno ? hstrerror(h_errno) : strerror(errno));
sleep (interval);
}
@@ -165,11 +172,11 @@ main(int argc, /* I - Number of command-line arguments */
remain = interval;
if ((seconds = poll_server(http, language, CUPS_GET_PRINTERS, sock, port,
interval / 2)) > 0)
interval / 2, prefix)) > 0)
remain -= seconds;
if ((seconds = poll_server(http, language, CUPS_GET_CLASSES, sock, port,
interval / 2)) > 0)
interval / 2, prefix)) > 0)
remain -= seconds;
/*
@@ -179,6 +186,8 @@ main(int argc, /* I - Number of command-line arguments */
if (remain > 0)
sleep(remain);
}
return (0);
}
@@ -192,7 +201,8 @@ poll_server(http_t *http, /* I - HTTP connection */
ipp_op_t op, /* I - Operation code */
int sock, /* I - Broadcast sock */
int port, /* I - Broadcast port */
int interval) /* I - Polling interval */
int interval, /* I - Polling interval */
const char *prefix) /* I - Prefix for log messages */
{
int seconds; /* Number of seconds */
int count, /* Current number of printers/classes */
@@ -213,6 +223,7 @@ poll_server(http_t *http, /* I - HTTP connection */
"printer-info",
"printer-location",
"printer-make-and-model",
"printer-name",
"printer-state",
"printer-type",
"printer-uri-supported"
@@ -238,8 +249,6 @@ poll_server(http_t *http, /* I - HTTP connection */
request->request.op.operation_id = op;
request->request.op.request_id = 1;
language = cupsLangDefault();
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
"attributes-charset", NULL, cupsLangEncoding(language));
@@ -258,7 +267,7 @@ poll_server(http_t *http, /* I - HTTP connection */
{
if (response->request.status.status_code > IPP_OK_CONFLICT)
{
fprintf(stderr, "cups-polld: get-%s failed: %s\n",
fprintf(stderr, "ERROR: %s get-%s failed: %s\n", prefix,
op == CUPS_GET_PRINTERS ? "printers" : "classes",
ippErrorString(response->request.status.status_code));
ippDelete(response);
@@ -275,6 +284,9 @@ poll_server(http_t *http, /* I - HTTP connection */
attr = ippFindNextAttribute(response, "printer-name", IPP_TAG_NAME),
max_count ++);
fprintf(stderr, "DEBUG: %s found %d %s.\n", prefix, max_count,
op == CUPS_GET_PRINTERS ? "printers" : "classes");
count = 0;
seconds = time(NULL);
max_count = max_count / interval + 1;
@@ -361,6 +373,8 @@ poll_server(http_t *http, /* I - HTTP connection */
type | CUPS_PRINTER_REMOTE, state, uri,
location, info, make_model);
fprintf(stderr, "DEBUG2: %s Sending %s", prefix, packet);
if (sendto(sock, packet, strlen(packet), 0,
(struct sockaddr *)&addr, sizeof(addr)) <= 0)
{
@@ -394,7 +408,7 @@ poll_server(http_t *http, /* I - HTTP connection */
}
else
{
fprintf(stderr, "cups-polld: get-%s failed: %s\n",
fprintf(stderr, "ERROR: %s get-%s failed: %s\n", prefix,
op == CUPS_GET_PRINTERS ? "printers" : "classes",
ippErrorString(cupsLastError()));
return (-1);
+9 -1
Ver Arquivo
@@ -117,6 +117,7 @@ ProcessBrowseData(const char *uri, /* I - URI of printer/class */
* the Printers list, and add it if not...
*/
type |= CUPS_PRINTER_REMOTE;
update = 0;
hptr = strchr(host, '.');
sptr = strchr(ServerName, '.');
@@ -1348,7 +1349,14 @@ UpdatePolling(void)
*lineptr++ = '\0';
LogMessage(L_ERROR, "[Polling] %s", buffer);
if (!strncmp(buffer, "ERROR: ", 7))
LogMessage(L_ERROR, "%s", buffer + 7);
else if (!strncmp(buffer, "DEBUG: ", 7))
LogMessage(L_DEBUG, "%s", buffer + 7);
else if (!strncmp(buffer, "DEBUG2: ", 8))
LogMessage(L_DEBUG2, "%s", buffer + 8);
else
LogMessage(L_DEBUG, "%s", buffer);
/*
* Copy over the buffer data we've used up...
+151 -31
Ver Arquivo
@@ -114,8 +114,8 @@ static void add_queued_job_count(client_t *con, printer_t *p);
static void cancel_all_jobs(client_t *con, ipp_attribute_t *uri);
static void cancel_job(client_t *con, ipp_attribute_t *uri);
static int check_quotas(client_t *con, printer_t *p);
static void copy_attribute(ipp_t *to, ipp_attribute_t *attr,
int quickcopy);
static ipp_attribute_t *copy_attribute(ipp_t *to, ipp_attribute_t *attr,
int quickcopy);
static void copy_attrs(ipp_t *to, ipp_t *from, ipp_attribute_t *req,
ipp_tag_t group, int quickcopy);
static int copy_banner(client_t *con, job_t *job, const char *name);
@@ -2025,7 +2025,7 @@ check_quotas(client_t *con, /* I - Client connection */
* 'copy_attribute()' - Copy a single attribute.
*/
static void
static ipp_attribute_t * /* O - New attribute */
copy_attribute(ipp_t *to, /* O - Destination request/response */
ipp_attribute_t *attr, /* I - Attribute to copy */
int quickcopy)/* I - Do a quick copy? */
@@ -2041,7 +2041,7 @@ copy_attribute(ipp_t *to, /* O - Destination request/response */
switch (attr->value_tag & ~IPP_TAG_COPY)
{
case IPP_TAG_ZERO :
ippAddSeparator(to);
toattr = ippAddSeparator(to);
break;
case IPP_TAG_INTEGER :
@@ -2177,6 +2177,8 @@ copy_attribute(ipp_t *to, /* O - Destination request/response */
}
break; /* anti-compiler-warning-code */
}
return (toattr);
}
@@ -2361,7 +2363,7 @@ copy_banner(client_t *con, /* I - Client connection */
* Ignore { followed by stuff that is not an attribute name...
*/
cupsFilePrintf(out, "{%s", attrname);
cupsFilePrintf(out, "{%s%c", attrname, ch);
continue;
}
@@ -3049,7 +3051,8 @@ create_job(client_t *con, /* I - Client connection */
job->state->values[0].integer = IPP_JOB_HELD;
if (!(printer->type & CUPS_PRINTER_REMOTE) || Classification)
if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) ||
Classification)
{
/*
* Add job sheets options...
@@ -3114,8 +3117,11 @@ create_job(client_t *con, /* I - Client connection */
* See if we need to add the starting sheet...
*/
if (!(printer->type & CUPS_PRINTER_REMOTE))
if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
{
LogMessage(L_INFO, "Adding start banner page \"%s\" to job %d.",
attr->values[0].string.text, job->id);
kbytes = copy_banner(con, job, attr->values[0].string.text);
UpdateQuota(printer, job->username, 0, kbytes);
@@ -4799,7 +4805,8 @@ print_job(client_t *con, /* I - Client connection */
SetJobHoldUntil(job->id, attr->values[0].string.text);
}
if (!(printer->type & CUPS_PRINTER_REMOTE) || Classification)
if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) ||
Classification)
{
/*
* Add job sheets options...
@@ -4864,8 +4871,11 @@ print_job(client_t *con, /* I - Client connection */
* Add the starting sheet...
*/
if (!(printer->type & CUPS_PRINTER_REMOTE))
if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)))
{
LogMessage(L_INFO, "Adding start banner page \"%s\" to job %d.",
attr->values[0].string.text, job->id);
kbytes = copy_banner(con, job, attr->values[0].string.text);
UpdateQuota(printer, job->username, 0, kbytes);
@@ -4890,13 +4900,18 @@ print_job(client_t *con, /* I - Client connection */
* See if we need to add the ending sheet...
*/
if (!(printer->type & CUPS_PRINTER_REMOTE) && attr->num_values > 1)
if (!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
attr->num_values > 1)
{
/*
* Yes...
*/
LogMessage(L_INFO, "Adding end banner page \"%s\" to job %d.",
attr->values[1].string.text, job->id);
kbytes = copy_banner(con, job, attr->values[1].string.text);
UpdateQuota(printer, job->username, 0, kbytes);
}
@@ -5796,7 +5811,8 @@ send_document(client_t *con, /* I - Client connection */
* See if we need to add the ending sheet...
*/
if (printer != NULL && !(printer->type & CUPS_PRINTER_REMOTE) &&
if (printer != NULL &&
!(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
(attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_ZERO)) != NULL &&
attr->num_values > 1)
{
@@ -5804,7 +5820,11 @@ send_document(client_t *con, /* I - Client connection */
* Yes...
*/
LogMessage(L_INFO, "Adding end banner page \"%s\" to job %d.",
attr->values[1].string.text, job->id);
kbytes = copy_banner(con, job, attr->values[1].string.text);
UpdateQuota(printer, job->username, 0, kbytes);
}
@@ -5983,6 +6003,12 @@ set_job_attrs(client_t *con, /* I - Client connection */
LogMessage(L_DEBUG2, "set_job_attrs(%p[%d], %s)\n", con, con->http.fd,
uri->values[0].string.text);
/*
* Start with "everything is OK" status...
*/
con->response->request.status.status_code = IPP_OK;
/*
* See if we have a job URI or a printer URI...
*/
@@ -6076,25 +6102,125 @@ set_job_attrs(client_t *con, /* I - Client connection */
if (attr->group_tag != IPP_TAG_JOB || !attr->name)
continue;
if (strcmp(attr->name, "job-originating-host-name") == 0 ||
strcmp(attr->name, "job-originating-user-name") == 0 ||
strcmp(attr->name, "job-media-sheets-completed") == 0 ||
strcmp(attr->name, "job-k-octets") == 0 ||
strcmp(attr->name, "job-id") == 0 ||
strcmp(attr->name, "job-sheets") == 0 ||
strncmp(attr->name, "time-at-", 8) == 0)
continue; /* Read-only attrs */
if (strcmp(attr->name, "job-priority") == 0 &&
attr->value_tag == IPP_TAG_INTEGER &&
job->state->values[0].integer != IPP_JOB_PROCESSING)
if (!strcmp(attr->name, "attributes-charset") ||
!strcmp(attr->name, "attributes-natural-language") ||
!strcmp(attr->name, "document-compression") ||
!strcmp(attr->name, "document-format") ||
!strcmp(attr->name, "job-detailed-status-messages") ||
!strcmp(attr->name, "job-document-access-errors") ||
!strcmp(attr->name, "job-id") ||
!strcmp(attr->name, "job-k-octets") ||
!strcmp(attr->name, "job-originating-host-name") ||
!strcmp(attr->name, "job-originating-user-name") ||
!strcmp(attr->name, "job-printer-up-time") ||
!strcmp(attr->name, "job-printer-uri") ||
!strcmp(attr->name, "job-sheets") ||
!strcmp(attr->name, "job-state-message") ||
!strcmp(attr->name, "job-state-reasons") ||
!strcmp(attr->name, "job-uri") ||
!strcmp(attr->name, "number-of-documents") ||
!strcmp(attr->name, "number-of-intervening-jobs") ||
!strcmp(attr->name, "output-device-assigned") ||
!strncmp(attr->name, "date-time-at-", 13) ||
!strncmp(attr->name, "job-impressions", 15) ||
!strncmp(attr->name, "job-k-octets", 12) ||
!strncmp(attr->name, "job-media-sheets", 16) ||
!strncmp(attr->name, "time-at-", 8))
{
/*
* Change the job priority
* Read-only attrs!
*/
SetJobPriority(jobid, attr->values[0].integer);
send_ipp_error(con, IPP_ATTRIBUTES_NOT_SETTABLE);
if ((attr2 = copy_attribute(con->response, attr, 0)) != NULL)
attr2->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
continue;
}
if (!strcmp(attr->name, "job-priority"))
{
/*
* Change the job priority...
*/
if (attr->value_tag != IPP_TAG_INTEGER)
{
send_ipp_error(con, IPP_REQUEST_VALUE);
if ((attr2 = copy_attribute(con->response, attr, 0)) != NULL)
attr2->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
}
else if (job->state->values[0].integer >= IPP_JOB_PROCESSING)
{
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
else if (con->response->request.status.status_code == IPP_OK)
SetJobPriority(jobid, attr->values[0].integer);
}
else if (!strcmp(attr->name, "job-state"))
{
/*
* Change the job state...
*/
if (attr->value_tag != IPP_TAG_ENUM)
{
send_ipp_error(con, IPP_REQUEST_VALUE);
if ((attr2 = copy_attribute(con->response, attr, 0)) != NULL)
attr2->group_tag = IPP_TAG_UNSUPPORTED_GROUP;
}
else
{
switch (attr->values[0].integer)
{
case IPP_JOB_PENDING :
case IPP_JOB_HELD :
if (job->state->values[0].integer > IPP_JOB_HELD)
{
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
else if (con->response->request.status.status_code == IPP_OK)
job->state->values[0].integer = attr->values[0].integer;
break;
case IPP_JOB_PROCESSING :
case IPP_JOB_STOPPED :
if (job->state->values[0].integer != attr->values[0].integer)
{
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
break;
case IPP_JOB_CANCELLED :
case IPP_JOB_ABORTED :
case IPP_JOB_COMPLETED :
if (job->state->values[0].integer > IPP_JOB_PROCESSING)
{
send_ipp_error(con, IPP_NOT_POSSIBLE);
return;
}
else if (con->response->request.status.status_code == IPP_OK)
{
CancelJob(job->id, 0);
if (JobHistory)
{
job->state->values[0].integer = attr->values[0].integer;
SaveJob(job->id);
}
}
break;
}
}
}
else if (con->response->request.status.status_code != IPP_OK)
continue;
else if ((attr2 = ippFindAttribute(job->attrs, attr->name, IPP_TAG_ZERO)) != NULL)
{
/*
@@ -6187,12 +6313,6 @@ set_job_attrs(client_t *con, /* I - Client connection */
*/
CheckJobs();
/*
* Return with "everything is OK" status...
*/
con->response->request.status.status_code = IPP_OK;
}
+9 -7
Ver Arquivo
@@ -619,7 +619,15 @@ LoadAllJobs(void)
close(fd);
}
job->state = ippFindAttribute(job->attrs, "job-state", IPP_TAG_ENUM);
if ((job->state = ippFindAttribute(job->attrs, "job-state", IPP_TAG_ENUM)) == NULL)
{
LogMessage(L_ERROR, "LoadAllJobs: Missing or bad job-state attribute in control file \"%s\"!",
filename);
ippDelete(job->attrs);
free(job);
unlink(filename);
continue;
}
if ((attr = ippFindAttribute(job->attrs, "job-printer-uri", IPP_TAG_URI)) == NULL)
{
@@ -795,12 +803,6 @@ LoadAllJobs(void)
*/
CleanJobs();
/*
* Check to see if we need to start any jobs...
*/
CheckJobs();
}
+68 -51
Ver Arquivo
@@ -30,10 +30,10 @@
* ReleaseSignals() - Release signals for delivery.
* SetString() - Set a string value.
* SetStringf() - Set a formatted string value.
* parent_handler() - Catch USR1/CHLD signals...
* sigchld_handler() - Handle 'child' signals from old processes.
* sighup_handler() - Handle 'hangup' signals to reconfigure the scheduler.
* sigterm_handler() - Handle 'terminate' signals that stop the scheduler.
* sigusr1_handler() - Catch USR1 signals...
* usage() - Show scheduler usage.
*/
@@ -56,10 +56,10 @@
* Local functions...
*/
static void parent_handler(int sig);
static void sigchld_handler(int sig);
static void sighup_handler(int sig);
static void sigterm_handler(int sig);
static void sigusr1_handler(int sig);
static void usage(void);
@@ -67,6 +67,7 @@ static void usage(void);
* Local globals...
*/
static int parent_signal = 0; /* Set to signal number from child */
static int holdcount = 0; /* Number of time "hold" was called */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
static sigset_t holdmask; /* Old POSIX signal mask */
@@ -171,41 +172,53 @@ main(int argc, /* I - Number of command-line arguments */
if (!fg)
{
/*
* Setup signal handlers for the parent...
*/
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGUSR1, parent_handler);
sigset(SIGCHLD, parent_handler);
sigset(SIGHUP, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGUSR1);
action.sa_handler = parent_handler;
sigaction(SIGUSR1, &action, NULL);
sigaction(SIGCHLD, &action, NULL);
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGHUP, &action, NULL);
#else
signal(SIGUSR1, parent_handler);
signal(SIGCLD, parent_handler);
signal(SIGHUP, SIG_IGN);
#endif /* HAVE_SIGSET */
if (fork() > 0)
{
/*
* OK, wait for the child to startup and send us SIGUSR1... We
* also need to ignore SIGHUP which might be sent by the init
* script to restart the scheduler...
* OK, wait for the child to startup and send us SIGUSR1 or to crash
* and the OS send us SIGCHLD... We also need to ignore SIGHUP which
* might be sent by the init script to restart the scheduler...
*/
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGUSR1, sigusr1_handler);
for (; parent_signal == 0;)
sleep(1);
sigset(SIGHUP, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
sigaddset(&action.sa_mask, SIGUSR1);
action.sa_handler = sigusr1_handler;
sigaction(SIGUSR1, &action, NULL);
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
sigaction(SIGHUP, &action, NULL);
#else
signal(SIGUSR1, sigusr1_handler);
signal(SIGHUP, SIG_IGN);
#endif /* HAVE_SIGSET */
if (wait(&i) < 0)
i = 0;
if (i == 0)
if (parent_signal == SIGUSR1)
return (0);
if (i >= 256)
if (wait(&i) < 0)
{
perror("cupsd");
i = 1;
}
else if (i >= 256)
fprintf(stderr, "cupsd: Child exited with status %d!\n", i / 256);
else
fprintf(stderr, "cupsd: Child exited on signal %d!\n", i);
@@ -289,6 +302,17 @@ main(int argc, /* I - Number of command-line arguments */
return (1);
}
/*
* Read configuration...
*/
if (!ReadConfiguration())
{
syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!",
ConfigurationFile);
return (1);
}
/*
* Catch hangup and child signals and ignore broken pipes...
*/
@@ -333,17 +357,6 @@ main(int argc, /* I - Number of command-line arguments */
signal(SIGTERM, sigterm_handler);
#endif /* HAVE_SIGSET */
/*
* Read configuration...
*/
if (!ReadConfiguration())
{
syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!",
ConfigurationFile);
return (1);
}
#ifdef __sgi
/*
* Try to create a fake lpsched lock file if one is not already there.
@@ -861,6 +874,21 @@ SetStringf(char **s, /* O - New string */
}
/*
* 'parent_handler()' - Catch USR1/CHLD signals...
*/
static void
parent_handler(int sig) /* I - Signal */
{
/*
* Store the signal we got from the OS and return...
*/
parent_signal = sig;
}
/*
* 'sigchld_handler()' - Handle 'child' signals from old processes.
*/
@@ -1038,17 +1066,6 @@ sigterm_handler(int sig) /* I - Signal */
}
/*
* 'sigusr1_handler()' - Catch USR1 signals...
*/
static void
sigusr1_handler(int sig) /* I - Signal */
{
(void)sig; /* remove compiler warnings... */
}
/*
* 'usage()' - Show scheduler usage.
*/
+20 -11
Ver Arquivo
@@ -51,7 +51,8 @@ int /* O - Exit status */
main(int argc, /* I - Number of command-line args */
char *argv[]) /* I - Command-line arguments */
{
int i; /* Looping var */
int i, j; /* Looping vars */
const char *filter_path; /* Filter path */
char super[MIME_MAX_SUPER], /* Super-type name */
type[MIME_MAX_TYPE]; /* Type name */
int compression; /* Compression of file */
@@ -63,9 +64,10 @@ main(int argc, /* I - Number of command-line args */
int num_filters; /* Number of filters for the file */
mime = NULL;
src = NULL;
dst = NULL;
mime = NULL;
src = NULL;
dst = NULL;
filter_path = "../filter";
for (i = 1; i < argc; i ++)
if (strcmp(argv[i], "-d") == 0)
@@ -73,12 +75,19 @@ main(int argc, /* I - Number of command-line args */
i ++;
if (i < argc)
mime = mimeLoad(argv[i], "../filter");
mime = mimeLoad(argv[i], filter_path);
}
else if (strcmp(argv[i], "-f") == 0)
{
i ++;
if (i < argc)
filter_path = argv[i];
}
else if (src == NULL)
{
if (!mime)
mime = mimeLoad("../conf", "../filter");
mime = mimeLoad("../conf", filter_path);
src = mimeFileType(mime, argv[i], &compression);
@@ -107,18 +116,18 @@ main(int argc, /* I - Number of command-line args */
}
else
{
for (i = 0; i < num_filters; i ++)
if (i < (num_filters - 1))
printf("%s | ", filters[i].filter);
for (j = 0; j < num_filters; j ++)
if (j < (num_filters - 1))
printf("%s | ", filters[j].filter);
else
puts(filters[i].filter);
puts(filters[j].filter);
free(filters);
}
}
if (!mime)
mime = mimeLoad("../conf", "../filter");
mime = mimeLoad("../conf", filter_path);
if (src == NULL)
{
+111 -2
Ver Arquivo
@@ -27,8 +27,9 @@
*
* Contents:
*
* main() - Main entry for test program.
* usage() - Show program usage...
* main() - Main entry for test program.
* show_conflicts() - Show option conflicts in a PPD file.
* usage() - Show program usage...
*/
/*
@@ -56,6 +57,7 @@
* Local functions...
*/
void show_conflicts(ppd_file_t *ppd);
void usage(void);
@@ -658,6 +660,14 @@ main(int argc, /* I - Number of command-line arguments */
if (verbose >= 0)
{
ppdMarkDefaults(ppd);
if (ppdConflicts(ppd))
{
puts(" WARN Default choices conflicting!");
show_conflicts(ppd);
}
if (ppdversion < 43)
{
printf(" WARN Obsolete PPD version %.1f!\n",
@@ -856,6 +866,105 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* 'show_conflicts()' - Show option conflicts in a PPD file.
*/
void
show_conflicts(ppd_file_t *ppd) /* I - PPD to check */
{
int i, j; /* Looping variables */
ppd_const_t *c; /* Current constraint */
ppd_option_t *o1, *o2; /* Options */
ppd_choice_t *c1, *c2; /* Choices */
/*
* Loop through all of the UI constraints and report any options
* that conflict...
*/
for (i = ppd->num_consts, c = ppd->consts; i > 0; i --, c ++)
{
/*
* Grab pointers to the first option...
*/
o1 = ppdFindOption(ppd, c->option1);
if (o1 == NULL)
continue;
else if (c->choice1[0] != '\0')
{
/*
* This constraint maps to a specific choice.
*/
c1 = ppdFindChoice(o1, c->choice1);
}
else
{
/*
* This constraint applies to any choice for this option.
*/
for (j = o1->num_choices, c1 = o1->choices; j > 0; j --, c1 ++)
if (c1->marked)
break;
if (j == 0 ||
strcasecmp(c1->choice, "None") == 0 ||
strcasecmp(c1->choice, "Off") == 0 ||
strcasecmp(c1->choice, "False") == 0)
c1 = NULL;
}
/*
* Grab pointers to the second option...
*/
o2 = ppdFindOption(ppd, c->option2);
if (o2 == NULL)
continue;
else if (c->choice2[0] != '\0')
{
/*
* This constraint maps to a specific choice.
*/
c2 = ppdFindChoice(o2, c->choice2);
}
else
{
/*
* This constraint applies to any choice for this option.
*/
for (j = o2->num_choices, c2 = o2->choices; j > 0; j --, c2 ++)
if (c2->marked)
break;
if (j == 0 ||
strcasecmp(c2->choice, "None") == 0 ||
strcasecmp(c2->choice, "Off") == 0 ||
strcasecmp(c2->choice, "False") == 0)
c2 = NULL;
}
/*
* If both options are marked then there is a conflict...
*/
if (c1 != NULL && c1->marked && c2 != NULL && c2->marked)
printf(" WARN \"%s %s\" conflicts with \"%s %s\"\n"
" (constraint=\"%s %s %s %s\")\n",
o1->keyword, c1->choice, o2->keyword, c2->choice,
c->option1, c->choice1, c->option2, c->choice2);
}
}
/*
* 'usage()' - Show program usage...
*/
+17 -2
Ver Arquivo
@@ -124,7 +124,7 @@ main(int argc, /* I - Number of command-line arguments */
job_id = 0;
for (i = 1; i < argc; i ++)
if (argv[i][0] == '-')
if (argv[i][0] == '-' && argv[i][1])
switch (argv[i][1])
{
case 'E' : /* Encrypt */
@@ -452,6 +452,17 @@ main(int argc, /* I - Number of command-line arguments */
fprintf(stderr, "lp: Unknown option \'%c\'!\n", argv[i][1]);
return (1);
}
else if (!strcmp(argv[i], "-"))
{
if (num_files || job_id)
{
fputs("lp: Error - cannot print from stdin if files or a job ID are "
"provided!\n", stderr);
return (1);
}
break;
}
else if (num_files < 1000 && job_id == 0)
{
/*
@@ -509,7 +520,11 @@ main(int argc, /* I - Number of command-line arguments */
if (printer == NULL)
{
fputs("lp: error - no default destination available.\n", stderr);
if (cupsLastError() >= IPP_BAD_REQUEST)
fputs("lp: error - scheduler not responding!\n", stderr);
else
fputs("lp: error - no default destination available.\n", stderr);
return (1);
}
+5 -5
Ver Arquivo
@@ -7,11 +7,11 @@
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups.css">
<MAP NAME="navbar">
<AREA SHAPE="RECT" COORDS="12,10,50,20" HREF="http://www.easysw.com" ALT="Easy Software Produkt-Homepage">
<AREA SHAPE="RECT" COORDS="82,10,226,20" HREF="admin" ALT="Einrichtungsaufgaben">
<AREA SHAPE="RECT" COORDS="235,10,403,20" HREF="classes" ALT="Druckerklassen verwalten">
<AREA SHAPE="RECT" COORDS="412,10,488,20" HREF="documentation.html" ALT="Online Hilfe">
<AREA SHAPE="RECT" COORDS="497,10,590,20" HREF="jobs" ALT="Druckauftr&auml;ge">
<AREA SHAPE="RECT" COORDS="599,10,717,20" HREF="printers" ALT="Drucker verwalten">
<AREA SHAPE="RECT" COORDS="82,10,226,20" HREF="/admin" ALT="Einrichtungsaufgaben">
<AREA SHAPE="RECT" COORDS="235,10,403,20" HREF="/classes" ALT="Druckerklassen verwalten">
<AREA SHAPE="RECT" COORDS="412,10,488,20" HREF="/documentation.html" ALT="Online Hilfe">
<AREA SHAPE="RECT" COORDS="497,10,590,20" HREF="/jobs" ALT="Druckauftr&auml;ge">
<AREA SHAPE="RECT" COORDS="599,10,717,20" HREF="/printers" ALT="Drucker verwalten">
<AREA SHAPE="RECT" COORDS="726,10,887,20" HREF="http://www.cups.org" ALT="Aktuelle CUPS Software">
</MAP>
</HEAD>
+4 -4
Ver Arquivo
@@ -30,18 +30,18 @@
<TD>
{job_state>5?
{job_k_octets>0?
<A HREF="/admin/?op=restart-job&job_id={job_id}">
<A HREF="/jobs/?op=restart-job&job_id={job_id}">
<IMG SRC="/images/restart-job.gif" ALT="Auftrag wieder starten" BORDER="0"></A>
:}:}
{job_state>6?:
{job_state=4?
<A HREF="/admin/?op=release-job&job_id={job_id}">
<A HREF="/jobs/?op=release-job&job_id={job_id}">
<IMG SRC="/images/release-job.gif" ALT="Auftrag freigeben" BORDER="0"></A>
:
<A HREF="/admin/?op=hold-job&job_id={job_id}">
<A HREF="/jobs/?op=hold-job&job_id={job_id}">
<IMG SRC="/images/hold-job.gif" ALT="Auftrag anhalten" BORDER="0"></A>
}
<A HREF="/admin/?op=cancel-job&job_id={job_id}">
<A HREF="/jobs/?op=cancel-job&job_id={job_id}">
<IMG SRC="/images/cancel-job.gif" ALT="Auftrag l&ouml;schen" BORDER="0"></A>
}
&nbsp;</TD>