/*
* "$Id$"
*
- * File functions for CUPS.
+ * File functions for CUPS.
*
- * Since stdio files max out at 256 files on many systems, we have to
- * write similar functions without this limit. At the same time, using
- * our own file functions allows us to provide transparent support of
- * gzip'd print files, PPD files, etc.
+ * Since stdio files max out at 256 files on many systems, we have to
+ * write similar functions without this limit. At the same time, using
+ * our own file functions allows us to provide transparent support of
+ * gzip'd print files, PPD files, etc.
*
- * Copyright 2007-2012 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. 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
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * _cupsFileCheck() - Check the permissions of the given filename.
- * _cupsFileCheckFilter() - Report file check results as CUPS filter messages.
- * cupsFileClose() - Close a CUPS file.
- * cupsFileCompression() - Return whether a file is compressed.
- * cupsFileEOF() - Return the end-of-file status.
- * cupsFileFind() - Find a file using the specified path.
- * cupsFileFlush() - Flush pending output.
- * cupsFileGetChar() - Get a single character from a file.
- * cupsFileGetConf() - Get a line from a configuration file.
- * cupsFileGetLine() - Get a CR and/or LF-terminated line that may
- * contain binary data.
- * cupsFileGets() - Get a CR and/or LF-terminated line.
- * cupsFileLock() - Temporarily lock access to a file.
- * cupsFileNumber() - Return the file descriptor associated with a CUPS
- * file.
- * cupsFileOpen() - Open a CUPS file.
- * cupsFileOpenFd() - Open a CUPS file using a file descriptor.
- * cupsFilePeekChar() - Peek at the next character from a file.
- * cupsFilePrintf() - Write a formatted string.
- * cupsFilePutChar() - Write a character.
- * cupsFilePutConf() - Write a configuration line.
- * cupsFilePuts() - Write a string.
- * cupsFileRead() - Read from a file.
- * cupsFileRewind() - Set the current file position to the beginning of
- * the file.
- * cupsFileSeek() - Seek in a file.
- * cupsFileStderr() - Return a CUPS file associated with stderr.
- * cupsFileStdin() - Return a CUPS file associated with stdin.
- * cupsFileStdout() - Return a CUPS file associated with stdout.
- * cupsFileTell() - Return the current file position.
- * cupsFileUnlock() - Unlock access to a file.
- * cupsFileWrite() - Write to a file.
- * cups_compress() - Compress a buffer of data.
- * cups_fill() - Fill the input buffer.
- * cups_open() - Safely open a file for writing.
- * cups_read() - Read from a file descriptor.
- * cups_write() - Write to a file descriptor.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. 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
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*/
/*
}
else
{
- tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) |
- trailer[0];
+ tcrc = ((((((uLong)trailer[3] << 8) | (uLong)trailer[2]) << 8) |
+ (uLong)trailer[1]) << 8) | (uLong)trailer[0];
if (tcrc != fp->crc)
{
* Bad CRC, mark end-of-file...
*/
- DEBUG_printf(("9cups_fill: tcrc=%08x, fp->crc=%08x",
+ DEBUG_printf(("9cups_fill: tcrc=%08x != fp->crc=%08x",
(unsigned int)tcrc, (unsigned int)fp->crc));
fp->eof = 1;
if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
return (NULL); /* Invalid byte ranges! */
- cg->ip_addr = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) |
- ip[3]));
+ cg->ip_addr = htonl((((((((unsigned)ip[0] << 8) | (unsigned)ip[1]) << 8) |
+ (unsigned)ip[2]) << 8) |
+ (unsigned)ip[3]));
/*
* Fill in the host entry and return it...
if (!s || slen <= 1)
return (NULL);
-
+
if (gethostname(s, slen) < 0)
strlcpy(s, "localhost", slen);
/*
* "$Id$"
*
- * HTTP address list routines for CUPS.
+ * HTTP address list routines for CUPS.
*
- * Copyright 2007-2013 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. 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
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * httpAddrConnect() - Connect to any of the addresses in the list.
- * httpAddrConnect2() - Connect to any of the addresses in the list with a
- * timeout and optional cancel.
- * httpAddrCopyList() - Copy an address list.
- * httpAddrFreeList() - Free an address list.
- * httpAddrGetList() - Get a list of addresses for a hostname.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. 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
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*/
/*
return (NULL);
first->addr.ipv4.sin_family = AF_INET;
- first->addr.ipv4.sin_addr.s_addr = htonl(((((((ip[0] << 8) |
- ip[1]) << 8) |
- ip[2]) << 8) | ip[3]));
+ first->addr.ipv4.sin_addr.s_addr = htonl((((((((unsigned)ip[0] << 8) |
+ (unsigned)ip[1]) << 8) |
+ (unsigned)ip[2]) << 8) |
+ (unsigned)ip[3]));
first->addr.ipv4.sin_port = htons(portnum);
}
}
/*
* "$Id$"
*
- * Private MD5 implementation for CUPS.
+ * Private MD5 implementation for CUPS.
*
- * Copyright 2007-2010 by Apple Inc.
- * Copyright 2005 by Easy Software Products
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 2005 by Easy Software Products
+ * Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
*
- * Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
*
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event will the authors be held liable for any damages
- * arising from the use of this software.
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
*
- * Permission is granted to anyone to use this software for any purpose,
- * including commercial applications, and to alter it and redistribute it
- * freely, subject to the following restrictions:
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ * misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
*
- * 1. The origin of this software must not be misrepresented; you must not
- * claim that you wrote the original software. If you use this software
- * in a product, an acknowledgment in the product documentation would be
- * appreciated but is not required.
- * 2. Altered source versions must be plainly marked as such, and must not be
- * misrepresented as being the original software.
- * 3. This notice may not be removed or altered from any source distribution.
- *
- * L. Peter Deutsch
- * ghost@aladdin.com
+ * L. Peter Deutsch
+ * ghost@aladdin.com
*/
/*
Independent implementation of MD5 (RFC 1321).
int i;
for (i = 0; i < 16; ++i, xp += 4)
- X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ X[i] = (unsigned)xp[0] + ((unsigned)xp[1] << 8) +
+ ((unsigned)xp[2] << 16) + ((unsigned)xp[3] << 24);
#else /* !ARCH_IS_BIG_ENDIAN */
/*
* "$Id$"
*
- * Configuration routines for the CUPS scheduler.
+ * Configuration routines for the CUPS scheduler.
*
- * Copyright 2007-2013 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products, all rights reserved.
+ * Copyright 2007-2013 by Apple Inc.
+ * Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. 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
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- * cupsdAddAlias() - Add a host alias.
- * cupsdCheckPermissions() - Fix the mode and ownership of a file or
- * directory.
- * cupsdDefaultAuthType() - Get the default AuthType.
- * cupsdFreeAliases() - Free all of the alias entries.
- * cupsdReadConfiguration() - Read the cupsd.conf file.
- * get_address() - Get an address + port number from a line.
- * get_addr_and_mask() - Get an IP address and netmask.
- * mime_error_cb() - Log a MIME error.
- * parse_aaa() - Parse authentication, authorization, and access
- * control lines.
- * parse_fatal_errors() - Parse FatalErrors values in a string.
- * parse_groups() - Parse system group names in a string.
- * parse_protocols() - Parse browse protocols in a string.
- * parse_variable() - Parse a variable line.
- * read_cupsd_conf() - Read the cupsd.conf configuration file.
- * read_cups_files_conf() - Read the cups-files.conf configuration file.
- * read_location() - Read a <Location path> definition.
- * read_policy() - Read a <Policy name> definition.
- * set_policy_defaults() - Set default policy values as needed.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. 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
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*/
/*
* Merge everything into a 32-bit IPv4 address in ip[3]...
*/
- ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+ ip[3] = ((((((unsigned)val[0] << 8) | (unsigned)val[1]) << 8) |
+ (unsigned)val[2]) << 8) | (unsigned)val[3];
if (ipcount < 4)
mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
* Merge everything into a 32-bit IPv4 address in ip[3]...
*/
- ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+ ip[3] = ((((((unsigned)val[0] << 8) | (unsigned)val[1]) << 8) |
+ (unsigned)val[2]) << 8) | (unsigned)val[3];
if (ipcount < 4)
mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
mask + 3) != 4)
return (0);
- mask[3] |= ((((mask[0] << 8) | mask[1]) << 8) | mask[2]) << 8;
+ mask[3] |= (((((unsigned)mask[0] << 8) | (unsigned)mask[1]) << 8) |
+ (unsigned)mask[2]) << 8;
mask[0] = mask[1] = mask[2] = 0;
}
else