Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet a256ef2ad4 Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.1.17@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
114 arquivos alterados com 10292 adições e 10500 exclusões
+95 -1
Ver Arquivo
@@ -1,6 +1,100 @@
CHANGES.txt - 10/07/2002
CHANGES.txt - 11/27/2002
------------------------
CHANGES IN CUPS V1.1.17
- The "manual_copies" option did not work when the LPD
backend had to retry a print job.
- The image filters did not convert GIF images properly.
- The RunAsUser option was incompatible with the new
daemon-mode code in 1.1.16.
- Fixed a problem with the Set-Job-Attributes and
PostScript job ticket code in the scheduler - the
"last" attribute pointer was never updated, which
could cause the scheduler to crash when applying job
ticket data.
- Fixed a problem in the scheduler that caused it to
continue processing HTTP requests on a connection
after it was shutdown.
- The scheduler now allows accounts authenticated via
PAM to not have a corresponding UNIX account, but
group membership still requires the account name to be
listed in the UNIX group file(s)...
- The scheduler used a fixed-size (16k) buffer for
encoding job options for filters; it now dynamically
allocates and expands the buffer as needed depending
on the options that are sent in a job.
- The pdftops filter didn't support all of the MacOS
characters for MacRoman encoded fonts.
- The cupsEncodeOptions() and cupsParseOptions()
functions now conform to the grammer defined by the
current draft of the PAPI specification. The main
difference is that option=yes and option=no are no
longer treated as boolean options.
- The IPP backend didn't honor the encryption settings
in /etc/cups/client.conf.
- Fixed a potential bug in the HTTP code which was
caused by servers sending the status line and
newline(s) in separate packets.
- User-defined classification strings are now printed
verbatim - previously the classification box would be
empty.
- Re-added Spanish to the list of PPD languages that
CUPS supports.
- CUPS API library user and temp file updates for
Windows.
- The image filters did not properly handle grayscale
printing of Sun Raster images.
- The scheduler never reset the NumJobs variable before
loading the job list (previously this only happened on
a full start, so the problem was never apparent...)
- The HTTP and IPP read/write code didn't handle EINTR
(interrupted system call) errors.
- When under high load, the scheduler could abort due to
the wrong errno value after a select() call. This was
caused by the child signal handler.
- Added new load tests to the test target to verify that
cupsd can handle hundreds of simultaneous jobs without
error.
- The Solaris USB backend now supports the new device
URI syntax.
- The ppdOpen*() functions now reset the numeric locale
settings while loading a PPD file.
- Fixed the libtool build rules.
- The manpage make rules didn't use $(MAKE) and
$(MFLAGS) for the language subdirectories.
- Now set the LC_TIME locale category to get the
properly localized time string.
- Fixed a problem in the scheduler that would cause the
web interface problems when adding, modifying, or
configuring a printer or class.
- The backends now ignore SIGPIPE so that failed job
filters will not stop a print queue.
- The lpstat command did not allow for destination lists
("lpstat -v printer1,printer2")
- Fixed parsing of long filter status messages in the
scheduler.
- Added some startup performance enhancements to the
scheduler so that the printer object information is
regenerated fewer times and the MIME type database is
not filled with lots of empty filters for raw/direct
queues.
- The LPD backend now sends the job title as the print
filename.
- Added support for variable sizes in the EPSON dot
matrix printer drivers. This allows for pages as
short as 1/2" (1 row of labels) and does not do an
automatic form feed.
- French translation updates.
- The filters did not quote the page label string when
embedding it in PostScript output.
- The serial backend now enumerates serial ports under
MacOS X.
- The pdftops filter contained font rasterizer code that
wasn't being used and that depended on X11. This code
has been removed.
CHANGES IN CUPS V1.1.16
- The cancel and lprm commands now both display an error
+5 -1
Ver Arquivo
@@ -1,4 +1,4 @@
CREDITS.txt - 01/27/2000
CREDITS.txt - 12/02/2002
------------------------
Few projects are completed by one person, and CUPS is no exception. We'd
@@ -12,11 +12,15 @@ like to thank the following individuals for their contributions:
Guy Harris - *BSD shared libraries and lots of other fixes.
Wang Jian - CUPS RPM corrections.
Roderick Johnstone - Beta tester of the millenium.
Till Kamppeter - Bug fixes, beta testing, evangelism.
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
Mark Lawrence - Microsoft interoperability testing.
Jeff Licquia - Bug fixes, beta testing, evangelism.
Jason McMullan - Original CUPS RPM distributions.
Wes Morgan - *BSD fixes.
Ulrich Oldendorf - German locale.
Giulio Orsero - Bug fixes and testing.
Kurt Pfeifle - Bug fixes, beta testing, evangelism.
Petter Reinholdtsen - HP-UX compiler stuff.
Stuart Stevens - HP JetDirect IPP information.
Kiko - Bug fixes.
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
INSTALL - CUPS v1.1.16 - 10/07/2002
INSTALL - CUPS v1.1.17 - 12/02/2002
-----------------------------------
This file describes how to compile and install CUPS from source
+1
Ver Arquivo
@@ -83,6 +83,7 @@ LIBZ = @LIBZ@
#
ARFLAGS = @ARFLAGS@
BACKLIBS = @BACKLIBS@
CFLAGS = $(RC_CFLAGS) @CFLAGS@ -I.. $(OPTIONS)
CXXFLAGS = $(RC_CFLAGS) @CXXFLAGS@ -I.. $(OPTIONS)
CXXLIBS = @CXXLIBS@
+2 -2
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.1.16 - 10/07/2002
README - CUPS v1.1.17 - 12/02/2002
----------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -258,7 +258,7 @@ The PostScript RIP software (pstoraster) is based on the GNU
Ghostscript 5.50 core, Copyright 1986-1998 by Aladdin
Enterprises.
The PDF filter (pdftops) is based on the Xpdf 0.92 software,
The PDF filter (pdftops) is based on the Xpdf 1.01 software,
Copyright 1996-2002 by Derek B. Noonburg.
This software is based in part on the work of the Independent
+2 -2
Ver Arquivo
@@ -122,7 +122,7 @@ scsi.o: scsi.c scsi-irix.c scsi-linux.c
serial: serial.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o serial serial.o $(LIBS)
$(CC) $(LDFLAGS) -o serial serial.o $(BACKLIBS) $(LIBS)
#
@@ -140,7 +140,7 @@ socket: socket.o ../cups/$(LIBCUPS)
usb: usb.o ../cups/$(LIBCUPS)
echo Linking $@...
$(CC) $(LDFLAGS) -o usb usb.o $(LIBS)
$(CC) $(LDFLAGS) -o usb usb.o $(BACKLIBS) $(LIBS)
#
+15 -1
Ver Arquivo
@@ -115,6 +115,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -203,7 +217,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
{
fprintf(stderr, "INFO: Connecting to %s on port %d...\n", hostname, port);
if ((http = httpConnect(hostname, port)) == NULL)
if ((http = httpConnectEncrypt(hostname, port, cupsEncryption())) == NULL)
{
if (getenv("CLASS") != NULL)
{
+22 -6
Ver Arquivo
@@ -115,6 +115,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int reserve; /* Reserve priviledged port? */
int manual_copies, /* Do manual copies? */
copies; /* Number of copies */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action;
/* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
@@ -123,6 +127,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -435,6 +453,7 @@ lpd_queue(char *hostname, /* I - Host to connect to */
char status; /* Status byte from command */
struct sockaddr_in addr; /* Socket address */
struct hostent *hostaddr; /* Host address */
int copy; /* Copies written */
size_t nbytes, /* Number of bytes written */
tbytes; /* Total bytes written */
char buffer[8192]; /* Output buffer */
@@ -614,9 +633,8 @@ lpd_queue(char *hostname, /* I - Host to connect to */
}
snprintf(cptr, sizeof(control) - (cptr - control),
"UdfA%03d%s\nNdfA%03d%s\n",
getpid() % 1000, localhost,
getpid() % 1000, localhost);
"UdfA%03d%s\nN%s\n",
getpid() % 1000, localhost, title);
fprintf(stderr, "DEBUG: Control file is:\n%s", control);
@@ -667,7 +685,7 @@ lpd_queue(char *hostname, /* I - Host to connect to */
(unsigned)filestats.st_size);
tbytes = 0;
while (manual_copies > 0)
for (copy = 0; copy < manual_copies; copy ++)
{
rewind(fp);
@@ -684,8 +702,6 @@ lpd_queue(char *hostname, /* I - Host to connect to */
else
tbytes += nbytes;
}
manual_copies --;
}
if (tbytes < filestats.st_size)
+14
Ver Arquivo
@@ -105,6 +105,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
+17
Ver Arquivo
@@ -113,6 +113,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
int fp; /* Print file */
int copies; /* Number of copies to print */
int status; /* Exit status */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
@@ -121,6 +124,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
+97
Ver Arquivo
@@ -74,6 +74,13 @@
# endif /* CNEW_RTSCTS */
#endif /* !CRTSCTS */
#if defined(__APPLE__)
# include <CoreFoundation/CoreFoundation.h>
# include <IOKit/IOKitLib.h>
# include <IOKit/serial/IOSerialKeys.h>
# include <IOKit/IOBSD.h>
#endif /* __APPLE__ */
/*
* Local functions...
@@ -126,6 +133,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -884,7 +905,83 @@ list_devices(void)
device, i, j + 1);
}
}
#elif defined(__APPLE__)
/*
* Standard serial ports on MacOS X...
*/
kern_return_t kernResult;
mach_port_t masterPort;
io_iterator_t serialPortIterator;
CFMutableDictionaryRef classesToMatch;
io_object_t serialService;
printf("serial serial \"Unknown\" \"Serial Printer (serial)\"\n");
kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort);
if (KERN_SUCCESS != kernResult)
return;
/*
* Serial devices are instances of class IOSerialBSDClient.
*/
classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue);
if (classesToMatch != NULL)
{
CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey),
CFSTR(kIOSerialBSDRS232Type));
kernResult = IOServiceGetMatchingServices(masterPort, classesToMatch,
&serialPortIterator);
if (kernResult == KERN_SUCCESS)
{
while ((serialService = IOIteratorNext(serialPortIterator)))
{
CFTypeRef serialNameAsCFString;
CFTypeRef bsdPathAsCFString;
char serialName[128];
char bsdPath[1024];
Boolean result;
serialNameAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOTTYDeviceKey),
kCFAllocatorDefault, 0);
if (serialNameAsCFString)
{
result = CFStringGetCString(serialNameAsCFString, serialName,
sizeof(serialName),
kCFStringEncodingASCII);
CFRelease(serialNameAsCFString);
if (result)
{
bsdPathAsCFString =
IORegistryEntryCreateCFProperty(serialService,
CFSTR(kIOCalloutDeviceKey),
kCFAllocatorDefault, 0);
if (bsdPathAsCFString)
{
result = CFStringGetCString(bsdPathAsCFString, bsdPath,
sizeof(bsdPath),
kCFStringEncodingASCII);
CFRelease(bsdPathAsCFString);
if (result)
printf("serial serial:%s?baud=115200 \"Unknown\" \"%s\"\n", bsdPath,
serialName);
}
}
}
IOObjectRelease(serialService);
}
IOObjectRelease(serialPortIterator); /* Release the iterator. */
}
}
#endif
}
+14
Ver Arquivo
@@ -96,6 +96,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
+174 -15
Ver Arquivo
@@ -59,6 +59,10 @@
# define LPIOC_GET_DEVICE_ID(len) _IOC(_IOC_READ, 'P', IOCNR_GET_DEVICE_ID, len)
#endif /* __linux */
#ifdef __sun
# include <sys/ecppio.h>
#endif /* __sun */
/*
* Local functions...
@@ -106,6 +110,20 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
setbuf(stderr, NULL);
/*
* Ignore SIGPIPE signals...
*/
#ifdef HAVE_SIGSET
sigset(SIGPIPE, SIG_IGN);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &action, NULL);
#else
signal(SIGPIPE, SIG_IGN);
#endif /* HAVE_SIGSET */
/*
* Check command-line...
*/
@@ -208,6 +226,27 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
#endif /* HAVE_SIGSET */
}
#ifdef __linux
/*
* Show the printer status before we send the file; normally, we'd
* do this while we write data to the printer, however at least some
* Linux kernels have buggy USB drivers which don't like to be
* queried while sending data to the printer...
*/
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned a port status of %02X...\n", status);
if (status & LP_NOPA)
fputs("WARNING: Media tray empty!\n", stderr);
else if (status & LP_ERR)
fputs("WARNING: Printer fault!\n", stderr);
else if (status & LP_OFFL)
fputs("WARNING: Printer off-line.\n", stderr);
}
#endif /* __linux */
/*
* Finally, send the print file...
*/
@@ -234,19 +273,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
while (nbytes > 0)
{
#ifdef __linux
if (ioctl(fd, LPGETSTATUS, &status) == 0)
{
fprintf(stderr, "DEBUG: LPGETSTATUS returned %02X...\n", status);
if (status & LP_NOPA)
fputs("INFO: Media tray empty!\n", stderr);
else if (status & LP_ERR)
fputs("INFO: Printer fault!\n", stderr);
else if (status & LP_OFFL)
fputs("INFO: Printer off-line.\n", stderr);
}
#endif /* __linux */
if ((wbytes = write(fd, bufptr, nbytes)) < 0)
if (errno == ENOTTY)
@@ -467,6 +493,20 @@ list_devices(void)
{
length = (((unsigned)device_id[0] & 255) << 8) +
((unsigned)device_id[1] & 255);
/*
* Check to see if the length is larger than our buffer; first
* assume that the vendor incorrectly implemented the 1284 spec,
* and then limit the length to the size of our buffer...
*/
if (length > (sizeof(device_id) - 2))
length = (((unsigned)device_id[1] & 255) << 8) +
((unsigned)device_id[0] & 255);
if (length > (sizeof(device_id) - 2))
length = sizeof(device_id) - 2;
memcpy(device_id, device_id + 2, length);
device_id[length] = '\0';
}
@@ -491,15 +531,62 @@ list_devices(void)
}
#elif defined(__sgi)
#elif defined(__sun)
int i; /* Looping var */
char device[255]; /* Device filename */
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
device_uri[1024], /* Device URI string */
make_model[1024]; /* Make and model */
# ifdef ECPPIOC_GETDEVID
struct ecpp_device_id did; /* Device ID buffer */
# endif /* ECPPIOC_GETDEVID */
/*
* Open each USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
# ifndef ECPPIOC_GETDEVID
if (!access(device, 0))
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# else
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
close(fd);
}
else
device_id[0] = '\0';
if (device_id[0])
{
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
printf("direct %s \"%s\" \"USB Printer #%d\"\n", device_uri,
make_model, i + 1);
}
else
printf("direct usb:%s \"Unknown\" \"USB Printer #%d\"\n", device, i + 1);
# endif /* !ECPPIOC_GETDEVID */
}
#elif defined(__hpux)
#elif defined(__osf)
@@ -608,6 +695,78 @@ open_device(const char *uri) /* I - Device URI */
close(fd);
}
/*
* Couldn't find the printer, return "no such device or address"...
*/
errno = ENODEV;
return (-1);
}
#elif defined(__sun) && defined(ECPPIOC_GETDEVID)
else if (strncmp(uri, "usb://", 6) == 0)
{
/*
* For Solaris, try looking up the device serial number or model...
*/
int i; /* Looping var */
int fd; /* File descriptor */
char device[255], /* Device filename */
device_id[1024], /* Device ID string */
make_model[1024], /* Make and model */
device_uri[1024]; /* Device URI string */
struct ecpp_device_id did; /* Device ID buffer */
/*
* Find the correct USB device...
*/
for (i = 0; i < 8; i ++)
{
sprintf(device, "/dev/usb/printer%d", i);
if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
{
did.mode = ECPP_CENTRONICS;
did.len = sizeof(device_id);
did.rlen = 0;
did.addr = device_id;
if (ioctl(fd, ECPPIOC_GETDEVID, &did) == 0)
{
if (did.rlen < (sizeof(device_id) - 1))
device_id[did.rlen] = '\0';
else
device_id[sizeof(device_id) - 1] = '\0';
}
else
device_id[0] = '\0';
}
else
device_id[0] = '\0';
if (device_id[0])
{
/*
* Got the device ID - is this the one?
*/
decode_device_id(i, device_id, make_model, sizeof(make_model),
device_uri, sizeof(device_uri));
if (strcmp(uri, device_uri) == 0)
return (fd); /* Yes, return this file descriptor... */
}
/*
* This wasn't the one...
*/
close(fd);
}
/*
* Couldn't find the printer, return "no such device or address"...
*/
+6 -6
Ver Arquivo
@@ -447,7 +447,7 @@ do_am_class(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -870,7 +870,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1234,7 +1234,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_NOT_AUTHORIZED;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1315,7 +1315,7 @@ do_delete_class(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1391,7 +1391,7 @@ do_delete_printer(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
@@ -1462,7 +1462,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
ippDelete(response);
}
else
status = IPP_GONE;
status = cupsLastError();
if (status > IPP_OK_CONFLICT)
{
+4
Ver Arquivo
@@ -72,6 +72,10 @@ ippSetServerVersion(void)
cgiSetVariable("SERVER_NAME", getenv("SERVER_NAME"));
cgiSetVariable("REMOTE_USER", getenv("REMOTE_USER"));
cgiSetVariable("CUPS_VERSION", CUPS_SVERSION);
#ifdef LC_TIME
setlocale(LC_TIME, "");
#endif /* LC_TIME */
}
+4 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: mime.types 2599 2002-08-09 00:00:55Z mike $"
# "$Id: mime.types 2982 2002-11-24 22:32:01Z mike $"
#
# MIME types file for the Common UNIX Printing System (CUPS).
#
@@ -101,7 +101,7 @@ image/x-portable-pixmap ppm string(0,P3) string(0,P6)
image/x-sgi-rgb rgb sgi bw icon short(0,474)
image/x-xbitmap xbm
image/x-xpixmap xpm ascii(0,1024) + string(3,"XPM")
image/x-xwindowdump xwd
image/x-xwindowdump xwd string(4,<00000007>)
image/x-sun-raster ras string(0,<59a66a95>)
#image/fpx fpx
@@ -129,6 +129,7 @@ text/plain txt printable(0,1024)
# CUPS-specific types...
#
application/vnd.cups-command string(0,'#CUPS-COMMAND')
application/vnd.cups-form string(0,"<CUPSFORM>")
application/vnd.cups-postscript contains(0,128,<1B>%-12345X) + \
(contains(0,1024,"LANGUAGE=POSTSCRIPT") \
@@ -153,5 +154,5 @@ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
#application/octet-stream
#
# End of "$Id: mime.types 2599 2002-08-09 00:00:55Z mike $".
# End of "$Id: mime.types 2982 2002-11-24 22:32:01Z mike $".
#
+14 -2
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-common.m4 2509 2002-06-12 11:29:48Z mike $"
dnl "$Id: cups-common.m4 2893 2002-10-15 13:59:06Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -157,6 +157,18 @@ esac
AC_SUBST(ARFLAGS)
dnl Libraries for the backends...
case $uname in
Darwin*)
BACKLIBS="-framework CoreFoundation -framework IOKit"
;;
*)
BACKLIBS=""
;;
esac
AC_SUBST(BACKLIBS)
dnl
dnl End of "$Id: cups-common.m4 2509 2002-06-12 11:29:48Z mike $".
dnl End of "$Id: cups-common.m4 2893 2002-10-15 13:59:06Z mike $".
dnl
+2 -11
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-compiler.m4 2822 2002-09-26 11:15:59Z mike $"
dnl "$Id: cups-compiler.m4 2966 2002-11-13 19:12:18Z mike $"
dnl
dnl Common configuration stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -180,15 +180,6 @@ else
esac
fi
case $uname in
*BSD | Darwin*)
ARFLAGS="-rcv"
;;
*)
ARFLAGS="crvs"
;;
esac
dnl
dnl End of "$Id: cups-compiler.m4 2822 2002-09-26 11:15:59Z mike $".
dnl End of "$Id: cups-compiler.m4 2966 2002-11-13 19:12:18Z mike $".
dnl
+8 -4
Ver Arquivo
@@ -1,5 +1,5 @@
dnl
dnl "$Id: cups-directories.m4 2138 2002-02-12 19:05:39Z mike $"
dnl "$Id: cups-directories.m4 2914 2002-10-17 17:05:39Z mike $"
dnl
dnl Directory stuff for the Common UNIX Printing System (CUPS).
dnl
@@ -81,6 +81,10 @@ if test "$sysconfdir" = "\${prefix}/etc"; then
fi
dnl Fix "libdir" variable for IRIX 6.x...
if test "$libdir" = "\${exec_prefix}/lib"; then
libdir="$exec_prefix/lib"
fi
if test "$uname" = "IRIX" -a $uversion -ge 62; then
libdir="$exec_prefix/lib32"
fi
@@ -180,8 +184,8 @@ case "$uname" in
*)
# All others
INSTALL_SYSV="install-sysv"
CUPS_SERVERBIN="$exec_prefix/lib/cups"
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
CUPS_SERVERBIN="$libdir/cups"
AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$libdir/cups")
;;
esac
@@ -234,5 +238,5 @@ AC_SUBST(CUPS_FONTPATH)
AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
dnl
dnl End of "$Id: cups-directories.m4 2138 2002-02-12 19:05:39Z mike $".
dnl End of "$Id: cups-directories.m4 2914 2002-10-17 17:05:39Z mike $".
dnl
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@
* Version of software...
*/
#define CUPS_SVERSION "CUPS v1.1.16"
#define CUPS_SVERSION "CUPS v1.1.17"
/*
+1 -1
Ver Arquivo
@@ -23,7 +23,7 @@
# WWW: http://www.cups.org
#
VERSION="1.1.16"
VERSION="1.1.17"
APIVERSION="1.1"
prefix=@prefix@
+99
Ver Arquivo
@@ -15,6 +15,105 @@ Package=<4>
###############################################################################
Project: "enumports"=.\visualc\enumports.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fltk"="..\fltk-1.1\visualc\fltk.lib.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "fltkimages"="..\fltk-1.1\visualc\fltkimages.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "gui"=.\gui\gui.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "printers"=.\gui\printers.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name cups
End Project Dependency
Begin Project Dependency
Project_Dep_Name fltk
End Project Dependency
Begin Project Dependency
Project_Dep_Name gui
End Project Dependency
Begin Project Dependency
Project_Dep_Name fltkimages
End Project Dependency
Begin Project Dependency
Project_Dep_Name zlib
End Project Dependency
}}}
###############################################################################
Project: "restartspooler"=.\visualc\restartspooler.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "zlib"="..\htmldoc-1.8\visualc\zlib.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
+8 -1
Ver Arquivo
@@ -29,7 +29,7 @@
%vendor Easy Software Products
%license LICENSE.txt
%readme README.txt
%version 1.1.16
%version 1.1.17
%provides cupsys
%provides cups-devel
%provides cupsys-devel
@@ -260,6 +260,9 @@ f 0444 root sys $DATADIR/model ppd/*.ppd
d 0555 root sys $DATADIR/templates -
c 0444 root sys $DATADIR/templates templates/*.tmpl
d 0555 root sys $DATADIR/templates/fr -
c 0444 root sys $DATADIR/templates/fr templates/fr/*.tmpl
# Config files
d 0555 root sys $SERVERROOT -
d 0711 $CUPS_USER $CUPS_GROUP $SERVERROOT/certs -
@@ -300,6 +303,10 @@ d 0555 root sys $DOCDIR -
f 0444 root sys $DOCDIR doc/*.css
f 0444 root sys $DOCDIR doc/*.html
f 0444 root sys $DOCDIR doc/*.pdf
d 0555 root sys $DOCDIR/fr -
f 0444 root sys $DOCDIR/fr doc/fr/*.css
f 0444 root sys $DOCDIR/fr doc/fr/*.html
f 0444 root sys $DOCDIR/fr doc/fr/*.pdf
d 0555 root sys $DOCDIR/images -
f 0444 root sys $DOCDIR/images doc/images/*.gif
+3 -3
Ver Arquivo
@@ -1,5 +1,5 @@
#
# "$Id: cups.spec 2880 2002-10-07 14:45:24Z mike $"
# "$Id: cups.spec 2890 2002-10-15 13:26:34Z 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.16
Version: 1.1.17
Release: 1
Copyright: GPL
Group: System Environment/Daemons
@@ -203,5 +203,5 @@ rm -rf $RPM_BUILD_ROOT
/usr/share/man/fr/man3/*
#
# End of "$Id: cups.spec 2880 2002-10-07 14:45:24Z mike $".
# End of "$Id: cups.spec 2890 2002-10-15 13:26:34Z mike $".
#
+30 -2
Ver Arquivo
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\visualc" /I ".." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "../visualc" /I ".." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\visualc" /I ".." /I "../visualc" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "../visualc" /I ".." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -93,10 +93,26 @@ SOURCE=.\emit.c
# End Source File
# Begin Source File
SOURCE=.\encode.c
# End Source File
# Begin Source File
SOURCE=".\http-addr.c"
# End Source File
# Begin Source File
SOURCE=".\http-support.c"
# End Source File
# Begin Source File
SOURCE=.\http.c
# End Source File
# Begin Source File
SOURCE=".\ipp-support.c"
# End Source File
# Begin Source File
SOURCE=.\ipp.c
# End Source File
# Begin Source File
@@ -105,6 +121,10 @@ SOURCE=.\language.c
# End Source File
# Begin Source File
SOURCE=..\oemlicense\license.c
# End Source File
# Begin Source File
SOURCE=.\mark.c
# End Source File
# Begin Source File
@@ -137,6 +157,10 @@ SOURCE=.\string.c
# End Source File
# Begin Source File
SOURCE=.\tempfile.c
# End Source File
# Begin Source File
SOURCE=.\usersys.c
# End Source File
# Begin Source File
@@ -173,6 +197,10 @@ SOURCE=.\language.h
# End Source File
# Begin Source File
SOURCE=..\oemlicense\license.h
# End Source File
# Begin Source File
SOURCE=.\md5.h
# End Source File
# Begin Source File
+2 -2
Ver Arquivo
@@ -48,10 +48,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0116
# define CUPS_VERSION 1.0117
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 1
# define CUPS_VERSION_PATCH 16
# define CUPS_VERSION_PATCH 17
# define CUPS_DATE_ANY -1
+2 -4
Ver Arquivo
@@ -197,9 +197,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
attr->group_tag = IPP_TAG_JOB;
if (strcasecmp(options[i].value, "true") == 0 ||
strcasecmp(options[i].value, "false") == 0 ||
strcasecmp(options[i].value, "yes") == 0 ||
strcasecmp(options[i].value, "no") == 0)
strcasecmp(options[i].value, "false") == 0)
attr->value_tag = IPP_TAG_BOOLEAN;
else
attr->value_tag = IPP_TAG_NAME;
@@ -287,7 +285,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
break;
case IPP_TAG_BOOLEAN :
if (strcasecmp(val, "true") == 0 || strcasecmp(val, "yes") == 0)
if (strcasecmp(val, "true") == 0)
{
/*
* Boolean value - true...
+60 -7
Ver Arquivo
@@ -179,7 +179,9 @@ void
httpInitialize(void)
{
#ifdef HAVE_LIBSSL
# ifndef WIN32
struct timeval curtime; /* Current time in microseconds */
# endif // !WIN32
int i; /* Looping var */
unsigned char data[1024]; /* Seed data */
#endif /* HAVE_LIBSSL */
@@ -217,8 +219,11 @@ httpInitialize(void)
* it is the best we can do (on others, this seed isn't even used...)
*/
#ifdef WIN32
#else
gettimeofday(&curtime, NULL);
srand(curtime.tv_sec + curtime.tv_usec);
#endif // WIN32
for (i = 0; i < sizeof(data); i ++)
data[i] = rand(); /* Yes, this is a poor source of random data... */
@@ -947,10 +952,14 @@ httpRead(http_t *http, /* I - HTTP data */
{
#ifdef WIN32
http->error = WSAGetLastError();
#else
http->error = errno;
#endif /* WIN32 */
return (-1);
#else
if (errno != EINTR)
{
http->error = errno;
return (-1);
}
#endif /* WIN32 */
}
else
return (0);
@@ -969,7 +978,7 @@ httpRead(http_t *http, /* I - HTTP data */
http->used -= length;
if (http->used > 0)
memcpy(http->buffer, http->buffer + length, http->used);
memmove(http->buffer, http->buffer + length, http->used);
}
#ifdef HAVE_LIBSSL
else if (http->tls)
@@ -985,11 +994,16 @@ httpRead(http_t *http, /* I - HTTP data */
if (bytes > 0)
http->data_remaining -= bytes;
else if (bytes < 0)
{
#ifdef WIN32
http->error = WSAGetLastError();
#else
http->error = errno;
if (errno == EINTR)
bytes = 0;
else
http->error = errno;
#endif /* WIN32 */
}
if (http->data_remaining == 0)
{
@@ -1100,6 +1114,22 @@ httpWrite(http_t *http, /* I - HTTP data */
if (bytes < 0)
{
#ifdef WIN32
if (WSAGetLastError() != http->error)
{
http->error = WSAGetLastError();
continue;
}
#else
if (errno == EINTR)
continue;
else if (errno != http->error)
{
http->error = errno;
continue;
}
#endif /* WIN32 */
DEBUG_puts("httpWrite: error writing data...\n");
return (-1);
@@ -1235,7 +1265,9 @@ httpGets(char *line, /* I - Line to read into */
DEBUG_printf(("httpGets(): recv() error %d!\n", WSAGetLastError()));
#else
if (errno != http->error)
if (errno == EINTR)
continue;
else if (errno != http->error)
{
http->error = errno;
continue;
@@ -1260,6 +1292,7 @@ httpGets(char *line, /* I - Line to read into */
http->used += bytes;
bufend += bytes;
bufptr = bufend;
}
}
while (bufptr >= bufend && http->used < HTTP_MAX_BUFFER);
@@ -1296,7 +1329,7 @@ httpGets(char *line, /* I - Line to read into */
http->used -= bytes;
if (http->used > 0)
memcpy(http->buffer, bufptr, http->used);
memmove(http->buffer, bufptr, http->used);
DEBUG_printf(("httpGets(): Returning \"%s\"\n", line));
return (line);
@@ -1341,7 +1374,27 @@ httpPrintf(http_t *http, /* I - HTTP data */
nbytes = send(http->fd, bufptr, bytes - tbytes, 0);
if (nbytes < 0)
{
nbytes = 0;
#ifdef WIN32
if (WSAGetLastError() != http->error)
{
http->error = WSAGetLastError();
continue;
}
#else
if (errno == EINTR)
continue;
else if (errno != http->error)
{
http->error = errno;
continue;
}
#endif /* WIN32 */
return (-1);
}
}
return (bytes);
+2 -2
Ver Arquivo
@@ -2031,7 +2031,7 @@ ipp_read(http_t *http, /* I - Client connection */
http->data_remaining -= bytes;
if (http->used > 0)
memcpy(http->buffer, http->buffer + bytes, http->used);
memmove(http->buffer, http->buffer + bytes, http->used);
if (http->data_remaining == 0)
{
@@ -2047,7 +2047,7 @@ ipp_read(http_t *http, /* I - Client connection */
}
}
}
else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) <= 0)
else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) < 0)
break;
}
+244 -11
Ver Arquivo
@@ -428,6 +428,7 @@ ppd_add_size(ppd_file_t *ppd, /* I - PPD file */
ppd_file_t * /* O - PPD file record */
ppdOpen(FILE *fp) /* I - File to read from */
{
char *oldlocale; /* Old locale settings */
int i, j, k, m; /* Looping vars */
int count; /* Temporary count */
ppd_file_t *ppd; /* PPD file record */
@@ -456,12 +457,6 @@ ppdOpen(FILE *fp) /* I - File to read from */
cups_lang_t *language; /* Default language */
/*
* Get the default language for the user...
*/
language = cupsLangDefault();
/*
* Range check input...
*/
@@ -504,6 +499,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
ppd->colorspace = PPD_CS_GRAY;
ppd->landscape = -90;
/*
* Get the default language for the user...
*/
language = cupsLangDefault();
#ifdef LC_NUMERIC
oldlocale = setlocale(LC_NUMERIC, "C");
#else
oldlocale = setlocale(LC_ALL, "C");
#endif /* LC_NUMERIC */
/*
* Read lines from the PPD file and add them to the file record...
*/
@@ -547,6 +554,15 @@ ppdOpen(FILE *fp) /* I - File to read from */
*/
ppdClose(ppd);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -670,7 +686,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (filter == NULL)
{
safe_free(filter);
ppdClose(ppd);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -702,7 +728,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (tempfonts == NULL)
{
safe_free(string);
ppdClose(ppd);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -736,14 +772,34 @@ ppdOpen(FILE *fp) /* I - File to read from */
CUPS_MSG_GENERAL))) == NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
if ((option = ppd_get_option(temp, "PageSize")) == NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
}
@@ -751,7 +807,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if ((choice = ppd_add_choice(option, "Custom")) == NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -803,16 +869,38 @@ ppdOpen(FILE *fp) /* I - File to read from */
CUPS_MSG_GENERAL))) == NULL)
{
DEBUG_puts("Unable to get general group!");
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
if ((option = ppd_get_option(temp, "PageSize")) == NULL)
{
DEBUG_puts("Unable to get PageSize option!");
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
}
@@ -820,8 +908,19 @@ ppdOpen(FILE *fp) /* I - File to read from */
if ((choice = ppd_add_choice(option, "Custom")) == NULL)
{
DEBUG_puts("Unable to add Custom choice!");
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -833,16 +932,38 @@ ppdOpen(FILE *fp) /* I - File to read from */
if ((option = ppdFindOption(ppd, "PageSize")) == NULL)
{
DEBUG_puts("Unable to find PageSize option!");
ppdClose(ppd);
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
if ((choice = ppdFindChoice(option, "Custom")) == NULL)
{
DEBUG_puts("Unable to find Custom choice!");
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -919,8 +1040,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
strlen(string) + 1);
if (temp == NULL)
{
ppdClose(ppd);
safe_free(string);
ppdClose(ppd);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -966,8 +1097,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (group == NULL)
{
ppdClose(ppd);
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -980,8 +1121,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (option == NULL)
{
ppdClose(ppd);
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1035,7 +1186,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (group == NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1051,7 +1212,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (option == NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1083,7 +1254,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (group != NULL)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1123,7 +1304,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (sscanf(string, "%f%40s%40s", &order, name, keyword) != 3)
{
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1215,8 +1406,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
if (constraint == NULL)
{
ppdClose(ppd);
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1297,7 +1498,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
*/
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1315,7 +1526,17 @@ ppdOpen(FILE *fp) /* I - File to read from */
*/
ppdClose(ppd);
safe_free(string);
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (NULL);
}
@@ -1449,6 +1670,18 @@ ppdOpen(FILE *fp) /* I - File to read from */
}
}
/*
* Reset language preferences...
*/
cupsLangFree(language);
#ifdef LC_NUMERIC
setlocale(LC_NUMERIC, oldlocale);
#else
setlocale(LC_ALL, oldlocale);
#endif /* LC_NUMERIC */
return (ppd);
}
+3 -2
Ver Arquivo
@@ -111,13 +111,14 @@ cupsTempFd(char *filename, /* I - Pointer to buffer */
* Get the current time of day...
*/
curtime = GetTickCount();
curtime = GetTickCount() + tries;
/*
* Format a string using the hex time values...
*/
snprintf(filename, len - 1, "%s/%08lx", tmpdir, curtime);
snprintf(filename, len - 1, "%s/%05lx%08lx", tmpdir,
GetCurrentProcessId(), curtime);
#else
/*
* Get the current time of day...
+25 -6
Ver Arquivo
@@ -47,6 +47,10 @@
#include <stdlib.h>
#include <ctype.h>
#ifdef WIN32
# include <windows.h>
#endif /* WIN32 */
/*
* Local functions...
@@ -123,7 +127,8 @@ cupsEncryption(void)
*/
while (cups_get_line(line, sizeof(line), fp) != NULL)
if (strncmp(line, "Encryption ", 11) == 0)
if (strncmp(line, "Encryption ", 11) == 0 ||
strncmp(line, "Encryption\t", 11) == 0)
{
/*
* Got it! Drop any trailing newline and find the name...
@@ -238,7 +243,8 @@ cupsServer(void)
*/
while (cups_get_line(line, sizeof(line), fp) != NULL)
if (strncmp(line, "ServerName ", 11) == 0)
if (strncmp(line, "ServerName ", 11) == 0 ||
strncmp(line, "ServerName\t", 11) == 0)
{
/*
* Got it! Drop any trailing newline and find the name...
@@ -309,9 +315,9 @@ cupsSetUser(const char *user) /* I - User name */
}
#if defined(WIN32) || defined(__EMX__)
#if defined(WIN32)
/*
* WIN32 and OS/2 username and password stuff...
* WIN32 username and password stuff...
*/
/*
@@ -322,7 +328,20 @@ const char * /* O - User name */
cupsUser(void)
{
if (!cups_user[0])
strcpy(cups_user, "WindowsUser");
{
DWORD size; /* Size of string */
size = sizeof(cups_user);
if (!GetUserName(cups_user, &size))
{
/*
* Use the default username...
*/
strcpy(cups_user, "unknown");
}
}
return (cups_user);
}
@@ -399,7 +418,7 @@ cups_get_password(const char *prompt) /* I - Prompt string */
{
return (getpass(prompt));
}
#endif /* WIN32 || __EMX__ */
#endif /* WIN32 */
/*
+5
Ver Arquivo
@@ -215,7 +215,11 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
return (NULL);
}
#ifdef WIN32
if (fileinfo.st_mode & _S_IFDIR)
#else
if (S_ISDIR(fileinfo.st_mode))
#endif /* WIN32 */
{
/*
* Can't send a directory...
@@ -328,6 +332,7 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
*/
httpFlush(http);
httpReconnect(http);
/*
* See if we can do local authentication...
+4 -4
Ver Arquivo
@@ -96,7 +96,7 @@ WEBIMAGES = images/accept-jobs.gif \
#
all: $(DOCUMENTS:.shtml=.pdf) $(DOCUMENTS:.shtml=.html) overview.pdf
cd fr; make all
cd fr; $(MAKE) $(MFLAGS) all
#
@@ -104,7 +104,7 @@ all: $(DOCUMENTS:.shtml=.pdf) $(DOCUMENTS:.shtml=.html) overview.pdf
#
ps: $(DOCUMENTS:.shtml=.ps) overview.ps
cd fr; make ps
cd fr; $(MAKE) $(MFLAGS) ps
#
@@ -115,7 +115,7 @@ clean:
$(RM) $(DOCUMENTS:.shtml=.pdf)
$(RM) $(DOCUMENTS:.shtml=.html)
$(RM) overview.pdf
cd fr; make clean
cd fr; $(MAKE) $(MFLAGS) clean
#
@@ -139,7 +139,7 @@ install:
for file in $(WEBIMAGES) $(DOCIMAGES); do \
$(INSTALL_MAN) $$file $(DOCDIR)/images; \
done
cd fr; make install
cd fr; $(MAKE) $(MFLAGS) install
#
+8 -3
Ver Arquivo
@@ -170,12 +170,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -187,6 +186,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 File Management</A></H1>
<H2><A NAME="3_1">3.1 Directory Structure</A></H2>
BIN
Ver Arquivo
Arquivo binário não exibido.
+6 -6
Ver Arquivo
@@ -138,14 +138,14 @@ overview.ps: overview.html
sam.html: sam.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif -f $@ $<
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif -f $@ $<
sam.pdf: sam.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif --duplex --compression=9 \
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif --duplex --compression=9 \
--jpeg -f $@ $<
sam.ps: sam.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif --duplex --jpeg -f $@ $<
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif --duplex --jpeg -f $@ $<
spm.html: spm.shtml
echo Formatting $@...
@@ -160,14 +160,14 @@ spm.ps: spm.shtml
sum.html: sum.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif -f $@ $<
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif -f $@ $<
sum.pdf: sum.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif --duplex --compression=9 \
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif --duplex --compression=9 \
--jpeg -f $@ $<
sum.ps: sum.shtml
echo Formatting $@...
htmldoc --path ".;.." --titleimage images/cups-large.gif --duplex --jpeg -f $@ $<
htmldoc --toctitle "Table des matières" --path ".;.." --titleimage images/cups-large.gif --duplex --jpeg -f $@ $<
$(DOCUMENTS:.shtml=.html): \
glossary.shtml printing-overview.shtml \
+2456 -2446
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
BIN
Ver Arquivo
Arquivo binário não exibido.
+3493 -3839
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+802 -763
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
BIN
Ver Arquivo
Arquivo binário não exibido.
+1488 -825
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+8 -3
Ver Arquivo
@@ -144,12 +144,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -161,6 +160,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Internal Interfaces</A></H1>
<H2><A NAME="3_1">3.1 Character Set Files</A></H2>
BIN
Ver Arquivo
Arquivo binário não exibido.
+87 -13
Ver Arquivo
@@ -257,12 +257,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -274,6 +273,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Overview</A></H1>
<P>CUPS 1.1 implements IPP/1.1 and the operations and attributes defined
@@ -626,7 +631,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
</UL>
<H2><A NAME="4_6">4.6 CUPS-Add-Modify-Printer Operation</A></H2>
<P>The CUPS-Add-Modify-Printer operation (0x4003) adds a new printer or
modifies an existing printer on the system.</P>
modifies an existing printer on the system.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_6_1">4.6.1 CUPS-Add-Modify-Printer Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Add-Modify-Printer request:</P>
@@ -700,7 +715,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
</UL>
<H2><A NAME="4_7">4.7 CUPS-Delete-Printer Operation</A></H2>
<P>The CUPS-Delete-Printer operation (0x4004) removes an existing
printer from the system.</P>
printer from the system.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_7_1">4.7.1 CUPS-Delete-Printer Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Delete-Printer request:</P>
@@ -782,7 +807,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
</UL>
<H2><A NAME="4_9">4.9 CUPS-Add-Modify-Class Operation</A></H2>
<P>The CUPS-Add-Modify-Class operation (0x4006) adds a new printer class
or modifies and existing printer class on the system.</P>
or modifies and existing printer class on the system.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_9_1">4.9.1 CUPS-Add-Modify-Class Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Add-Modify-Class request:</P>
@@ -840,7 +875,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
</UL>
<H2><A NAME="4_10">4.10 CUPS-Delete-Class Operation</A></H2>
<P>The CUPS-Delete-Class operation (0x4007) removes an existing printer
class from the system.</P>
class from the system.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_10_1">4.10.1 CUPS-Delete-Class Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Delete-Class request:</P>
@@ -868,7 +913,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
<H2><A NAME="4_11">4.11 CUPS-Accept-Jobs Operation</A></H2>
<P>The CUPS-Accept-Jobs operation (0x4008) sets the
&quot;printer-is-accepting-jobs&quot; attribute to true for the specified printer
or printer class.</P>
or printer class.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_11_1">4.11.1 CUPS-Accept-Jobs Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Accept-Jobs request:</P>
@@ -895,9 +950,19 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
document.</P>
</UL>
<H2><A NAME="4_12">4.12 CUPS-Reject-Jobs Operation</A></H2>
<P>The CUPS-Reject-Jobs operation (0x4009) sets
the&quot;printer-is-accepting-jobs&quot; attribute to false for the specified
printer or printer class.</P>
<P>The CUPS-Reject-Jobs operation (0x4009) sets the
&quot;printer-is-accepting-jobs&quot; attribute to false for the specified
printer or printer class.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_12_1">4.12.1 CUPS-Reject-Jobs Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Reject-Jobs request:</P>
@@ -931,8 +996,17 @@ VALIGN="TOP">0x4006</TD><TD VALIGN="TOP">Add or modify a printer class.</TD>
</UL>
<H2><A NAME="4_13">4.13 CUPS-Set-Default Operation</A></H2>
<P>The CUPS-Set-Default operation (0x400A) sets the default printer
destination for all clients when a resource name of &quot;/printers&quot; is
specified.</P>
destination for all clients.
<CENTER>
<TABLE BGCOLOR="#cccccc" BORDER="1" CELLPADDING="5" WIDTH="80%">
<TR><TD><B>Note:</B>
<P>This operation requires administrative priviledges and must be POSTed
to &quot;/admin/&quot;. POSTs to other paths will result in a
client-error-not-authorized (IPP_NOT_AUTHORIZED) error.</P>
</TD></TR>
</TABLE>
</CENTER>
</P>
<H3><A NAME="4_13_1">4.13.1 CUPS-Set-Default Request</A></H3>
<P>The following groups of attributes are supplied as part of the
CUPS-Set-Default request:</P>
BIN
Ver Arquivo
Arquivo binário não exibido.
+87 -4
Ver Arquivo
@@ -690,6 +690,18 @@ CUPS-Get-Printers Response:
<P>The CUPS-Add-Modify-Printer operation (0x4003) adds a new printer or
modifies an existing printer on the system.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Add-Modify-Printer Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -814,6 +826,18 @@ CUPS-Add-Modify-Printer Response:
<P>The CUPS-Delete-Printer operation (0x4004) removes an existing
printer from the system.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Delete-Printer Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -955,6 +979,18 @@ CUPS-Get-Classes Response:
<P>The CUPS-Add-Modify-Class operation (0x4006) adds a new printer class or
modifies and existing printer class on the system.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Add-Modify-Class Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -1052,6 +1088,18 @@ CUPS-Add-Modify-Class request:
<P>The CUPS-Delete-Class operation (0x4007) removes an existing printer
class from the system.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Delete-Class Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -1100,6 +1148,18 @@ CUPS-Delete-Class Response:
"printer-is-accepting-jobs" attribute to true for the specified printer
or printer class.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Accept-Jobs Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -1144,10 +1204,22 @@ CUPS-Accept-Jobs Response:
<H2>CUPS-Reject-Jobs Operation</H2>
<P>The CUPS-Reject-Jobs operation (0x4009) sets
the"printer-is-accepting-jobs" attribute to false for the specified
<P>The CUPS-Reject-Jobs operation (0x4009) sets the
"printer-is-accepting-jobs" attribute to false for the specified
printer or printer class.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Reject-Jobs Request</H3>
<P>The following groups of attributes are supplied as part of the
@@ -1204,8 +1276,19 @@ CUPS-Reject-Jobs Response:
<H2>CUPS-Set-Default Operation</H2>
<P>The CUPS-Set-Default operation (0x400A) sets the default printer
destination for all clients when a resource name of "/printers" is
specified.
destination for all clients.
<CENTER><TABLE WIDTH="80%" BORDER="1" CELLPADDING="5" BGCOLOR="#cccccc">
<TR>
<TD><B>Note:</B>
<P>This operation requires administrative priviledges
and must be POSTed to "/admin/". POSTs to other paths
will result in a client-error-not-authorized
(IPP_NOT_AUTHORIZED) error.
</TR>
</TABLE></CENTER>
<H3>CUPS-Set-Default Request</H3>
+4 -3
Ver Arquivo
@@ -27,11 +27,9 @@
Version 4.3.</A>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">Adobe
PostScript Language Reference, Third Edition.</A>
<LI>IPP: Job and Printer Set Operations
<LI>IPP/1.1: Encoding and Transport
<LI>IPP/1.1: Implementers Guide
<LI>IPP/1.1: Model and Semantics
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer Daemon Protocol</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform Resource Identifiers (URI): Generic Syntax</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals for an Internet Printing Protocol</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale for the Structure of the Model and Protocol
for the Internet Printing Protocol</A>
@@ -39,4 +37,7 @@
<LI><A HREF="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616, Hypertext Transfer Protocol -- HTTP/1.1</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP Authentication: Basic and Digest Access</A>
Authentication
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1: Encoding and Transport</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1: Model and Semantics</A>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and Printer Set Operations</A>
</UL>
+9 -7
Ver Arquivo
@@ -4,7 +4,7 @@
<TITLE>CUPS Software Administrators Manual</TITLE>
<META NAME="author" CONTENT="Easy Software Products">
<META NAME="copyright" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="docnumber" CONTENT="CUPS-SAM-1.1.16">
<META NAME="docnumber" CONTENT="CUPS-SAM-1.1.17">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<STYLE TYPE="text/css"><!--
BODY { font-family: serif }
@@ -22,7 +22,7 @@ PRE { font-family: monospace }
<BODY BGCOLOR="#ffffff">
<CENTER><A HREF="#CONTENTS"><IMG SRC="images/cups-large.gif" BORDER="0" WIDTH="431" HEIGHT="511"><BR>
<H1>CUPS Software Administrators Manual</H1></A><BR>
CUPS-SAM-1.1.16<BR>
CUPS-SAM-1.1.17<BR>
Easy Software Products<BR>
Copyright 1997-2002, All Rights Reserved<BR>
</CENTER>
@@ -326,7 +326,7 @@ Copyright 1997-2002, All Rights Reserved<BR>
<H1 ALIGN="RIGHT"><A NAME="1">Preface</A></H1>
<P>This software administrators manual provides printer administration
information for the Common UNIX Printing System<SUP>TM</SUP> (&quot;CUPS<SUP>
TM</SUP>&quot;), version 1.1.16.</P>
TM</SUP>&quot;), version 1.1.17.</P>
<H2><A NAME="1_1">System Overview</A></H2>
<P>CUPS provides a portable printing layer for UNIX&reg;-based operating
systems. It has been developed by<A HREF="http://www.easysw.com"> Easy
@@ -720,9 +720,10 @@ CXXFLAGS</CODE>, and <CODE>LDFLAGS</CODE> environment variables prior to
manage your printers.</P>
<H2><A NAME="4_1">The Basics</A></H2>
<P>Each printer queue has a name associated with it; the printer name
must start with a letter and can contain up to 127 letters, numbers,
and the underscore (_). Case is not significant, e.g. &quot;PRINTER&quot;,
&quot;Printer&quot;, and &quot;printer&quot; are considered to be the same name.</P>
must start with any printable character except &quot; &quot;, &quot;/&quot;, and &quot;@&quot;. It
can contain up to 127 letters, numbers, and the underscore (_). Case is
not significant, e.g. &quot;PRINTER&quot;, &quot;Printer&quot;, and &quot;printer&quot; are
considered to be the same name.</P>
<P>Printer queues also have a device associated with them. The device
can be a parallel port, a network interface, and so forth. Devices
within CUPS use Uniform Resource Identifiers (&quot;URIs&quot;) which are a more
@@ -4016,7 +4017,8 @@ host group user date-time \&quot;method resource version\&quot; status bytes
</PRE>
</UL>
<P>where<I> ZZZZ</I> is the timezone offset in hours and minutes from
Greenwich Mean Time (a.k.a. GMT a.k.a. ZULU.)</P>
coordinated universal time (UTC). UTC may sometimes be referred to as
GMT or ZULU on legacy systems.</P>
<P>The<I> method</I> field is the HTTP method used (&quot;GET&quot;, &quot;PUT&quot;,
&quot;POST&quot;, etc.)</P>
<P>The<I> resource</I> field is the filename of the requested resource.</P>
BIN
Ver Arquivo
Arquivo binário não exibido.
+8 -6
Ver Arquivo
@@ -1,7 +1,7 @@
<HTML>
<HEAD>
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.1.16">
<META NAME="DOCNUMBER" CONTENT="CUPS-SAM-1.1.17">
<META NAME="Author" CONTENT="Easy Software Products">
<TITLE>CUPS Software Administrators Manual</TITLE>
</HEAD>
@@ -11,7 +11,7 @@
<P>This software administrators manual provides printer administration
information for the Common UNIX Printing System<SUP>TM</SUP>
("CUPS<SUP>TM</SUP>"), version 1.1.16.
("CUPS<SUP>TM</SUP>"), version 1.1.17.
<EMBED SRC="system-overview.shtml">
@@ -363,8 +363,9 @@ manage your printers.
<H2>The Basics</H2>
<P>Each printer queue has a name associated with it; the printer name
must start with a letter and can contain up to 127 letters, numbers,
and the underscore (_). Case is not significant, e.g. "PRINTER", "Printer",
must start with any printable character except " ", "/", and "@".
It can contain up to 127 letters, numbers, and the underscore (_).
Case is not significant, e.g. "PRINTER", "Printer",
and "printer" are considered to be the same name.
<P>Printer queues also have a device associated with them. The device can be
@@ -4297,8 +4298,9 @@ and is in the format:
[DD/MON/YYYY:HH:MM:SS +ZZZZ]
</PRE></UL>
<P>where <I>ZZZZ</I> is the timezone offset in hours and minutes from Greenwich
Mean Time (a.k.a. GMT a.k.a. ZULU.)
<P>where <I>ZZZZ</I> is the timezone offset in hours and minutes
from coordinated universal time (UTC). UTC may sometimes be
referred to as GMT or ZULU on legacy systems.</P>
<P>The <I>method</I> field is the HTTP method used ("GET", "PUT", "POST", etc.)
+8 -3
Ver Arquivo
@@ -189,12 +189,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -206,6 +205,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Design Overview</A></H1>
CUPS is composed of 9 software sub-systems that operate together to
BIN
Ver Arquivo
Arquivo binário não exibido.
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
<TITLE>CUPS Software Programmers Manual</TITLE>
<META NAME="author" CONTENT="Easy Software Products">
<META NAME="copyright" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="docnumber" CONTENT="CUPS-SPM-1.1.16">
<META NAME="docnumber" CONTENT="CUPS-SPM-1.1.17">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<STYLE TYPE="text/css"><!--
BODY { font-family: serif }
@@ -22,7 +22,7 @@ PRE { font-family: monospace }
<BODY BGCOLOR="#ffffff">
<CENTER><A HREF="#CONTENTS"><IMG SRC="images/cups-large.gif" BORDER="0" WIDTH="431" HEIGHT="511"><BR>
<H1>CUPS Software Programmers Manual</H1></A><BR>
CUPS-SPM-1.1.16<BR>
CUPS-SPM-1.1.17<BR>
Easy Software Products<BR>
Copyright 1997-2002, All Rights Reserved<BR>
</CENTER>
@@ -1287,7 +1287,7 @@ Copyright 1997-2002, All Rights Reserved<BR>
<H1 ALIGN="RIGHT"><A NAME="1">Preface</A></H1>
<P>This software programmers manual provides software programming
information for the Common UNIX Printing System (&quot;CUPS&quot;) Version
1.1.16.</P>
1.1.17.</P>
<H2><A NAME="1_1">System Overview</A></H2>
<P>CUPS provides a portable printing layer for UNIX&reg;-based operating
systems. It has been developed by<A HREF="http://www.easysw.com"> Easy
BIN
Ver Arquivo
Arquivo binário não exibido.
+2 -2
Ver Arquivo
@@ -1,7 +1,7 @@
<HTML>
<HEAD>
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SPM-1.1.16">
<META NAME="DOCNUMBER" CONTENT="CUPS-SPM-1.1.17">
<META NAME="Author" CONTENT="Easy Software Products">
<TITLE>CUPS Software Programmers Manual</TITLE>
</HEAD>
@@ -11,7 +11,7 @@
<P>This software programmers manual provides software
programming information for the Common UNIX Printing System
("CUPS") Version 1.1.16.
("CUPS") Version 1.1.17.
<EMBED SRC="system-overview.shtml">
+8 -3
Ver Arquivo
@@ -106,12 +106,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -123,6 +122,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Programs</A></H1>
<P>The following table describes the average memory, disk, and CPU usage
BIN
Ver Arquivo
Arquivo binário não exibido.
+8 -3
Ver Arquivo
@@ -109,12 +109,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -126,6 +125,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Local Access Risks</A></H1>
<P>Local access risks are those that can be exploited only with a local
BIN
Ver Arquivo
Arquivo binário não exibido.
+8 -3
Ver Arquivo
@@ -120,12 +120,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -137,6 +136,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Test Procedure</A></H1>
<P>The test software and data files are located in the<VAR> test</VAR>
BIN
Ver Arquivo
Arquivo binário não exibido.
+3 -3
Ver Arquivo
@@ -4,7 +4,7 @@
<TITLE>CUPS Software Users Manual</TITLE>
<META NAME="author" CONTENT="Easy Software Products">
<META NAME="copyright" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="docnumber" CONTENT="CUPS-SUM-1.1.16">
<META NAME="docnumber" CONTENT="CUPS-SUM-1.1.17">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<STYLE TYPE="text/css"><!--
BODY { font-family: serif }
@@ -22,7 +22,7 @@ PRE { font-family: monospace }
<BODY BGCOLOR="#ffffff">
<CENTER><A HREF="#CONTENTS"><IMG SRC="images/cups-large.gif" BORDER="0" WIDTH="431" HEIGHT="511"><BR>
<H1>CUPS Software Users Manual</H1></A><BR>
CUPS-SUM-1.1.16<BR>
CUPS-SUM-1.1.17<BR>
Easy Software Products<BR>
Copyright 1997-2002, All Rights Reserved<BR>
</CENTER>
@@ -130,7 +130,7 @@ Copyright 1997-2002, All Rights Reserved<BR>
<HR>
<H1 ALIGN="RIGHT"><A NAME="1">Preface</A></H1>
<P>This software users manual describes how to use the Common UNIX
Printing System<SUP>TM</SUP> (&quot;CUPS<SUP>TM</SUP>&quot;) Version 1.1.16.</P>
Printing System<SUP>TM</SUP> (&quot;CUPS<SUP>TM</SUP>&quot;) Version 1.1.17.</P>
<H2><A NAME="1_1">System Overview</A></H2>
<P>CUPS provides a portable printing layer for UNIX&reg;-based operating
systems. It has been developed by<A HREF="http://www.easysw.com"> Easy
BIN
Ver Arquivo
Arquivo binário não exibido.
+2 -2
Ver Arquivo
@@ -2,7 +2,7 @@
<HEAD>
<META NAME="Description" CONTENT="Common UNIX Printing System Software Users Manual">
<META NAME="COPYRIGHT" CONTENT="Copyright 1997-2002, All Rights Reserved">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.1.16">
<META NAME="DOCNUMBER" CONTENT="CUPS-SUM-1.1.17">
<META NAME="Author" CONTENT="Easy Software Products">
<TITLE>CUPS Software Users Manual</TITLE>
</HEAD>
@@ -11,7 +11,7 @@
<H1 ALIGN="RIGHT">Preface</H1>
<P>This software users manual describes how to use the Common UNIX Printing
System<SUP>TM</SUP> ("CUPS<SUP>TM</SUP>") Version 1.1.16.
System<SUP>TM</SUP> ("CUPS<SUP>TM</SUP>") Version 1.1.17.
<EMBED SRC="system-overview.shtml">
+8 -3
Ver Arquivo
@@ -127,12 +127,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -144,6 +143,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Additions</A></H1>
<P>CUPS 1.1 includes many new features from the 1.0.x releases.</P>
BIN
Ver Arquivo
Arquivo binário não exibido.
+8 -3
Ver Arquivo
@@ -121,12 +121,11 @@ Adobe PostScript Printer Description File Format Specification, Version
4.3.</A></LI>
<LI><A HREF="http://partners.adobe.com/asn/developer/PDFS/TN/PLRM.pdf">
Adobe PostScript Language Reference, Third Edition.</A></LI>
<LI>IPP: Job and Printer Set Operations</LI>
<LI>IPP/1.1: Encoding and Transport</LI>
<LI>IPP/1.1: Implementers Guide</LI>
<LI>IPP/1.1: Model and Semantics</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc1179.txt">RFC 1179, Line Printer
Daemon Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396, Uniform
Resource Identifiers (URI): Generic Syntax</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2567.txt">RFC 2567, Design Goals
for an Internet Printing Protocol</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2568.txt">RFC 2568, Rationale
@@ -138,6 +137,12 @@ Adobe PostScript Language Reference, Third Edition.</A></LI>
Transfer Protocol -- HTTP/1.1</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2617.txt">RFC 2617, HTTP
Authentication: Basic and Digest Access</A> Authentication</LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2910.txt">RFC 2910, IPP/1.1:
Encoding and Transport</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc2911.txt">RFC 2911, IPP/1.1:
Model and Semantics</A></LI>
<LI><A HREF="http://www.ietf.org/rfc/rfc3380.txt">RFC 3380, IPP: Job and
Printer Set Operations</A></LI>
</UL>
<H1><A NAME="3">3 Character Sets</A></H1>
<P>CUPS uses character set files to define the mapping of local
Arquivo binário não exibido.
+11 -1
Ver Arquivo
@@ -158,7 +158,7 @@ libcupsimage_s.a: $(IMAGEOBJS) ../Makedefs
libcupsimage.la: $(IMAGEOBJS) ../Makedefs
echo Linking $@...
$(DSO) -o $(DSOFLAGS) $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \
$(DSO) $(DSOFLAGS) -o $@ $(IMAGEOBJS:.o=.lo) $(DSOLIBS) \
-rpath $(LIBDIR) -version-info 2:1
@@ -173,6 +173,16 @@ libcupsimage.a: $(IMAGEOBJS) ../Makedefs
$(RANLIB) $@
#
# testimage
#
testimage: testimage.o libcupsimage.a ../Makedefs
echo Linking $@...
$(CC) $(LDFLAGS) -o $@ testimage.o libcupsimage.a \
$(IMGLIBS) $(DSOLIBS) $(LIBS)
#
# imagetops
#
+41 -6
Ver Arquivo
@@ -39,6 +39,7 @@
*/
#include "common.h"
#include <locale.h>
/*
@@ -71,6 +72,10 @@ SetCommonOptions(int num_options, /* I - Number of options */
const char *val; /* Option value */
#ifdef LC_TIME
setlocale(LC_TIME, "");
#endif /* LC_TIME */
ppd = ppdOpenFile(getenv("PPD"));
ppdMarkDefaults(ppd);
@@ -323,6 +328,7 @@ WriteLabelProlog(const char *label, /* I - Page label */
float width) /* I - Width in points */
{
const char *classification; /* CLASSIFICATION environment variable */
const char *ptr; /* Temporary string pointer */
/*
@@ -361,14 +367,43 @@ WriteLabelProlog(const char *label, /* I - Page label */
else if (strcmp(classification, "unclassified") == 0)
printf("/ESPpl(UNCLASSIFIED");
else
{
printf("/ESPpl(");
if (classification[0] && label)
printf(" - %s)put\n", label);
else if (label)
printf("%s)put\n", label);
else
puts(")put");
for (ptr = classification; *ptr; ptr ++)
if (*ptr < 32 || *ptr > 126)
printf("\\%03o", *ptr);
else
{
if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
putchar('\\');
putchar(*ptr);
}
}
if (label)
{
if (classification[0])
printf(" - ");
/*
* Quote the label string as needed...
*/
for (ptr = label; *ptr; ptr ++)
if (*ptr < 32 || *ptr > 126)
printf("\\%03o", *ptr);
else
{
if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
putchar('\\');
putchar(*ptr);
}
}
puts(")put");
/*
* Then get a 14 point Helvetica-Bold font...
+8 -4
Ver Arquivo
@@ -376,11 +376,15 @@ gif_get_code(FILE *fp, /* I - File to read from */
if (last_byte > 1)
{
buf[0] = buf[last_byte - 2];
buf[1] = buf[last_byte - 1];
buf[0] = buf[last_byte - 2];
buf[1] = buf[last_byte - 1];
last_byte = 2;
}
else if (last_byte == 1)
{
buf[0] = buf[last_byte - 1];
last_byte = 1;
}
/*
* Read in another buffer...
@@ -400,8 +404,8 @@ gif_get_code(FILE *fp, /* I - File to read from */
* Update buffer state...
*/
curbit = (curbit - lastbit) + 8 * last_byte;
last_byte += count;
curbit = (curbit - lastbit) + 16;
lastbit = last_byte * 8;
}
+12 -1
Ver Arquivo
@@ -107,6 +107,8 @@ ImageReadSunRaster(image_t *img, /* IO - Image */
* checks this) so we don't need to check the magic number again.
*/
fputs("DEBUG: Reading Sun Raster image...\n", stderr);
read_unsigned(fp); /* Skip magic */
img->xsize = read_unsigned(fp);
img->ysize = read_unsigned(fp);
@@ -116,8 +118,15 @@ ImageReadSunRaster(image_t *img, /* IO - Image */
/* ras_maptype*/read_unsigned(fp);
ras_maplength = read_unsigned(fp);
fprintf(stderr, "DEBUG: ras_width=%d, ras_height=%d, ras_depth=%d, ras_type=%d, ras_maplength=%d\n",
img->xsize, img->ysize, ras_depth, ras_type, ras_maplength);
if (ras_maplength > 0)
{
memset(cmap[0], 255, sizeof(cmap[0]));
memset(cmap[1], 0, sizeof(cmap[1]));
memset(cmap[2], 0, sizeof(cmap[2]));
fread(cmap[0], 1, ras_maplength / 3, fp);
fread(cmap[1], 1, ras_maplength / 3, fp);
fread(cmap[2], 1, ras_maplength / 3, fp);
@@ -148,6 +157,8 @@ ImageReadSunRaster(image_t *img, /* IO - Image */
run_count = 0;
run_value = 0;
fprintf(stderr, "DEBUG: bpp=%d, scanwidth=%d\n", bpp, scanwidth);
for (y = 0; y < img->ysize; y ++)
{
if (ras_depth != 8 || ras_maplength > 0)
@@ -271,7 +282,7 @@ ImageReadSunRaster(image_t *img, /* IO - Image */
}
}
if (bpp == 1)
if (ras_depth <= 8 && ras_maplength == 0)
{
if (img->colorspace == IMAGE_WHITE)
{
+9 -5
Ver Arquivo
@@ -77,7 +77,8 @@ unsigned char *Planes[6], /* Output buffers */
*LineBuffers[2]; /* Line bitmap buffers */
int Model, /* Model number */
NumPlanes, /* Number of color planes */
Feed; /* Number of lines to skip */
Feed, /* Number of lines to skip */
EjectPage; /* Eject the page when done? */
int DotBit, /* Bit in buffers */
DotBytes, /* # bytes in a dot column */
DotColumns, /* # columns in 1/60 inch */
@@ -119,7 +120,7 @@ Setup(void)
*/
if ((device_uri = getenv("DEVICE_URI")) != NULL &&
strncmp(device_uri, "usb:", 4) == 0)
strncmp(device_uri, "usb:", 4) == 0 && Model >= EPSON_ICOLOR)
pwrite("\000\000\000\033\001@EJL 1284.4\n@EJL \n\033@", 29);
}
@@ -169,8 +170,8 @@ StartPage(const ppd_file_t *ppd, /* I - PPD file */
* See which type of printer we are using...
*/
Model = ppd->model_number;
EjectPage = header->Margins[0] || header->Margins[1];
switch (ppd->model_number)
{
case EPSON_9PIN :
@@ -355,7 +356,8 @@ EndPage(const cups_page_header_t *header) /* I - Page header */
* Eject the current page...
*/
putchar(12); /* Form feed */
if (EjectPage)
putchar(12); /* Form feed */
fflush(stdout);
/*
@@ -1039,6 +1041,8 @@ main(int argc, /* I - Number of command-line arguments */
*/
ppd = ppdOpenFile(getenv("PPD"));
if (ppd)
Model = ppd->model_number;
Setup();
+101
Ver Arquivo
@@ -0,0 +1,101 @@
/*
* "$Id$"
*
* Image library test program for the Common UNIX Printing System (CUPS).
*
* Copyright 1993-2002 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
* copyright law. Distribution and use rights are outlined in the file
* "LICENSE.txt" which should have been included with this file. If this
* file is missing or damaged please contact Easy Software Products
* at:
*
* Attn: CUPS Licensing Information
* Easy Software Products
* 44141 Airport View Drive, Suite 204
* Hollywood, Maryland 20636-3111 USA
*
* Voice: (301) 373-9603
* EMail: cups-info@cups.org
* WWW: http://www.cups.org
*
* This file is subject to the Apple OS-Developed Software exception.
*
* Contents:
*
* main() - Main entry...
*/
/*
* Include necessary headers...
*/
#include "image.h"
/*
* 'main()' - Main entry...
*/
int /* O - Exit status */
main(int argc, /* I - Number of command-line arguments */
char *argv[]) /* I - Command-line arguments */
{
image_t *img; /* Image to print */
int primary; /* Primary image colorspace */
FILE *out; /* Output PPM/PGM file */
ib_t *line; /* Line from file */
int y; /* Current line */
if (argc != 3)
{
puts("Usage: testimage filename.ext filename.[ppm|pgm]");
return (1);
}
if (strstr(argv[2], ".ppm") != NULL)
primary = IMAGE_RGB;
else
primary = IMAGE_WHITE;
img = ImageOpen(argv[1], primary, IMAGE_WHITE, 100, 0, NULL);
if (!img)
{
perror(argv[1]);
return (1);
}
out = fopen(argv[2], "wb");
if (!out)
{
perror(argv[2]);
ImageClose(img);
return (1);
}
line = calloc(img->xsize, img->colorspace);
fprintf(out, "P%d\n%d\n%d\n255\n", img->colorspace == IMAGE_WHITE ? 5 : 6,
img->xsize, img->ysize);
for (y = 0; y < img->ysize; y ++)
{
ImageGetRow(img, 0, y, img->xsize, line);
fwrite(line, img->xsize, img->colorspace, out);
}
ImageClose(img);
fclose(out);
return (0);
}
/*
* End of "$Id$".
*/
+3 -3
Ver Arquivo
@@ -40,7 +40,7 @@ LANGDIRS = fr
all: $(CAT1) $(CAT3) $(CAT5) $(CAT8)
for dir in $(LANGDIRS); do \
echo "Making all in man/$$dir..."; \
(cd $$dir; make all); \
(cd $$dir; $(MAKE) $(MFLAGS) all); \
done
@@ -52,7 +52,7 @@ clean:
$(RM) $(CAT1) $(CAT3) $(CAT5) $(CAT8)
for dir in $(LANGDIRS); do \
echo "Cleaning all in man/$$dir..."; \
(cd $$dir; make clean); \
(cd $$dir; $(MAKE) $(MFLAGS) clean); \
done
@@ -114,7 +114,7 @@ install: all
$(LN) enable.$(CAT8EXT) $(AMANDIR)/cat$(MAN8EXT)/disable.$(CAT8EXT)
for dir in $(LANGDIRS); do \
echo "Installing all in man/$$dir..."; \
(cd $$dir; make install); \
(cd $$dir; $(MAKE) $(MFLAGS) install); \
done
+7 -6
Ver Arquivo
@@ -1,5 +1,5 @@
.\"
.\" "$Id: lpadmin.man 2137 2002-02-12 18:47:13Z mike $"
.\" "$Id: lpadmin.man 2921 2002-10-21 13:45:17Z mike $"
.\"
.\" lpadmin man page for the Common UNIX Printing System (CUPS).
.\"
@@ -21,7 +21,7 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lpadmin 8 "Common UNIX Printing System" "23 January 2001" "Easy Software Products"
.TH lpadmin 8 "Common UNIX Printing System" "21 October 2002" "Easy Software Products"
.SH NAME
lpadmin \- configure cups printers and classes
.SH SYNOPSIS
@@ -44,8 +44,9 @@ lpadmin \- configure cups printers and classes
] \-x
.I destination
.SH DESCRIPTION
\fIlpadmin\fR configures printer and class queues provided by CUPS. It can also
be used to set the system default printer or class.
\fIlpadmin\fR configures printer and class queues provided by
CUPS. It can also be used to set the server default printer or
class.
.LP
When specified before the \fI-d\fR, \fI-p\fR, or \fI-x\fR options,
the \fI-E\fR option forces encryption when connecting to the server.
@@ -53,7 +54,7 @@ the \fI-E\fR option forces encryption when connecting to the server.
The first form of the command sets the default printer or class to
\fIdestination\fR. Subsequent print jobs submitted via the \fIlp(1)\fR or
\fIlpr(1)\fR commands will use this destination unless the user specifies
otherwise.
otherwise with the \fIlpoptions(1)\fR command.
.LP
The second form of the command configures the named printer. The additional
options are described below.
@@ -152,5 +153,5 @@ http://localhost:631/documentation.html
.SH COPYRIGHT
Copyright 1993-2002 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lpadmin.man 2137 2002-02-12 18:47:13Z mike $".
.\" End of "$Id: lpadmin.man 2921 2002-10-21 13:45:17Z mike $".
.\"
+12 -3
Ver Arquivo
@@ -1,5 +1,5 @@
.\"
.\" "$Id: lpoptions.man 2876 2002-10-07 14:11:42Z mike $"
.\" "$Id: lpoptions.man 2921 2002-10-21 13:45:17Z mike $"
.\"
.\" lpoptions man page for the Common UNIX Printing System (CUPS).
.\"
@@ -21,7 +21,7 @@
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
.TH lpoptions 1 "Common UNIX Printing System" "7 October 2002" "Easy Software Products"
.TH lpoptions 1 "Common UNIX Printing System" "21 October 2002" "Easy Software Products"
.SH NAME
lpoptions \- display or set printer options and defaults
.SH SYNOPSIS
@@ -106,8 +106,17 @@ options for the named printer are reported on the standard output.
.LP
Options set with the \fBlpoptions\fR command are used by the \fBlp(1)\fR
and \fBlpr(1)\fR commands when submitting jobs.
.SH ROOT ACCOUNT OPTIONS
When run by the root user, \fBlpoptions\fR gets and sets default
options and instances for \fIall users\fR in the
/etc/cups/lpoptions file.
.SH COMPATIBILITY
The \fBlpoptions\fR command is unique to CUPS.
.SH FILES
~/.lpoptions - user defaults and instances created by non-root users.
.br
/etc/cups/lpoptions - system-wide defaults and instances created by the root
user.
.SH SEE ALSO
cancel(1), lp(1),
CUPS Software Users Manual,
@@ -115,5 +124,5 @@ http://localhost:631/documentation.html
.SH COPYRIGHT
Copyright 1993-2002 by Easy Software Products, All Rights Reserved.
.\"
.\" End of "$Id: lpoptions.man 2876 2002-10-07 14:11:42Z mike $".
.\" End of "$Id: lpoptions.man 2921 2002-10-21 13:45:17Z mike $".
.\"
-685
Ver Arquivo
@@ -1,685 +0,0 @@
//========================================================================
//
// FTFont.cc
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <config.h>
#if FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#include <math.h>
#include <string.h>
#include "gmem.h"
#include "freetype/ftoutln.h"
#include "freetype/internal/ftobjs.h"
#if 1 //~ cff cid->gid map
#include "freetype/internal/cfftypes.h"
#include "freetype/internal/tttypes.h"
#endif
#include "GlobalParams.h"
#include "GfxState.h"
#include "FTFont.h"
//------------------------------------------------------------------------
FTFontEngine::FTFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA):
SFontEngine(displayA, visualA, depthA, colormapA) {
ok = gFalse;
if (FT_Init_FreeType(&lib)) {
return;
}
aa = aaA;
ok = gTrue;
}
FTFontEngine::~FTFontEngine() {
FT_Done_FreeType(lib);
}
//------------------------------------------------------------------------
FTFontFile::FTFontFile(FTFontEngine *engineA, char *fontFileName,
char **fontEnc, GBool pdfFontHasEncoding) {
char *name;
int unicodeCmap, macRomanCmap, msSymbolCmap;
int i, j;
ok = gFalse;
engine = engineA;
codeMap = NULL;
if (FT_New_Face(engine->lib, fontFileName, 0, &face)) {
return;
}
if (!strcmp(face->driver->root.clazz->module_name, "type1") ||
!strcmp(face->driver->root.clazz->module_name, "cff")) {
mode = ftFontModeCodeMapDirect;
codeMap = (Guint *)gmalloc(256 * sizeof(Guint));
for (i = 0; i < 256; ++i) {
codeMap[i] = 0;
if ((name = fontEnc[i])) {
codeMap[i] = FT_Get_Name_Index(face, name);
}
}
} else {
// To match up with the Adobe-defined behaviour, we choose a cmap
// like this:
// 1. If the PDF font has an encoding:
// 1a. If the TrueType font has a Microsoft Unicode cmap, use it,
// and use the Unicode indexes, not the char codes.
// 1b. If the TrueType font has a Macintosh Roman cmap, use it,
// and reverse map the char names through MacRomanEncoding to
// get char codes.
// 2. If the PDF font does not have an encoding:
// 2a. If the TrueType font has a Macintosh Roman cmap, use it,
// and use char codes directly.
// 2b. If the TrueType font has a Microsoft Symbol cmap, use it,
// and use (0xf000 + char code).
// 3. If none of these rules apply, use the first cmap and hope for
// the best (this shouldn't happen).
unicodeCmap = macRomanCmap = msSymbolCmap = 0xffff;
for (i = 0; i < face->num_charmaps; ++i) {
if (face->charmaps[i]->platform_id == 3 &&
face->charmaps[i]->encoding_id == 1) {
unicodeCmap = i;
} else if (face->charmaps[i]->platform_id == 1 &&
face->charmaps[i]->encoding_id == 0) {
macRomanCmap = i;
} else if (face->charmaps[i]->platform_id == 3 &&
face->charmaps[i]->encoding_id == 0) {
msSymbolCmap = i;
}
}
i = 0;
mode = ftFontModeCharCode;
charMapOffset = 0;
if (pdfFontHasEncoding) {
if (unicodeCmap != 0xffff) {
i = unicodeCmap;
mode = ftFontModeUnicode;
} else if (macRomanCmap != 0xffff) {
i = macRomanCmap;
mode = ftFontModeCodeMap;
codeMap = (Guint *)gmalloc(256 * sizeof(Guint));
for (j = 0; j < 256; ++j) {
if (fontEnc[j]) {
codeMap[j] = globalParams->getMacRomanCharCode(fontEnc[j]);
} else {
codeMap[j] = 0;
}
}
}
} else {
if (macRomanCmap != 0xffff) {
i = macRomanCmap;
mode = ftFontModeCharCode;
} else if (msSymbolCmap != 0xffff) {
i = msSymbolCmap;
mode = ftFontModeCharCodeOffset;
charMapOffset = 0xf000;
}
}
if (FT_Set_Charmap(face, face->charmaps[i])) {
return;
}
}
ok = gTrue;
}
FTFontFile::FTFontFile(FTFontEngine *engineA, char *fontFileName,
Gushort *cidToGIDA, int cidToGIDLenA) {
ok = gFalse;
engine = engineA;
codeMap = NULL;
if (FT_New_Face(engine->lib, fontFileName, 0, &face)) {
return;
}
cidToGID = cidToGIDA;
cidToGIDLen = cidToGIDLenA;
mode = ftFontModeCIDToGIDMap;
ok = gTrue;
}
FTFontFile::FTFontFile(FTFontEngine *engineA, char *fontFileName) {
ok = gFalse;
engine = engineA;
codeMap = NULL;
if (FT_New_Face(engine->lib, fontFileName, 0, &face)) {
return;
}
cidToGID = NULL;
cidToGIDLen = 0;
mode = ftFontModeCFFCharset;
ok = gTrue;
}
FTFontFile::~FTFontFile() {
if (face) {
FT_Done_Face(face);
}
if (codeMap) {
gfree(codeMap);
}
}
//------------------------------------------------------------------------
FTFont::FTFont(FTFontFile *fontFileA, double *m) {
FTFontEngine *engine;
FT_Face face;
double size, div;
int x, xMin, xMax;
int y, yMin, yMax;
int i;
ok = gFalse;
fontFile = fontFileA;
engine = fontFile->engine;
face = fontFile->face;
if (FT_New_Size(face, &sizeObj)) {
return;
}
face->size = sizeObj;
size = sqrt(m[2]*m[2] + m[3]*m[3]);
if (FT_Set_Pixel_Sizes(face, 0, (int)size)) {
return;
}
div = face->bbox.xMax > 20000 ? 65536 : 1;
// transform the four corners of the font bounding box -- the min
// and max values form the bounding box of the transformed font
x = (int)((m[0] * face->bbox.xMin + m[2] * face->bbox.yMin) /
(div * face->units_per_EM));
xMin = xMax = x;
y = (int)((m[1] * face->bbox.xMin + m[3] * face->bbox.yMin) /
(div * face->units_per_EM));
yMin = yMax = y;
x = (int)((m[0] * face->bbox.xMin + m[2] * face->bbox.yMax) /
(div * face->units_per_EM));
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * face->bbox.xMin + m[3] * face->bbox.yMax) /
(div * face->units_per_EM));
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)((m[0] * face->bbox.xMax + m[2] * face->bbox.yMin) /
(div * face->units_per_EM));
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * face->bbox.xMax + m[3] * face->bbox.yMin) /
(div * face->units_per_EM));
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)((m[0] * face->bbox.xMax + m[2] * face->bbox.yMax) /
(div * face->units_per_EM));
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * face->bbox.xMax + m[3] * face->bbox.yMax) /
(div * face->units_per_EM));
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
// This is a kludge: some buggy PDF generators embed fonts with
// zero bounding boxes.
if (xMax == xMin) {
xMin = 0;
xMax = (int)size;
}
if (yMax == yMin) {
yMin = 0;
yMax = (int)(1.2 * size);
}
// this should be (max - min + 1), but we add some padding to
// deal with rounding errors
glyphW = xMax - xMin + 3;
glyphH = yMax - yMin + 3;
// another kludge: some CJK TT fonts have bogus bboxes, so add more
// padding
if (face->num_glyphs > 1000) {
glyphW += glyphW >> 1;
glyphH += glyphH >> 1;
}
if (engine->aa) {
glyphSize = glyphW * glyphH;
} else {
glyphSize = ((glyphW + 7) >> 3) * glyphH;
}
// set up the glyph pixmap cache
cacheAssoc = 8;
if (glyphSize <= 256) {
cacheSets = 8;
} else if (glyphSize <= 512) {
cacheSets = 4;
} else if (glyphSize <= 1024) {
cacheSets = 2;
} else {
cacheSets = 1;
}
cache = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
cacheTags = (FTFontCacheTag *)gmalloc(cacheSets * cacheAssoc *
sizeof(FTFontCacheTag));
for (i = 0; i < cacheSets * cacheAssoc; ++i) {
cacheTags[i].mru = i & (cacheAssoc - 1);
}
// create the XImage
if (!(image = XCreateImage(engine->display, engine->visual, engine->depth,
ZPixmap, 0, NULL, glyphW, glyphH, 8, 0))) {
return;
}
image->data = (char *)gmalloc(glyphH * image->bytes_per_line);
// compute the transform matrix
matrix.xx = (FT_Fixed)((m[0] / size) * 65536);
matrix.yx = (FT_Fixed)((m[1] / size) * 65536);
matrix.xy = (FT_Fixed)((m[2] / size) * 65536);
matrix.yy = (FT_Fixed)((m[3] / size) * 65536);
ok = gTrue;
}
FTFont::~FTFont() {
gfree(cacheTags);
gfree(cache);
gfree(image->data);
image->data = NULL;
XDestroyImage(image);
}
GBool FTFont::drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u) {
FTFontEngine *engine;
XColor xcolor;
int bgR, bgG, bgB;
Gulong colors[5];
Guchar *p;
int pix;
int xOffset, yOffset, x0, y0, x1, y1, gw, gh, w0, h0;
int xx, yy, xx1;
engine = fontFile->engine;
// no Unicode index for this char - don't draw anything
if (fontFile->mode == ftFontModeUnicode && u == 0) {
return gFalse;
}
// generate the glyph pixmap
if (!(p = getGlyphPixmap(c, u, &xOffset, &yOffset, &gw, &gh))) {
return gFalse;
}
// compute: (x0,y0) = position in destination drawable
// (x1,y1) = position in glyph image
// (w0,h0) = size of image transfer
x0 = x - xOffset;
y0 = y - yOffset;
x1 = 0;
y1 = 0;
w0 = gw;
h0 = gh;
if (x0 < 0) {
x1 = -x0;
w0 += x0;
x0 = 0;
}
if (x0 + w0 > w) {
w0 = w - x0;
}
if (w0 < 0) {
return gTrue;
}
if (y0 < 0) {
y1 = -y0;
h0 += y0;
y0 = 0;
}
if (y0 + h0 > h) {
h0 = h - y0;
}
if (h0 < 0) {
return gTrue;
}
// read the X image
XGetSubImage(engine->display, d, x0, y0, w0, h0, (1 << engine->depth) - 1,
ZPixmap, image, x1, y1);
if (engine->aa) {
// compute the colors
xcolor.pixel = XGetPixel(image, x1 + w0/2, y1 + h0/2);
XQueryColor(engine->display, engine->colormap, &xcolor);
bgR = xcolor.red;
bgG = xcolor.green;
bgB = xcolor.blue;
colors[1] = engine->findColor((r + 3*bgR) / 4,
(g + 3*bgG) / 4,
(b + 3*bgB) / 4);
colors[2] = engine->findColor((r + bgR) / 2,
(g + bgG) / 2,
(b + bgB) / 2);
colors[3] = engine->findColor((3*r + bgR) / 4,
(3*g + bgG) / 4,
(3*b + bgB) / 4);
colors[4] = engine->findColor(r, g, b);
// stuff the glyph pixmap into the X image
for (yy = 0; yy < gh; ++yy) {
for (xx = 0; xx < gw; ++xx) {
pix = *p++ & 0xff;
// this is a heuristic which seems to produce decent
// results -- the linear mapping would be:
// pix = (pix * 5) / 256;
pix = ((pix + 10) * 5) / 256;
if (pix > 4) {
pix = 4;
}
if (pix > 0) {
XPutPixel(image, xx, yy, colors[pix]);
}
}
}
} else {
// one color
colors[1] = engine->findColor(r, g, b);
// stuff the glyph bitmap into the X image
for (yy = 0; yy < gh; ++yy) {
for (xx = 0; xx < gw; xx += 8) {
pix = *p++;
for (xx1 = xx; xx1 < xx + 8 && xx1 < gw; ++xx1) {
if (pix & 0x80) {
XPutPixel(image, xx1, yy, colors[1]);
}
pix <<= 1;
}
}
}
}
// draw the X image
XPutImage(engine->display, d, gc, image, x1, y1, x0, y0, w0, h0);
return gTrue;
}
Guchar *FTFont::getGlyphPixmap(CharCode c, Unicode u,
int *x, int *y, int *w, int *h) {
FT_GlyphSlot slot;
FT_UInt idx;
int gSize;
int i, j, k;
Guchar *ret;
// check the cache
i = (c & (cacheSets - 1)) * cacheAssoc;
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x8000) && cacheTags[i+j].code == c) {
*x = cacheTags[i+j].x;
*y = cacheTags[i+j].y;
*w = cacheTags[i+j].w;
*h = cacheTags[i+j].h;
for (k = 0; k < cacheAssoc; ++k) {
if (k != j &&
(cacheTags[i+k].mru & 0x7fff) < (cacheTags[i+j].mru & 0x7fff)) {
++cacheTags[i+k].mru;
}
}
cacheTags[i+j].mru = 0x8000;
return cache + (i+j) * glyphSize;
}
}
// generate the glyph pixmap or bitmap
fontFile->face->size = sizeObj;
FT_Set_Transform(fontFile->face, &matrix, NULL);
slot = fontFile->face->glyph;
idx = getGlyphIndex(c, u);
// if we have the FT2 bytecode interpreter, autohinting won't be used
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if (FT_Load_Glyph(fontFile->face, idx, FT_LOAD_DEFAULT)) {
return gFalse;
}
#else
// FT2's autohinting doesn't always work very well (especially with
// font subsets), so turn it off if anti-aliasing is enabled; if
// anti-aliasing is disabled, this seems to be a tossup - some fonts
// look better with hinting, some without, so leave hinting on
if (FT_Load_Glyph(fontFile->face, idx,
fontFile->engine->aa ? FT_LOAD_NO_HINTING
: FT_LOAD_DEFAULT)) {
return gFalse;
}
#endif
if (FT_Render_Glyph(slot,
fontFile->engine->aa ? ft_render_mode_normal :
ft_render_mode_mono)) {
return gFalse;
}
*x = -slot->bitmap_left;
*y = slot->bitmap_top;
*w = slot->bitmap.width;
*h = slot->bitmap.rows;
if (*w > glyphW || *h > glyphH) {
#if 1 //~ debug
fprintf(stderr, "Weird FreeType glyph size: %d > %d or %d > %d\n",
*w, glyphW, *h, glyphH);
#endif
return NULL;
}
// store glyph pixmap in cache
ret = NULL;
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x7fff) == cacheAssoc - 1) {
cacheTags[i+j].mru = 0x8000;
cacheTags[i+j].code = c;
cacheTags[i+j].x = *x;
cacheTags[i+j].y = *y;
cacheTags[i+j].w = *w;
cacheTags[i+j].h = *h;
if (fontFile->engine->aa) {
gSize = *w * *h;
} else {
gSize = ((*w + 7) >> 3) * *h;
}
ret = cache + (i+j) * glyphSize;
memcpy(ret, slot->bitmap.buffer, gSize);
} else {
++cacheTags[i+j].mru;
}
}
return ret;
}
GBool FTFont::getCharPath(CharCode c, Unicode u, GfxState *state) {
static FT_Outline_Funcs outlineFuncs = {
&charPathMoveTo,
&charPathLineTo,
&charPathConicTo,
&charPathCubicTo,
0, 0
};
FT_GlyphSlot slot;
FT_UInt idx;
FT_Glyph glyph;
fontFile->face->size = sizeObj;
FT_Set_Transform(fontFile->face, &matrix, NULL);
slot = fontFile->face->glyph;
idx = getGlyphIndex(c, u);
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if (FT_Load_Glyph(fontFile->face, idx, FT_LOAD_DEFAULT)) {
return gFalse;
}
#else
// FT2's autohinting doesn't always work very well (especially with
// font subsets), so turn it off if anti-aliasing is enabled; if
// anti-aliasing is disabled, this seems to be a tossup - some fonts
// look better with hinting, some without, so leave hinting on
if (FT_Load_Glyph(fontFile->face, idx,
fontFile->engine->aa ? FT_LOAD_NO_HINTING
: FT_LOAD_DEFAULT)) {
return gFalse;
}
#endif
if (FT_Get_Glyph(slot, &glyph)) {
return gFalse;
}
FT_Outline_Decompose(&((FT_OutlineGlyph)glyph)->outline,
&outlineFuncs, state);
return gTrue;
}
int FTFont::charPathMoveTo(FT_Vector *pt, void *state) {
((GfxState *)state)->moveTo(pt->x / 64.0, -pt->y / 64.0);
return 0;
}
int FTFont::charPathLineTo(FT_Vector *pt, void *state) {
((GfxState *)state)->lineTo(pt->x / 64.0, -pt->y / 64.0);
return 0;
}
int FTFont::charPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *state) {
double x0, y0, x1, y1, x2, y2, x3, y3, xc, yc;
x0 = ((GfxState *)state)->getCurX();
y0 = ((GfxState *)state)->getCurY();
xc = ctrl->x / 64.0;
yc = -ctrl->y / 64.0;
x3 = pt->x / 64.0;
y3 = -pt->y / 64.0;
// A second-order Bezier curve is defined by two endpoints, p0 and
// p3, and one control point, pc:
//
// p(t) = (1-t)^2*p0 + t*(1-t)*pc + t^2*p3
//
// A third-order Bezier curve is defined by the same two endpoints,
// p0 and p3, and two control points, p1 and p2:
//
// p(t) = (1-t)^3*p0 + 3t*(1-t)^2*p1 + 3t^2*(1-t)*p2 + t^3*p3
//
// Applying some algebra, we can convert a second-order curve to a
// third-order curve:
//
// p1 = (1/3) * (p0 + 2pc)
// p2 = (1/3) * (2pc + p3)
x1 = (1.0 / 3.0) * (x0 + 2 * xc);
y1 = (1.0 / 3.0) * (y0 + 2 * yc);
x2 = (1.0 / 3.0) * (2 * xc + x3);
y2 = (1.0 / 3.0) * (2 * yc + y3);
((GfxState *)state)->curveTo(x1, y1, x2, y2, x3, y3);
return 0;
}
int FTFont::charPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
FT_Vector *pt, void *state) {
((GfxState *)state)->curveTo(ctrl1->x / 64.0, -ctrl1->y / 64.0,
ctrl2->x / 64.0, -ctrl2->y / 64.0,
pt->x / 64.0, -pt->y / 64.0);
return 0;
}
FT_UInt FTFont::getGlyphIndex(CharCode c, Unicode u) {
FT_UInt idx;
int j;
idx = 0; // make gcc happy
switch (fontFile->mode) {
case ftFontModeUnicode:
idx = FT_Get_Char_Index(fontFile->face, (FT_ULong)u);
break;
case ftFontModeCharCode:
idx = FT_Get_Char_Index(fontFile->face, (FT_ULong)c);
break;
case ftFontModeCharCodeOffset:
idx = FT_Get_Char_Index(fontFile->face,
(FT_ULong)(c + fontFile->charMapOffset));
break;
case ftFontModeCodeMap:
if (c <= 0xff) {
idx = FT_Get_Char_Index(fontFile->face, (FT_ULong)fontFile->codeMap[c]);
} else {
idx = 0;
}
break;
case ftFontModeCodeMapDirect:
if (c <= 0xff) {
idx = (FT_UInt)fontFile->codeMap[c];
} else {
idx = 0;
}
break;
case ftFontModeCIDToGIDMap:
if (fontFile->cidToGIDLen) {
if ((int)c < fontFile->cidToGIDLen) {
idx = (FT_UInt)fontFile->cidToGID[c];
} else {
idx = (FT_UInt)0;
}
} else {
idx = (FT_UInt)c;
}
break;
case ftFontModeCFFCharset:
#if 1 //~ cff cid->gid map
#if FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 0
CFF_Font *cff = (CFF_Font *)((TT_Face)fontFile->face)->extra.data;
#else
CFF_Font cff = (CFF_Font)((TT_Face)fontFile->face)->extra.data;
#endif
idx = 0;
for (j = 0; j < (int)cff->num_glyphs; ++j) {
if (cff->charset.sids[j] == c) {
idx = j;
break;
}
}
#endif
break;
}
return idx;
}
#endif // FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
-133
Ver Arquivo
@@ -1,133 +0,0 @@
//========================================================================
//
// FTFont.h
//
// An X wrapper for the FreeType font rasterizer.
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifndef FTFONT_H
#define FTFONT_H
#if FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#ifdef __GNUC__
#pragma interface
#endif
#include <freetype/freetype.h>
#include "CharTypes.h"
#include "SFont.h"
//------------------------------------------------------------------------
class FTFontEngine: public SFontEngine {
public:
FTFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA);
GBool isOk() { return ok; }
virtual ~FTFontEngine();
private:
FT_Library lib;
GBool aa;
Gulong palette[5];
GBool ok;
friend class FTFontFile;
friend class FTFont;
};
//------------------------------------------------------------------------
enum FTFontIndexMode {
ftFontModeUnicode,
ftFontModeCharCode,
ftFontModeCharCodeOffset,
ftFontModeCodeMap,
ftFontModeCodeMapDirect,
ftFontModeCIDToGIDMap,
ftFontModeCFFCharset
};
class FTFontFile: public SFontFile {
public:
// 8-bit font, TrueType or Type 1/1C
FTFontFile(FTFontEngine *engineA, char *fontFileName,
char **fontEnc, GBool pdfFontHasEncoding);
// CID font, TrueType
FTFontFile(FTFontEngine *engineA, char *fontFileName,
Gushort *cidToGIDA, int cidToGIDLenA);
// CID font, Type 0C (CFF)
FTFontFile(FTFontEngine *engineA, char *fontFileName);
GBool isOk() { return ok; }
virtual ~FTFontFile();
private:
FTFontEngine *engine;
FT_Face face;
FTFontIndexMode mode;
int charMapOffset;
Guint *codeMap;
Gushort *cidToGID;
int cidToGIDLen;
GBool ok;
friend class FTFont;
};
//------------------------------------------------------------------------
struct FTFontCacheTag {
Gushort code;
Gushort mru; // valid bit (0x8000) and MRU index
int x, y, w, h; // offset and size of glyph
};
class FTFont: public SFont {
public:
FTFont(FTFontFile *fontFileA, double *m);
GBool isOk() { return ok; }
virtual ~FTFont();
virtual GBool drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u);
virtual GBool getCharPath(CharCode c, Unicode u, GfxState *state);
private:
Guchar *getGlyphPixmap(CharCode c, Unicode u,
int *x, int *y, int *w, int *h);
static int charPathMoveTo(FT_Vector *pt, void *state);
static int charPathLineTo(FT_Vector *pt, void *state);
static int charPathConicTo(FT_Vector *ctrl, FT_Vector *pt, void *state);
static int charPathCubicTo(FT_Vector *ctrl1, FT_Vector *ctrl2,
FT_Vector *pt, void *state);
FT_UInt getGlyphIndex(CharCode c, Unicode u);
FTFontFile *fontFile;
FT_Size sizeObj;
XImage *image;
FT_Matrix matrix;
int glyphW, glyphH; // size of glyph pixmaps
int glyphSize; // size of glyph pixmaps, in bytes
Guchar *cache; // glyph pixmap cache
FTFontCacheTag *cacheTags; // cache tags, i.e., char codes
int cacheSets; // number of sets in cache
int cacheAssoc; // cache associativity (glyphs per set)
GBool ok;
};
#endif // FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#endif
+16 -16
Ver Arquivo
@@ -184,36 +184,36 @@ const char *macRomanEncoding[256] = {
"trademark",
"acute",
"dieresis",
NULL,
"notequal",
"AE",
"Oslash",
NULL,
"infinity",
"plusminus",
NULL,
NULL,
"lessequal",
"greaterequal",
"yen",
"mu",
NULL,
NULL,
NULL,
NULL,
NULL,
"partialdiff",
"summation",
"product",
"pi",
"integral",
"ordfeminine",
"ordmasculine",
NULL,
"Omega",
"ae",
"oslash",
"questiondown",
"exclamdown",
"logicalnot",
NULL,
"radical",
"florin",
NULL,
NULL,
"approxequal",
"Delta",
"guillemotleft",
"guillemotright",
"ellipsis",
"space",
"nobreakspace",
"Agrave",
"Atilde",
"Otilde",
@@ -226,7 +226,7 @@ const char *macRomanEncoding[256] = {
"quoteleft",
"quoteright",
"divide",
NULL,
"lozenge",
"ydieresis",
"Ydieresis",
"fraction",
@@ -251,7 +251,7 @@ const char *macRomanEncoding[256] = {
"Igrave",
"Oacute",
"Ocircumflex",
NULL,
"apple",
"Ograve",
"Uacute",
"Ucircumflex",
-4
Ver Arquivo
@@ -24,7 +24,6 @@ LIBOBJS = Annot.o \
Decrypt.o \
Dict.o \
Error.o \
FTFont.o \
FontEncoding.o \
FontEncodingTables.o \
FontFile.o \
@@ -47,10 +46,7 @@ LIBOBJS = Annot.o \
Page.o \
Params.o \
Parser.o \
SFont.o \
Stream.o \
T1Font.o \
TTFont.o \
UnicodeMap.o \
XRef.o \
gfile.o \
+4
Ver Arquivo
@@ -3165,6 +3165,10 @@ GString *PSOutputDev::filterPSName(GString *name) {
char c;
name2 = new GString();
c = name->getChar(0);
if (c >= '0' && c <= '9') {
name2->append('f');
}
for (i = 0; i < name->getLength(); ++i) {
c = name->getChar(i);
if (c <= (char)0x20 || c >= (char)0x7f ||
-80
Ver Arquivo
@@ -1,80 +0,0 @@
//========================================================================
//
// SFont.cc
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <config.h>
#include "SFont.h"
//------------------------------------------------------------------------
SFontEngine::SFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA) {
display = displayA;
visual = visualA;
depth = depthA;
colormap = colormapA;
}
SFontEngine::~SFontEngine() {
}
void SFontEngine::useTrueColor(int rMaxA, int rShiftA, int gMaxA, int gShiftA,
int bMaxA, int bShiftA) {
trueColor = gTrue;
rMax = rMaxA;
rShift = rShiftA;
gMax = gMaxA;
gShift = gShiftA;
bMax = bMaxA;
bShift = bShiftA;
}
void SFontEngine::useColorCube(Gulong *colorsA, int nRGBA) {
trueColor = gFalse;
colors = colorsA;
nRGB = nRGBA;
rMax = gMax = bMax = nRGB - 1;
}
Gulong SFontEngine::findColor(int r, int g, int b) {
int r1, g1, b1;
Gulong pix;
r1 = ((r & 0xffff) * rMax) / 0xffff;
g1 = ((g & 0xffff) * gMax) / 0xffff;
b1 = ((b & 0xffff) * bMax) / 0xffff;
if (trueColor) {
pix = (r1 << rShift) + (g1 << gShift) + (b1 << bShift);
} else {
pix = colors[(r1 * nRGB + g1) * nRGB + b1];
}
return pix;
}
//------------------------------------------------------------------------
SFontFile::SFontFile() {
}
SFontFile::~SFontFile() {
}
//------------------------------------------------------------------------
SFont::SFont() {
}
SFont::~SFont() {
}
GBool SFont::getCharPath(CharCode c, Unicode u, GfxState *state) {
return gFalse;
}
-140
Ver Arquivo
@@ -1,140 +0,0 @@
//========================================================================
//
// SFont.h
//
// Base class for font rasterizers.
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifndef SFONT_H
#define SFONT_H
#ifdef __GNUC__
#pragma interface
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "gtypes.h"
#include "CharTypes.h"
class GfxState;
//------------------------------------------------------------------------
class SFontEngine {
public:
SFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA);
virtual ~SFontEngine();
// Use a TrueColor visual. Pixel values are computed as:
//
// (r << rShift) + (g << gShift) + (b << bShift)
//
// where r, g, and b are scaled to the ranges [0,rMax], [0,gMax],
// and [0,bMax], respectively.
virtual void useTrueColor(int rMaxA, int rShiftA, int gMaxA, int gShiftA,
int bMaxA, int bShiftA);
// Use an RGB color cube. <colors> is an array containing
// <nRGB>*<nRGB>*<nRGB> pixel values in red,green,blue order, e.g.,
// for <nRGB>=2, there will be 8 entries:
//
// |--- colors[i] ---|
// i red green blue
// - ----- ----- -----
// 0 0000 0000 0000
// 1 0000 0000 ffff
// 2 0000 ffff 0000
// 3 0000 ffff ffff
// 4 ffff 0000 0000
// 5 ffff 0000 ffff
// 6 ffff ffff 0000
// 7 ffff ffff ffff
//
// The <colors> array is not copied and must remain valid for the
// lifetime of this SFont object.
virtual void useColorCube(Gulong *colorsA, int nRGBA);
protected:
// Find the closest match to (<r>,<g>,<b>).
Gulong findColor(int r, int g, int b);
//----- X parameters
Display *display;
Visual *visual;
int depth;
Colormap colormap;
GBool trueColor; // true for TrueColor, false for RGB cube
//----- TrueColor parameters
int rMax, gMax, bMax;
int rShift, gShift, bShift;
//----- RGB color cube parameters
Gulong *colors;
int nRGB;
};
//------------------------------------------------------------------------
class SFontFile {
public:
// A typical subclass will provide a constructor along the lines of:
//
// SomeFontFile(SomeFontEngine *engine, char *fontFileName);
SFontFile();
virtual ~SFontFile();
private:
};
//------------------------------------------------------------------------
class SFont {
public:
// A typical subclass will provide a constructor along the lines of:
//
// SomeFont(SomeFontFile *fontFile, double *m);
//
// where <m> is a transform matrix consisting of four elements,
// using the PostScript ordering conventions (without any
// translation):
//
// [x' y'] = [x y] * [m0 m1]
// [m2 m3]
//
// This is the level at which fonts are cached, and so the font
// cannot be transformed after it is created.
SFont();
virtual ~SFont();
// Draw a character <c>/<u> at <x>,<y> in color (<r>,<g>,<b>). The
// RGB values should each be in the range [0,65535]. Draws into
// <d>, clipped to the rectangle (0,0)-(<w>-1,<h>-1). Returns true
// if the character was drawn successfully.
virtual GBool drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u) = 0;
// Add the outline of the specified character to the current path by
// calling state->moveTo, lineTo, and curveTo. Returns true if
// successful. If this SFont subclass doesn't implement character
// paths, returns false immediately without modifying the current
// path.
virtual GBool getCharPath(CharCode c, Unicode u, GfxState *state);
protected:
};
#endif
-524
Ver Arquivo
@@ -1,524 +0,0 @@
//========================================================================
//
// T1Font.cc
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <config.h>
#if HAVE_T1LIB_H
#include <math.h>
#include <string.h>
#include <X11/Xlib.h>
#include "gmem.h"
#include "GfxState.h"
#include "T1Font.h"
//------------------------------------------------------------------------
T1FontEngine::T1FontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA, GBool aaHighA):
SFontEngine(displayA, visualA, depthA, colormapA)
{
static unsigned long grayVals[17] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
};
ok = gFalse;
T1_SetBitmapPad(8);
if (!T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE |
T1_NO_AFM)) {
return;
}
aa = aaA;
aaHigh = aaHighA;
if (aa) {
T1_AASetBitsPerPixel(8);
if (aaHigh) {
T1_AASetLevel(T1_AA_HIGH);
T1_AAHSetGrayValues(grayVals);
} else {
T1_AASetLevel(T1_AA_LOW);
T1_AASetGrayValues(0, 1, 2, 3, 4);
}
} else {
T1_AANSetGrayValues(0, 1);
}
ok = gTrue;
}
T1FontEngine::~T1FontEngine() {
T1_CloseLib();
}
//------------------------------------------------------------------------
T1FontFile::T1FontFile(T1FontEngine *engineA, char *fontFileName,
char **fontEnc, double *bboxA) {
int encStrSize;
char *encPtr;
int i;
ok = gFalse;
engine = engineA;
enc = NULL;
encStr = NULL;
for (i = 0; i < 4; ++i) {
bbox[i] = bboxA[i];
}
// load the font file
if ((id = T1_AddFont(fontFileName)) < 0) {
return;
}
T1_LoadFont(id);
// reencode it
encStrSize = 0;
for (i = 0; i < 256; ++i) {
if (fontEnc[i]) {
encStrSize += strlen(fontEnc[i]) + 1;
}
}
enc = (char **)gmalloc(257 * sizeof(char *));
encStr = (char *)gmalloc(encStrSize * sizeof(char));
encPtr = encStr;
for (i = 0; i < 256; ++i) {
if (fontEnc[i]) {
strcpy(encPtr, fontEnc[i]);
enc[i] = encPtr;
encPtr += strlen(encPtr) + 1;
} else {
enc[i] = ".notdef";
}
}
enc[256] = "custom";
T1_ReencodeFont(id, enc);
ok = gTrue;
}
T1FontFile::~T1FontFile() {
gfree(enc);
gfree(encStr);
if (id >= 0) {
T1_DeleteFont(id);
}
}
//------------------------------------------------------------------------
T1Font::T1Font(T1FontFile *fontFileA, double *m) {
T1FontEngine *engine;
T1_TMATRIX matrix;
BBox bbox;
double bbx0, bby0, bbx1, bby1;
int x, y, xMin, xMax, yMin, yMax;
int i;
ok = gFalse;
fontFile = fontFileA;
engine = fontFile->engine;
id = T1_CopyFont(fontFile->id);
// compute font size
size = (float)sqrt(m[2]*m[2] + m[3]*m[3]);
// transform the four corners of the font bounding box -- the min
// and max values form the bounding box of the transformed font
bbx0 = fontFile->bbox[0];
bby0 = fontFile->bbox[1];
bbx1 = fontFile->bbox[2];
bby1 = fontFile->bbox[3];
// some fonts in PDF files have bboxes which are just plain wrong,
// so we check the font file's bbox too
bbox = T1_GetFontBBox(id);
if (0.001 * bbox.llx < bbx0) {
bbx0 = 0.001 * bbox.llx;
}
if (0.001 * bbox.lly < bby0) {
bby0 = 0.001 * bbox.lly;
}
if (0.001 * bbox.urx > bbx1) {
bbx1 = 0.001 * bbox.urx;
}
if (0.001 * bbox.ury > bby1) {
bby1 = 0.001 * bbox.ury;
}
// some fonts are completely broken, so we fake it (with values
// large enough that most glyphs should fit)
if (bbx0 == 0 && bby0 == 0 && bbx1 == 0 && bby1 == 0) {
bbx0 = bby0 = -0.5;
bbx1 = bby1 = 1.5;
}
x = (int)(m[0] * bbx0 + m[2] * bby0);
xMin = xMax = x;
y = (int)(m[1] * bbx0 + m[3] * bby0);
yMin = yMax = y;
x = (int)(m[0] * bbx0 + m[2] * bby1);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)(m[1] * bbx0 + m[3] * bby1);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)(m[0] * bbx1 + m[2] * bby0);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)(m[1] * bbx1 + m[3] * bby0);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)(m[0] * bbx1 + m[2] * bby1);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)(m[1] * bbx1 + m[3] * bby1);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
// This is a kludge: some buggy PDF generators embed fonts with
// zero bounding boxes.
if (xMax == xMin) {
xMin = 0;
xMax = (int)size;
}
if (yMax == yMin) {
yMin = 0;
yMax = (int)(1.2 * size);
}
// Another kludge: an unusually large xMin or yMin coordinate is
// probably wrong.
if (xMin > 0) {
xMin = 0;
}
if (yMin > 0) {
yMin = 0;
}
// Another kludge: t1lib doesn't correctly handle fonts with
// real (non-integer) bounding box coordinates.
if (xMax - xMin > 5000) {
xMin = 0;
xMax = (int)size;
}
if (yMax - yMin > 5000) {
yMin = 0;
yMax = (int)(1.2 * size);
}
// this should be (max - min + 1), but we add some padding to
// deal with rounding errors
glyphW = xMax - xMin + 3;
glyphH = yMax - yMin + 3;
if (engine->aa) {
glyphSize = glyphW * glyphH;
} else {
glyphSize = ((glyphW + 7) >> 3) * glyphH;
}
// set up the glyph pixmap cache
cacheAssoc = 8;
if (glyphSize <= 256) {
cacheSets = 8;
} else if (glyphSize <= 512) {
cacheSets = 4;
} else if (glyphSize <= 1024) {
cacheSets = 2;
} else {
cacheSets = 1;
}
cache = (Guchar *)gmalloc(cacheSets * cacheAssoc * glyphSize);
cacheTags = (T1FontCacheTag *)gmalloc(cacheSets * cacheAssoc *
sizeof(T1FontCacheTag));
for (i = 0; i < cacheSets * cacheAssoc; ++i) {
cacheTags[i].mru = i & (cacheAssoc - 1);
}
// create the XImage
if (!(image = XCreateImage(engine->display, engine->visual, engine->depth,
ZPixmap, 0, NULL, glyphW, glyphH, 8, 0))) {
return;
}
image->data = (char *)gmalloc(glyphH * image->bytes_per_line);
// transform the font
matrix.cxx = m[0] / size;
matrix.cxy = m[1] / size;
matrix.cyx = m[2] / size;
matrix.cyy = m[3] / size;
T1_TransformFont(id, &matrix);
ok = gTrue;
}
T1Font::~T1Font() {
gfree(cacheTags);
gfree(cache);
if (image) {
gfree(image->data);
image->data = NULL;
XDestroyImage(image);
}
T1_DeleteFont(id);
}
GBool T1Font::drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u) {
T1FontEngine *engine;
XColor xcolor;
int bgR, bgG, bgB;
Gulong colors[17];
Guchar *p;
int xOffset, yOffset, x0, y0, x1, y1, gw, gh, w0, h0;
int xx, yy, xx1;
Guchar pix, mPix;
int i;
engine = fontFile->engine;
// generate the glyph pixmap
if (!(p = getGlyphPixmap(c, &xOffset, &yOffset, &gw, &gh))) {
return gFalse;
}
// compute: (x0,y0) = position in destination drawable
// (x1,y1) = position in glyph image
// (w0,h0) = size of image transfer
x0 = x - xOffset;
y0 = y - yOffset;
x1 = 0;
y1 = 0;
w0 = gw;
h0 = gh;
if (x0 < 0) {
x1 = -x0;
w0 += x0;
x0 = 0;
}
if (x0 + w0 > w) {
w0 = w - x0;
}
if (w0 < 0) {
return gTrue;
}
if (y0 < 0) {
y1 = -y0;
h0 += y0;
y0 = 0;
}
if (y0 + h0 > h) {
h0 = h - y0;
}
if (h0 < 0) {
return gTrue;
}
// read the X image
XGetSubImage(engine->display, d, x0, y0, w0, h0, (1 << engine->depth) - 1,
ZPixmap, image, x1, y1);
if (engine->aa) {
// compute the colors
xcolor.pixel = XGetPixel(image, x1 + w0/2, y1 + h0/2);
XQueryColor(engine->display, engine->colormap, &xcolor);
bgR = xcolor.red;
bgG = xcolor.green;
bgB = xcolor.blue;
if (engine->aaHigh) {
mPix = 16;
for (i = 1; i <= 16; ++i) {
colors[i] = engine->findColor((i * r + (16 - i) * bgR) / 16,
(i * g + (16 - i) * bgG) / 16,
(i * b + (16 - i) * bgB) / 16);
}
} else {
mPix = 4;
colors[1] = engine->findColor((r + 3*bgR) / 4,
(g + 3*bgG) / 4,
(b + 3*bgB) / 4);
colors[2] = engine->findColor((r + bgR) / 2,
(g + bgG) / 2,
(b + bgB) / 2);
colors[3] = engine->findColor((3*r + bgR) / 4,
(3*g + bgG) / 4,
(3*b + bgB) / 4);
colors[4] = engine->findColor(r, g, b);
}
// stuff the glyph pixmap into the X image
for (yy = 0; yy < gh; ++yy) {
for (xx = 0; xx < gw; ++xx) {
pix = *p++;
if (pix > 0) {
if (pix > mPix) {
pix = mPix;
}
XPutPixel(image, xx, yy, colors[pix]);
}
}
}
} else {
// one color
colors[1] = engine->findColor(r, g, b);
// stuff the glyph bitmap into the X image
for (yy = 0; yy < gh; ++yy) {
for (xx = 0; xx < gw; xx += 8) {
pix = *p++;
for (xx1 = xx; xx1 < xx + 8 && xx1 < gw; ++xx1) {
if (pix & 0x01) {
XPutPixel(image, xx1, yy, colors[1]);
}
pix >>= 1;
}
}
}
}
// draw the X image
XPutImage(engine->display, d, gc, image, x1, y1, x0, y0, w0, h0);
return gTrue;
}
Guchar *T1Font::getGlyphPixmap(CharCode c, int *x, int *y, int *w, int *h) {
T1FontEngine *engine;
GLYPH *glyph;
int gSize;
int i, j, k;
Guchar *ret;
engine = fontFile->engine;
// check the cache
i = (c & (cacheSets - 1)) * cacheAssoc;
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x8000) && cacheTags[i+j].code == c) {
*x = cacheTags[i+j].x;
*y = cacheTags[i+j].y;
*w = cacheTags[i+j].w;
*h = cacheTags[i+j].h;
for (k = 0; k < cacheAssoc; ++k) {
if (k != j &&
(cacheTags[i+k].mru & 0x7fff) < (cacheTags[i+j].mru & 0x7fff)) {
++cacheTags[i+k].mru;
}
}
cacheTags[i+j].mru = 0x8000;
return cache + (i+j) * glyphSize;
}
}
// generate the glyph pixmap
if (engine->aa) {
glyph = T1_AASetChar(id, c, size, NULL);
} else {
glyph = T1_SetChar(id, c, size, NULL);
}
if (!glyph) {
return NULL;
}
*x = -glyph->metrics.leftSideBearing;
*y = glyph->metrics.ascent;
*w = glyph->metrics.rightSideBearing - glyph->metrics.leftSideBearing;
*h = glyph->metrics.ascent - glyph->metrics.descent;
if (*w > glyphW || *h > glyphH) {
#if 1 //~ debug
fprintf(stderr, "Weird t1lib glyph size: %d > %d or %d > %d\n",
*w, glyphW, *h, glyphH);
#endif
return NULL;
}
// store glyph pixmap in cache
ret = NULL;
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x7fff) == cacheAssoc - 1) {
cacheTags[i+j].mru = 0x8000;
cacheTags[i+j].code = c;
cacheTags[i+j].x = *x;
cacheTags[i+j].y = *y;
cacheTags[i+j].w = *w;
cacheTags[i+j].h = *h;
if (engine->aa) {
gSize = *w * *h;
} else {
gSize = ((*w + 7) >> 3) * *h;
}
ret = cache + (i+j) * glyphSize;
if (glyph->bits) {
memcpy(ret, glyph->bits, gSize);
} else {
memset(ret, 0, gSize);
}
} else {
++cacheTags[i+j].mru;
}
}
return ret;
}
GBool T1Font::getCharPath(CharCode c, Unicode u, GfxState *state) {
T1_OUTLINE *outline;
T1_PATHSEGMENT *seg;
T1_BEZIERSEGMENT *bez;
double x, y, x1, y1;
outline = T1_GetCharOutline(id, c, size, NULL);
x = 0;
y = 0;
for (seg = outline; seg; seg = seg->link) {
switch (seg->type) {
case T1_PATHTYPE_MOVE:
x += seg->dest.x / 65536.0;
y += seg->dest.y / 65536.0;
state->moveTo(x, y);
break;
case T1_PATHTYPE_LINE:
x += seg->dest.x / 65536.0;
y += seg->dest.y / 65536.0;
state->lineTo(x, y);
break;
case T1_PATHTYPE_BEZIER:
bez = (T1_BEZIERSEGMENT *)seg;
x1 = x + bez->dest.x / 65536.0;
y1 = y + bez->dest.y / 65536.0;
state->curveTo(x + bez->B.x / 65536.0, y + bez->B.y / 65536.0,
x + bez->C.x / 65536.0, y + bez->C.y / 65536.0,
x1, y1);
x = x1;
y = y1;
break;
}
}
T1_FreeOutline(outline);
return gTrue;
}
#endif // HAVE_T1LIB_H
-106
Ver Arquivo
@@ -1,106 +0,0 @@
//========================================================================
//
// T1Font.h
//
// An X wrapper for the t1lib Type 1 font rasterizer.
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifndef T1FONT_H
#define T1FONT_H
#if HAVE_T1LIB_H
#ifdef __GNUC__
#pragma interface
#endif
#include <X11/Xlib.h>
#include <t1lib.h>
#include "SFont.h"
class GfxState;
//------------------------------------------------------------------------
class T1FontEngine: public SFontEngine {
public:
T1FontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA, GBool aaHighA);
GBool isOk() { return ok; }
virtual ~T1FontEngine();
private:
GBool aa; // use anti-aliasing?
GBool aaHigh; // use high-res anti-aliasing?
GBool ok;
friend class T1FontFile;
friend class T1Font;
};
//------------------------------------------------------------------------
class T1FontFile: public SFontFile {
public:
T1FontFile(T1FontEngine *engineA, char *fontFileName,
char **fontEnc, double *bboxA);
GBool isOk() { return ok; }
virtual ~T1FontFile();
private:
T1FontEngine *engine;
int id; // t1lib font ID
char **enc;
char *encStr;
double bbox[4];
GBool ok;
friend class T1Font;
};
//------------------------------------------------------------------------
struct T1FontCacheTag {
Gushort code;
Gushort mru; // valid bit (0x8000) and MRU index
int x, y, w, h; // offset and size of glyph
};
class T1Font: public SFont {
public:
T1Font(T1FontFile *fontFileA, double *m);
GBool isOk() { return ok; }
virtual ~T1Font();
virtual GBool drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u);
virtual GBool getCharPath(CharCode c, Unicode u, GfxState *state);
private:
Guchar *getGlyphPixmap(CharCode c, int *x, int *y, int *w, int *h);
T1FontFile *fontFile;
int id;
float size;
XImage *image;
int glyphW, glyphH; // size of glyph pixmaps
int glyphSize; // size of glyph pixmaps, in bytes
Guchar *cache; // glyph pixmap cache
T1FontCacheTag *cacheTags; // cache tags, i.e., char codes
int cacheSets; // number of sets in cache
int cacheAssoc; // cache associativity (glyphs per set)
GBool ok;
};
#endif // HAVE_T1LIB_H
#endif
-480
Ver Arquivo
@@ -1,480 +0,0 @@
//========================================================================
//
// TTFont.cc
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifdef __GNUC__
#pragma implementation
#endif
#include <config.h>
#if !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#include <string.h>
#include "gmem.h"
#include "GlobalParams.h"
#include "TTFont.h"
//------------------------------------------------------------------------
TTFontEngine::TTFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA):
SFontEngine(displayA, visualA, depthA, colormapA) {
static TT_Byte ttPalette[5] = {0, 1, 2, 3, 4};
ok = gFalse;
if (TT_Init_FreeType(&engine)) {
return;
}
aa = aaA;
if (aa) {
if (TT_Set_Raster_Gray_Palette(engine, ttPalette)) {
return;
}
}
ok = gTrue;
}
TTFontEngine::~TTFontEngine() {
TT_Done_FreeType(engine);
}
//------------------------------------------------------------------------
TTFontFile::TTFontFile(TTFontEngine *engineA, char *fontFileName,
char **fontEnc, GBool pdfFontHasEncoding) {
TT_Face_Properties props;
TT_UShort unicodeCmap, macRomanCmap, msSymbolCmap;
TT_UShort platform, encoding, i;
int j;
ok = gFalse;
engine = engineA;
codeMap = NULL;
if (TT_Open_Face(engine->engine, fontFileName, &face)) {
return;
}
if (TT_Get_Face_Properties(face, &props)) {
return;
}
// To match up with the Adobe-defined behaviour, we choose a cmap
// like this:
// 1. If the PDF font has an encoding:
// 1a. If the TrueType font has a Microsoft Unicode cmap, use it,
// and use the Unicode indexes, not the char codes.
// 1b. If the TrueType font has a Macintosh Roman cmap, use it,
// and reverse map the char names through MacRomanEncoding to
// get char codes.
// 2. If the PDF font does not have an encoding:
// 2a. If the TrueType font has a Macintosh Roman cmap, use it,
// and use char codes directly.
// 2b. If the TrueType font has a Microsoft Symbol cmap, use it,
// and use (0xf000 + char code).
// 3. If none of these rules apply, use the first cmap and hope for
// the best (this shouldn't happen).
unicodeCmap = macRomanCmap = msSymbolCmap = 0xffff;
for (i = 0; i < props.num_CharMaps; ++i) {
if (!TT_Get_CharMap_ID(face, i, &platform, &encoding)) {
if (platform == 3 && encoding == 1) {
unicodeCmap = i;
} else if (platform == 1 && encoding == 0) {
macRomanCmap = i;
} else if (platform == 3 && encoding == 0) {
msSymbolCmap = i;
}
}
}
i = 0;
mode = ttFontModeCharCode;
charMapOffset = 0;
if (pdfFontHasEncoding) {
if (unicodeCmap != 0xffff) {
i = unicodeCmap;
mode = ttFontModeUnicode;
} else if (macRomanCmap != 0xffff) {
i = macRomanCmap;
mode = ttFontModeCodeMap;
codeMap = (Guchar *)gmalloc(256 * sizeof(Guchar));
for (j = 0; j < 256; ++j) {
if (fontEnc[j]) {
codeMap[j] = (Guchar)globalParams->getMacRomanCharCode(fontEnc[j]);
} else {
codeMap[j] = 0;
}
}
}
} else {
if (macRomanCmap != 0xffff) {
i = macRomanCmap;
mode = ttFontModeCharCode;
} else if (msSymbolCmap != 0xffff) {
i = msSymbolCmap;
mode = ttFontModeCharCodeOffset;
charMapOffset = 0xf000;
}
}
TT_Get_CharMap(face, i, &charMap);
ok = gTrue;
}
TTFontFile::TTFontFile(TTFontEngine *engineA, char *fontFileName,
Gushort *cidToGIDA, int cidToGIDLenA) {
ok = gFalse;
engine = engineA;
codeMap = NULL;
cidToGID = cidToGIDA;
cidToGIDLen = cidToGIDLenA;
if (TT_Open_Face(engine->engine, fontFileName, &face)) {
return;
}
mode = ttFontModeCIDToGIDMap;
ok = gTrue;
}
TTFontFile::~TTFontFile() {
TT_Close_Face(face);
if (codeMap) {
gfree(codeMap);
}
}
//------------------------------------------------------------------------
TTFont::TTFont(TTFontFile *fontFileA, double *m) {
TTFontEngine *engine;
TT_Face_Properties props;
TT_Instance_Metrics metrics;
int x, xMin, xMax;
int y, yMin, yMax;
int i;
ok = gFalse;
fontFile = fontFileA;
engine = fontFile->engine;
if (TT_New_Instance(fontFile->face, &instance) ||
TT_Set_Instance_Resolutions(instance, 72, 72) ||
TT_Set_Instance_CharSize(instance, 1000 * 64) ||
TT_New_Glyph(fontFile->face, &glyph) ||
TT_Get_Face_Properties(fontFile->face, &props) ||
TT_Get_Instance_Metrics(instance, &metrics)) {
return;
}
// transform the four corners of the font bounding box -- the min
// and max values form the bounding box of the transformed font
x = (int)((m[0] * props.header->xMin + m[2] * props.header->yMin) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
xMin = xMax = x;
y = (int)((m[1] * props.header->xMin + m[3] * props.header->yMin) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
yMin = yMax = y;
x = (int)((m[0] * props.header->xMin + m[2] * props.header->yMax) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * props.header->xMin + m[3] * props.header->yMax) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)((m[0] * props.header->xMax + m[2] * props.header->yMin) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * props.header->xMax + m[3] * props.header->yMin) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
x = (int)((m[0] * props.header->xMax + m[2] * props.header->yMax) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (x < xMin) {
xMin = x;
} else if (x > xMax) {
xMax = x;
}
y = (int)((m[1] * props.header->xMax + m[3] * props.header->yMax) *
0.001 * metrics.x_ppem / props.header->Units_Per_EM);
if (y < yMin) {
yMin = y;
} else if (y > yMax) {
yMax = y;
}
xOffset = -xMin;
yOffset = -yMin;
ras.width = xMax - xMin + 1;
ras.rows = yMax - yMin + 1;
// set up the Raster_Map structure
if (engine->aa) {
ras.width = (ras.width + 3) & ~3;
ras.cols = ras.width;
} else {
ras.width = (ras.width + 7) & ~7;
ras.cols = ras.width >> 3;
}
ras.flow = TT_Flow_Down;
ras.size = ras.rows * ras.cols;
ras.bitmap = gmalloc(ras.size);
// set up the glyph pixmap cache
cacheAssoc = 8;
if (ras.size <= 256) {
cacheSets = 8;
} else if (ras.size <= 512) {
cacheSets = 4;
} else if (ras.size <= 1024) {
cacheSets = 2;
} else {
cacheSets = 1;
}
cache = (Guchar *)gmalloc(cacheSets * cacheAssoc * ras.size);
cacheTags = (TTFontCacheTag *)gmalloc(cacheSets * cacheAssoc *
sizeof(TTFontCacheTag));
for (i = 0; i < cacheSets * cacheAssoc; ++i) {
cacheTags[i].mru = i & (cacheAssoc - 1);
}
// create the XImage
if (!(image = XCreateImage(engine->display, engine->visual, engine->depth,
ZPixmap, 0, NULL, ras.width, ras.rows, 8, 0))) {
return;
}
image->data = (char *)gmalloc(ras.rows * image->bytes_per_line);
// compute the transform matrix
matrix.xx = (TT_Fixed)(m[0] * 65.536);
matrix.yx = (TT_Fixed)(m[1] * 65.536);
matrix.xy = (TT_Fixed)(m[2] * 65.536);
matrix.yy = (TT_Fixed)(m[3] * 65.536);
ok = gTrue;
}
TTFont::~TTFont() {
gfree(cacheTags);
gfree(cache);
gfree(image->data);
image->data = NULL;
XDestroyImage(image);
gfree(ras.bitmap);
TT_Done_Glyph(glyph);
TT_Done_Instance(instance);
}
GBool TTFont::drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u) {
TTFontEngine *engine;
XColor xcolor;
int bgR, bgG, bgB;
Gulong colors[5];
TT_Byte *p;
TT_Byte pix;
int xx, yy, xx1;
int x0, y0, x1, y1, w0, h0;
engine = fontFile->engine;
// compute: (x0,y0) = position in destination drawable
// (x1,y1) = position in glyph image
// (w0,h0) = size of image transfer
x0 = x - xOffset;
y0 = y - (ras.rows - yOffset);
x1 = 0;
y1 = 0;
w0 = ras.width;
h0 = ras.rows;
if (x0 < 0) {
x1 = -x0;
w0 += x0;
x0 = 0;
}
if (x0 + w0 > w) {
w0 = w - x0;
}
if (w0 < 0) {
return gTrue;
}
if (y0 < 0) {
y1 = -y0;
h0 += y0;
y0 = 0;
}
if (y0 + h0 > h) {
h0 = h - y0;
}
if (h0 < 0) {
return gTrue;
}
// read the X image
XGetSubImage(engine->display, d, x0, y0, w0, h0, (1 << engine->depth) - 1,
ZPixmap, image, x1, y1);
// generate the glyph pixmap
if (!getGlyphPixmap(c, u)) {
return gFalse;
}
if (engine->aa) {
// compute the colors
xcolor.pixel = XGetPixel(image, x1 + w0/2, y1 + h0/2);
XQueryColor(engine->display, engine->colormap, &xcolor);
bgR = xcolor.red;
bgG = xcolor.green;
bgB = xcolor.blue;
colors[1] = engine->findColor((r + 3*bgR) / 4,
(g + 3*bgG) / 4,
(b + 3*bgB) / 4);
colors[2] = engine->findColor((r + bgR) / 2,
(g + bgG) / 2,
(b + bgB) / 2);
colors[3] = engine->findColor((3*r + bgR) / 4,
(3*g + bgG) / 4,
(3*b + bgB) / 4);
colors[4] = engine->findColor(r, g, b);
// stuff the glyph pixmap into the X image
p = (TT_Byte *)ras.bitmap;
for (yy = 0; yy < ras.rows; ++yy) {
for (xx = 0; xx < ras.width; ++xx) {
pix = *p++;
if (pix > 0) {
if (pix > 4) {
pix = 4;
}
XPutPixel(image, xx, yy, colors[pix]);
}
}
}
} else {
// one color
colors[1] = engine->findColor(r, g, b);
// stuff the glyph bitmap into the X image
p = (TT_Byte *)ras.bitmap;
for (yy = 0; yy < ras.rows; ++yy) {
for (xx = 0; xx < ras.width; xx += 8) {
pix = *p++;
for (xx1 = xx; xx1 < xx + 8 && xx1 < ras.width; ++xx1) {
if (pix & 0x80) {
XPutPixel(image, xx1, yy, colors[1]);
}
pix <<= 1;
}
}
}
}
// draw the X image
XPutImage(engine->display, d, gc, image, x1, y1, x0, y0, w0, h0);
return gTrue;
}
GBool TTFont::getGlyphPixmap(CharCode c, Unicode u) {
TT_UShort idx;
TT_Outline outline;
int i, j, k;
// check the cache
i = (c & (cacheSets - 1)) * cacheAssoc;
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x8000) && cacheTags[i+j].code == c) {
memcpy(ras.bitmap, cache + (i+j) * ras.size, ras.size);
for (k = 0; k < cacheAssoc; ++k) {
if (k != j &&
(cacheTags[i+k].mru & 0x7fff) < (cacheTags[i+j].mru & 0x7fff)) {
++cacheTags[i+k].mru;
}
}
cacheTags[i+j].mru = 0x8000;
return gTrue;
}
}
// generate the glyph pixmap or bitmap
idx = 0; // make gcc happy
switch (fontFile->mode) {
case ttFontModeUnicode:
idx = TT_Char_Index(fontFile->charMap, (TT_UShort)u);
break;
case ttFontModeCharCode:
idx = TT_Char_Index(fontFile->charMap, (TT_UShort)c);
break;
case ttFontModeCharCodeOffset:
idx = TT_Char_Index(fontFile->charMap,
(TT_UShort)(c + fontFile->charMapOffset));
break;
case ttFontModeCodeMap:
if (c <= 0xff) {
idx = TT_Char_Index(fontFile->charMap,
(TT_UShort)(fontFile->codeMap[c] & 0xff));
} else {
idx = 0;
}
break;
case ttFontModeCIDToGIDMap:
if (fontFile->cidToGIDLen) {
if ((int)c < fontFile->cidToGIDLen) {
idx = (TT_UShort)fontFile->cidToGID[c];
} else {
idx = (TT_UShort)0;
}
} else {
idx = (TT_UShort)c;
}
break;
}
if (TT_Load_Glyph(instance, glyph, idx, TTLOAD_DEFAULT) ||
TT_Get_Glyph_Outline(glyph, &outline)) {
return gFalse;
}
TT_Transform_Outline(&outline, &matrix);
memset(ras.bitmap, 0, ras.size);
if (fontFile->engine->aa) {
if (TT_Get_Glyph_Pixmap(glyph, &ras, xOffset * 64, yOffset * 64)) {
return gFalse;
}
} else {
if (TT_Get_Glyph_Bitmap(glyph, &ras, xOffset * 64, yOffset * 64)) {
return gFalse;
}
}
// store glyph pixmap in cache
for (j = 0; j < cacheAssoc; ++j) {
if ((cacheTags[i+j].mru & 0x7fff) == cacheAssoc - 1) {
cacheTags[i+j].mru = 0x8000;
cacheTags[i+j].code = c;
memcpy(cache + (i+j) * ras.size, ras.bitmap, ras.size);
} else {
++cacheTags[i+j].mru;
}
}
return gTrue;
}
#endif // !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
-127
Ver Arquivo
@@ -1,127 +0,0 @@
//========================================================================
//
// TTFont.h
//
// An X wrapper for the FreeType TrueType font rasterizer.
//
// Copyright 2001-2002 Glyph & Cog, LLC
//
//========================================================================
#ifndef TTFONT_H
#define TTFONT_H
#if !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#ifdef __GNUC__
#pragma interface
#endif
#if HAVE_FREETYPE_FREETYPE_H
#include <freetype/freetype.h>
#include <freetype/ftxpost.h>
#else
#include <freetype.h>
#include <ftxpost.h>
#endif
#include "gtypes.h"
#include "SFont.h"
//------------------------------------------------------------------------
class TTFontEngine: public SFontEngine {
public:
TTFontEngine(Display *displayA, Visual *visualA, int depthA,
Colormap colormapA, GBool aaA);
GBool isOk() { return ok; }
virtual ~TTFontEngine();
private:
TT_Engine engine;
GBool aa;
Gulong palette[5];
GBool ok;
friend class TTFontFile;
friend class TTFont;
};
//------------------------------------------------------------------------
enum TTFontIndexMode {
ttFontModeUnicode,
ttFontModeCharCode,
ttFontModeCharCodeOffset,
ttFontModeCodeMap,
ttFontModeCIDToGIDMap
};
class TTFontFile: public SFontFile {
public:
// 8-bit font, TrueType or Type 1/1C
TTFontFile(TTFontEngine *engineA, char *fontFileName,
char **fontEnc, GBool pdfFontHasEncoding);
// CID font, TrueType
TTFontFile(TTFontEngine *engineA, char *fontFileName,
Gushort *cidToGIDA, int cidToGIDLenA);
GBool isOk() { return ok; }
virtual ~TTFontFile();
private:
TTFontEngine *engine;
TT_Face face;
TT_CharMap charMap;
TTFontIndexMode mode;
int charMapOffset;
Guchar *codeMap;
Gushort *cidToGID;
int cidToGIDLen;
GBool ok;
friend class TTFont;
};
//------------------------------------------------------------------------
struct TTFontCacheTag {
Gushort code;
Gushort mru; // valid bit (0x8000) and MRU index
};
class TTFont: public SFont {
public:
TTFont(TTFontFile *fontFileA, double *m);
GBool isOk() { return ok; }
virtual ~TTFont();
virtual GBool drawChar(Drawable d, int w, int h, GC gc,
int x, int y, int r, int g, int b,
CharCode c, Unicode u);
private:
GBool getGlyphPixmap(CharCode c, Unicode u);
TTFontFile *fontFile;
TT_Instance instance;
TT_Glyph glyph;
TT_Raster_Map ras;
XImage *image;
TT_Matrix matrix;
TT_F26Dot6 xOffset, yOffset;
Guchar *cache; // glyph pixmap cache
TTFontCacheTag *cacheTags; // cache tags, i.e., char codes
int cacheSets; // number of sets in cache
int cacheAssoc; // cache associativity (glyphs per set)
GBool ok;
};
#endif // !FREETYPE2 && (HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H)
#endif
+7
Ver Arquivo
@@ -104,6 +104,13 @@
// uncompress program
//------------------------------------------------------------------------
// Many Linux distributions no longer ship uncompress, but all ship
// gzip...
#if defined(__linux) && !defined(USE_GZIP)
# define USE_GZIP
#endif // __linux && USE_GZIP
#ifdef HAVE_POPEN
// command to uncompress to stdout
+11 -1
Ver Arquivo
@@ -44,7 +44,7 @@
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*VariablePaperSize: False
*VariablePaperSize: True
*TTRasterizer: Type42
*OpenUI *PageSize/Media Size: PickOne
@@ -77,6 +77,16 @@
*PaperDimension A4: "595 842"
*PaperDimension FanFoldUS: "1071 792"
*MaxMediaWidth: "1080"
*MaxMediaHeight: "86400"
*HWMargins: 0 0 0 0
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 36 1080
*ParamCustomPageSize Height: 2 points 36 86400
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0
*OpenUI *Resolution/Output Resolution: PickOne
*OrderDependency: 20 AnySetup *Resolution
*DefaultResolution: 120dpi
+11 -1
Ver Arquivo
@@ -44,7 +44,7 @@
*FileSystem: False
*Throughput: "1"
*LandscapeOrientation: Plus90
*VariablePaperSize: False
*VariablePaperSize: True
*TTRasterizer: Type42
*OpenUI *PageSize/Media Size: PickOne
@@ -77,6 +77,16 @@
*PaperDimension A4: "595 842"
*PaperDimension FanFoldUS: "1071 792"
*MaxMediaWidth: "1080"
*MaxMediaHeight: "86400"
*HWMargins: 0 0 0 0
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 36 1080
*ParamCustomPageSize Height: 2 points 36 86400
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0
*OpenUI *Resolution/Output Resolution: PickOne
*OrderDependency: 20 AnySetup *Resolution
*DefaultResolution: 120dpi
+13 -9
Ver Arquivo
@@ -993,16 +993,9 @@ IsAuthorized(client_t *con) /* I - Connection */
* Get the user info...
*/
pw = getpwnam(con->username); /* Get the current password */
pw = getpwnam(con->username); /* Get the current password */
endpwent(); /* Close the password file */
if (pw == NULL) /* No such user... */
{
LogMessage(L_WARN, "IsAuthorized: Unknown username \"%s\"; access denied.",
con->username);
return (HTTP_UNAUTHORIZED);
}
#if HAVE_LIBPAM
/*
* Only use PAM to do authentication. This allows MD5 passwords, among
@@ -1067,6 +1060,17 @@ IsAuthorized(client_t *con) /* I - Connection */
return (HTTP_UNAUTHORIZED);
}
#else
/*
* Use normal UNIX password file-based authentication...
*/
if (pw == NULL) /* No such user... */
{
LogMessage(L_WARN, "IsAuthorized: Unknown username \"%s\"; access denied.",
con->username);
return (HTTP_UNAUTHORIZED);
}
# ifdef HAVE_SHADOW_H
spw = getspnam(con->username);
endspent();
@@ -1282,7 +1286,7 @@ IsAuthorized(client_t *con) /* I - Connection */
* Check to see if the default group ID matches for the user...
*/
if (grp->gr_gid == pw->pw_gid)
if (pw != NULL && grp->gr_gid == pw->pw_gid)
return (HTTP_OK);
}
+16
Ver Arquivo
@@ -57,6 +57,8 @@ AddCert(int pid, /* I - Process ID */
/* Hex constants... */
LogMessage(L_DEBUG2, "AddCert: adding certificate for pid %d", pid);
/*
* Allocate memory for the certificate...
*/
@@ -114,6 +116,9 @@ AddCert(int pid, /* I - Process ID */
fchown(fileno(fp), User, Group);
}
DEBUG_printf(("ADD pid=%d, username=%s, cert=%s\n", pid, username,
cert->certificate));
fputs(cert->certificate, fp);
fclose(fp);
@@ -145,6 +150,11 @@ DeleteCert(int pid) /* I - Process ID */
* Remove this certificate from the list...
*/
LogMessage(L_DEBUG2, "DeleteCert: removing certificate for pid %d", pid);
DEBUG_printf(("DELETE pid=%d, username=%s, cert=%s\n", cert->pid,
cert->username, cert->certificate));
if (prev == NULL)
Certs = cert->next;
else
@@ -211,9 +221,15 @@ FindCert(const char *certificate) /* I - Certificate */
cert_t *cert; /* Current certificate */
DEBUG_printf(("FindCert(certificate=%s)\n", certificate));
for (cert = Certs; cert != NULL; cert = cert->next)
if (strcasecmp(certificate, cert->certificate) == 0)
{
DEBUG_printf((" returning %s...\n", cert->username));
return (cert->username);
}
DEBUG_puts(" certificate not found!");
return (NULL);
}
+6 -6
Ver Arquivo
@@ -64,12 +64,6 @@ AddClass(const char *name) /* I - Name of class */
c->type = CUPS_PRINTER_CLASS;
snprintf(c->uri, sizeof(c->uri), "ipp://%s:%d/classes/%s", ServerName,
ntohs(Listeners[0].address.sin_port), name);
/*
* Set the printer attributes to make this a class.
*/
SetPrinterAttrs(c);
}
return (c);
@@ -350,7 +344,11 @@ LoadAllClasses(void)
snprintf(line, sizeof(line), "%s/classes.conf", ServerRoot);
if ((fp = fopen(line, "r")) == NULL)
{
LogMessage(L_ERROR, "LoadAllClasses: Unable to open %s - %s", line,
strerror(errno));
return;
}
/*
* Read class configurations until we hit EOF...
@@ -414,6 +412,8 @@ LoadAllClasses(void)
{
line[len - 1] = '\0';
LogMessage(L_DEBUG, "LoadAllClasses: Loading class %s...", value);
p = AddClass(value);
p->accepting = 1;
p->state = IPP_PRINTER_IDLE;
+22 -9
Ver Arquivo
@@ -489,6 +489,9 @@ ReadClient(client_t *con) /* I - Client to read from */
status = HTTP_CONTINUE;
LogMessage(L_DEBUG2, "ReadClient() %d, used=%d", con->http.fd,
con->http.used);
switch (con->http.state)
{
case HTTP_WAITING :
@@ -542,18 +545,20 @@ ReadClient(client_t *con) /* I - Client to read from */
switch (sscanf(line, "%63s%1023s%63s", operation, con->uri, version))
{
case 1 :
LogMessage(L_ERROR, "Bad request line \"%s\"!", line);
SendError(con, HTTP_BAD_REQUEST);
ShutdownClient(con);
return (0);
return (1);
case 2 :
con->http.version = HTTP_0_9;
break;
case 3 :
if (sscanf(version, "HTTP/%d.%d", &major, &minor) != 2)
{
LogMessage(L_ERROR, "Bad request line \"%s\"!", line);
SendError(con, HTTP_BAD_REQUEST);
ShutdownClient(con);
return (0);
return (1);
}
if (major < 2)
@@ -568,7 +573,7 @@ ReadClient(client_t *con) /* I - Client to read from */
{
SendError(con, HTTP_NOT_SUPPORTED);
ShutdownClient(con);
return (0);
return (1);
}
break;
}
@@ -593,9 +598,10 @@ ReadClient(client_t *con) /* I - Client to read from */
con->http.state = HTTP_HEAD;
else
{
LogMessage(L_ERROR, "Bad operation \"%s\"!", operation);
SendError(con, HTTP_BAD_REQUEST);
ShutdownClient(con);
return (0);
return (1);
}
con->start = time(NULL);
@@ -624,7 +630,7 @@ ReadClient(client_t *con) /* I - Client to read from */
{
SendError(con, HTTP_BAD_REQUEST);
ShutdownClient(con);
return (0);
return (1);
}
break;
@@ -771,9 +777,11 @@ ReadClient(client_t *con) /* I - Client to read from */
if ((status = IsAuthorized(con)) != HTTP_OK)
{
LogMessage(L_DEBUG2, "ReadClient: Unauthorized request for %s...\n",
con->uri);
SendError(con, status);
ShutdownClient(con);
return (0);
return (1);
}
switch (con->http.state)
@@ -1070,7 +1078,7 @@ ReadClient(client_t *con) /* I - Client to read from */
case HTTP_TRACE :
SendError(con, HTTP_NOT_IMPLEMENTED);
ShutdownClient(con);
return (0);
return (1);
case HTTP_HEAD :
if (strncmp(con->uri, "/printers/", 10) == 0 &&
@@ -1564,7 +1572,8 @@ SendError(client_t *con, /* I - Connection */
return (0);
#endif /* HAVE_LIBSSL */
if (con->http.version >= HTTP_1_1 && !con->http.keep_alive)
if ((con->http.version >= HTTP_1_1 && !con->http.keep_alive) ||
(code >= HTTP_BAD_REQUEST && code != HTTP_UPGRADE_REQUIRED))
{
if (httpPrintf(HTTP(con), "Connection: close\r\n") < 0)
return (0);
@@ -1725,6 +1734,7 @@ ShutdownClient(client_t *con) /* I - Client connection */
*/
shutdown(con->http.fd, 0);
con->http.used = 0;
LogMessage(L_DEBUG2, "ShutdownClient: Removing fd %d from InputSet...",
con->http.fd);
@@ -2356,7 +2366,10 @@ pipe_command(client_t *con, /* I - Client connection */
con->language ? con->language->language : "C");
sprintf(ipp_port, "IPP_PORT=%d", ntohs(con->http.hostaddr.sin_port));
sprintf(server_port, "SERVER_PORT=%d", ntohs(con->http.hostaddr.sin_port));
snprintf(server_name, sizeof(server_name), "SERVER_NAME=%s", ServerName);
if (strcmp(con->http.hostname, "localhost") == 0)
strlcpy(server_name, "SERVER_NAME=localhost", sizeof(server_name));
else
snprintf(server_name, sizeof(server_name), "SERVER_NAME=%s", ServerName);
snprintf(remote_host, sizeof(remote_host), "REMOTE_HOST=%s", con->http.hostname);
snprintf(remote_user, sizeof(remote_user), "REMOTE_USER=%s", con->username);
snprintf(tmpdir, sizeof(tmpdir), "TMPDIR=%s", TempDir);
+37 -14
Ver Arquivo
@@ -434,6 +434,8 @@ ProcessIPPRequest(client_t *con) /* I - Client connection */
}
}
LogMessage(L_DEBUG, "ProcessIPPRequest: %d status_code=%x",
con->http.fd, con->response->request.status.status_code);
SendHeader(con, HTTP_OK, "application/ipp");
con->http.data_encoding = HTTP_ENCODE_LENGTH;
@@ -4498,14 +4500,23 @@ read_ps_job_ticket(client_t *con) /* I - Client connection */
* Some other value; first free the old value...
*/
for (prev2 = con->request->attrs; prev2 != NULL; prev2 = prev2->next)
if (prev2->next == attr2)
break;
if (prev2)
prev2->next = attr2->next;
else
if (con->request->attrs == attr2)
{
con->request->attrs = attr2->next;
prev2 = NULL;
}
else
{
for (prev2 = con->request->attrs; prev2 != NULL; prev2 = prev2->next)
if (prev2->next == attr2)
{
prev2->next = attr2->next;
break;
}
}
if (con->request->last == attr2)
con->request->last = prev2;
_ipp_free_attr(attr2);
}
@@ -5497,14 +5508,23 @@ set_job_attrs(client_t *con, /* I - Client connection */
* Some other value; first free the old value...
*/
for (prev2 = job->attrs->attrs; prev2 != NULL; prev2 = prev2->next)
if (prev2->next == attr2)
break;
if (prev2)
prev2->next = attr2->next;
if (con->request->attrs == attr2)
{
con->request->attrs = attr2->next;
prev2 = NULL;
}
else
job->attrs->attrs = attr2->next;
{
for (prev2 = con->request->attrs; prev2 != NULL; prev2 = prev2->next)
if (prev2->next == attr2)
{
prev2->next = attr2->next;
break;
}
}
if (con->request->last == attr2)
con->request->last = prev2;
_ipp_free_attr(attr2);
@@ -5549,6 +5569,9 @@ set_job_attrs(client_t *con, /* I - Client connection */
else
job->attrs->attrs = attr2->next;
if (attr2 == job->attrs->last)
job->attrs->last = prev2;
_ipp_free_attr(attr2);
}
}
+65 -21
Ver Arquivo
@@ -505,6 +505,8 @@ LoadAllJobs(void)
LogMessage(L_DEBUG, "LoadAllJobs: Scanning %s...", RequestRoot);
NumJobs = 0;
if ((dir = opendir(RequestRoot)) == NULL)
{
LogMessage(L_ERROR, "LoadAllJobs: Unable to open spool directory %s: %s",
@@ -1093,7 +1095,6 @@ StartJob(int id, /* I - Job ID */
title[IPP_MAX_NAME],
/* Job title string */
copies[255], /* # copies string */
options[16384], /* Full list of options */
*envp[20], /* Environment variables */
path[1024], /* PATH environment variable */
language[255], /* LANG environment variable */
@@ -1116,6 +1117,8 @@ StartJob(int id, /* I - Job ID */
nlspath[1024], /* NLSPATH environment variable */
datadir[1024], /* CUPS_DATADIR environment variable */
fontpath[1050]; /* CUPS_FONTPATH environment variable */
static char *options = NULL;/* Full list of options */
static int optlength = 0; /* Length of option buffer */
LogMessage(L_DEBUG, "StartJob(%d, %p)", id, printer);
@@ -1145,12 +1148,15 @@ StartJob(int id, /* I - Job ID */
num_filters = 0;
current->cost = 0;
if (printer->type & CUPS_PRINTER_REMOTE)
if (printer->raw)
{
/*
* Remote jobs go directly to the remote job...
* Remote jobs and raw queues go directly to the printer without
* filtering...
*/
LogMessage(L_DEBUG, "StartJob: Sending job to queue tagged as raw...");
filters = NULL;
}
else
@@ -1287,6 +1293,45 @@ StartJob(int id, /* I - Job ID */
* Building the options string is harder than it needs to be, but
* for the moment we need to pass strings for command-line args and
* not IPP attribute pointers... :)
*
* First allocate/reallocate the option buffer as needed... Using
* twice the raw length of the IPP attributes provides enough space for
* all options that are encoded as text, as we only need 1 byte of
* overhead for normal attributes and 6 bytes for boolean attributes,
* and each attribute has at least 5 bytes of overhead in the IPP
* message...
*/
i = 2 * ippLength(current->attrs);
if (i > optlength)
{
if (optlength == 0)
optptr = malloc(i);
else
optptr = realloc(options, i);
if (optptr == NULL)
{
LogMessage(L_CRIT, "StartJob: Unable to allocate %d bytes for option buffer for job %d!",
i, id);
if (filters != NULL)
free(filters);
FilterLevel -= current->cost;
CancelJob(id, 0);
return;
}
options = optptr;
optlength = i;
}
/*
* Now loop through the attributes and convert them to the textual
* representation used by the filters...
*/
optptr = options;
@@ -1349,18 +1394,18 @@ StartJob(int id, /* I - Job ID */
*/
if (optptr > options)
strlcat(optptr, " ", sizeof(options) - (optptr - options));
strlcat(optptr, " ", optlength - (optptr - options));
if (attr->value_tag != IPP_TAG_BOOLEAN)
{
strlcat(optptr, attr->name, sizeof(options) - (optptr - options));
strlcat(optptr, "=", sizeof(options) - (optptr - options));
strlcat(optptr, attr->name, optlength - (optptr - options));
strlcat(optptr, "=", optlength - (optptr - options));
}
for (i = 0; i < attr->num_values; i ++)
{
if (i)
strlcat(optptr, ",", sizeof(options) - (optptr - options));
strlcat(optptr, ",", optlength - (optptr - options));
optptr += strlen(optptr);
@@ -1368,31 +1413,31 @@ StartJob(int id, /* I - Job ID */
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
snprintf(optptr, sizeof(options) - (optptr - options),
snprintf(optptr, optlength - (optptr - options),
"%d", attr->values[i].integer);
break;
case IPP_TAG_BOOLEAN :
if (!attr->values[i].boolean)
strlcat(optptr, "no", sizeof(options) - (optptr - options));
strlcat(optptr, "no", optlength - (optptr - options));
case IPP_TAG_NOVALUE :
strlcat(optptr, attr->name,
sizeof(options) - (optptr - options));
optlength - (optptr - options));
break;
case IPP_TAG_RANGE :
if (attr->values[i].range.lower == attr->values[i].range.upper)
snprintf(optptr, sizeof(options) - (optptr - options) - 1,
snprintf(optptr, optlength - (optptr - options) - 1,
"%d", attr->values[i].range.lower);
else
snprintf(optptr, sizeof(options) - (optptr - options) - 1,
snprintf(optptr, optlength - (optptr - options) - 1,
"%d-%d", attr->values[i].range.lower,
attr->values[i].range.upper);
break;
case IPP_TAG_RESOLUTION :
snprintf(optptr, sizeof(options) - (optptr - options) - 1,
snprintf(optptr, optlength - (optptr - options) - 1,
"%dx%d%s", attr->values[i].resolution.xres,
attr->values[i].resolution.yres,
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
@@ -1409,14 +1454,14 @@ StartJob(int id, /* I - Job ID */
strchr(attr->values[i].string.text, '\t') != NULL ||
strchr(attr->values[i].string.text, '\n') != NULL)
{
strlcat(optptr, "\'", sizeof(options) - (optptr - options));
strlcat(optptr, "\'", optlength - (optptr - options));
strlcat(optptr, attr->values[i].string.text,
sizeof(options) - (optptr - options));
strlcat(optptr, "\'", sizeof(options) - (optptr - options));
optlength - (optptr - options));
strlcat(optptr, "\'", optlength - (optptr - options));
}
else
strlcat(optptr, attr->values[i].string.text,
sizeof(options) - (optptr - options));
optlength - (optptr - options));
break;
default :
@@ -1872,10 +1917,9 @@ UpdateJob(job_t *job) /* I - Job to check */
job->bufused += bytes;
job->buffer[job->bufused] = '\0';
if (job->bufused == (JOB_BUFFER_SIZE - 1))
lineptr = job->buffer + JOB_BUFFER_SIZE - 1;
else
lineptr = strchr(job->buffer, '\n');
if ((lineptr = strchr(job->buffer, '\n')) == NULL &&
job->bufused == (JOB_BUFFER_SIZE - 1))
lineptr = job->buffer + job->bufused;
}
else if (bytes < 0 && errno == EINTR)
return;
+42 -7
Ver Arquivo
@@ -236,6 +236,10 @@ main(int argc, /* I - Number of command-line arguments */
tzset();
#ifdef LC_TIME
setlocale(LC_TIME, "");
#endif /* LC_TIME */
/*
* Set the maximum number of files...
*/
@@ -339,6 +343,18 @@ main(int argc, /* I - Number of command-line arguments */
if (!fg)
kill(getppid(), SIGUSR1);
/*
* If the administrator has configured the server to run as an unpriviledged
* user, change to that user now...
*/
if (RunAsUser)
{
setgid(Group);
setgroups(0, NULL);
setuid(User);
}
/*
* Loop forever...
*/
@@ -676,6 +692,7 @@ IgnoreChildSignals(void)
static void
sigchld_handler(int sig) /* I - Signal number */
{
int olderrno; /* Old errno value */
int status; /* Exit status of child */
int pid; /* Process ID of child */
job_t *job; /* Current job */
@@ -684,6 +701,12 @@ sigchld_handler(int sig) /* I - Signal number */
(void)sig;
/*
* Save the original error value (wait might overwrite it...)
*/
olderrno = errno;
#ifdef HAVE_WAITPID
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
#elif defined(HAVE_WAIT3)
@@ -694,13 +717,6 @@ sigchld_handler(int sig) /* I - Signal number */
{
DEBUG_printf(("sigchld_handler: pid = %d, status = %d\n", pid, status));
/*
* Delete certificates for CGI processes...
*/
if (pid)
DeleteCert(pid);
/*
* Ignore SIGTERM errors - that comes when a job is cancelled...
*/
@@ -719,6 +735,19 @@ sigchld_handler(int sig) /* I - Signal number */
if (LogLevel < L_DEBUG)
LogMessage(L_INFO, "Hint: Try setting the LogLevel to \"debug\" to find out more.");
}
else
LogMessage(L_DEBUG2, "PID %d exited with no errors.", pid);
/*
* Delete certificates for CGI processes...
*/
if (pid)
DeleteCert(pid);
/*
* Lookup the PID in the jobs list...
*/
for (job = Jobs; job != NULL; job = job->next)
if (job->state != NULL &&
@@ -756,6 +785,12 @@ sigchld_handler(int sig) /* I - Signal number */
}
}
/*
* Restore the original error value...
*/
errno = olderrno;
#ifdef HAVE_SIGSET
sigset(SIGCHLD, sigchld_handler);
#elif !defined(HAVE_SIGACTION)

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais