//
// "$Id$"
//
-// Shared message catalog class for the CUPS PPD Compiler.
+// Shared message catalog class for the CUPS PPD Compiler.
//
-// Copyright 2007-2012 by Apple Inc.
-// Copyright 2002-2006 by Easy Software Products.
+// Copyright 2007-2014 by Apple Inc.
+// Copyright 2002-2006 by Easy Software Products.
//
-// 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:
-//
-// ppdcCatalog::ppdcCatalog() - Create a shared message catalog.
-// ppdcCatalog::~ppdcCatalog() - Destroy a shared message catalog.
-// ppdcCatalog::add_message() - Add a new message.
-// ppdcCatalog::find_message() - Find a message in a catalog...
-// ppdcCatalog::load_messages() - Load messages from a .po file.
-// ppdcCatalog::save_messages() - Save the messages to a .po file.
-// get_utf8() - Get a UTF-8 character.
-// get_utf16() - Get a UTF-16 character...
-// put_utf8() - Add a UTF-8 character to a string.
-// put_utf16() - Write a UTF-16 character to a file.
+// 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/".
//
//
if (ptr >= end)
return (-1);
- *ptr++ = ch;
+ *ptr++ = (char)ch;
}
else if (ch < 0x800)
{
if ((ptr + 1) >= end)
return (-1);
- *ptr++ = 0xc0 | (ch >> 6);
- *ptr++ = 0x80 | (ch & 0x3f);
+ *ptr++ = (char)(0xc0 | (ch >> 6));
+ *ptr++ = (char)(0x80 | (ch & 0x3f));
}
else if (ch < 0x10000)
{
if ((ptr + 2) >= end)
return (-1);
- *ptr++ = 0xe0 | (ch >> 12);
- *ptr++ = 0x80 | ((ch >> 6) & 0x3f);
- *ptr++ = 0x80 | (ch & 0x3f);
+ *ptr++ = (char)(0xe0 | (ch >> 12));
+ *ptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
+ *ptr++ = (char)(0x80 | (ch & 0x3f));
}
else
{
if ((ptr + 3) >= end)
return (-1);
- *ptr++ = 0xf0 | (ch >> 18);
- *ptr++ = 0x80 | ((ch >> 12) & 0x3f);
- *ptr++ = 0x80 | ((ch >> 6) & 0x3f);
- *ptr++ = 0x80 | (ch & 0x3f);
+ *ptr++ = (char)(0xf0 | (ch >> 18));
+ *ptr++ = (char)(0x80 | ((ch >> 12) & 0x3f));
+ *ptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
+ *ptr++ = (char)(0x80 | (ch & 0x3f));
}
return (0);
if (ch < 0x10000)
{
// One-word UTF-16 big-endian...
- buffer[0] = ch >> 8;
- buffer[1] = ch;
+ buffer[0] = (unsigned char)(ch >> 8);
+ buffer[1] = (unsigned char)ch;
if (cupsFileWrite(fp, (char *)buffer, 2) == 2)
return (0);
// Two-word UTF-16 big-endian...
ch -= 0x10000;
- buffer[0] = 0xd8 | (ch >> 18);
- buffer[1] = ch >> 10;
- buffer[2] = 0xdc | ((ch >> 8) & 0x03);
- buffer[3] = ch;
+ buffer[0] = (unsigned char)(0xd8 | (ch >> 18));
+ buffer[1] = (unsigned char)(ch >> 10);
+ buffer[2] = (unsigned char)(0xdc | ((ch >> 8) & 0x03));
+ buffer[3] = (unsigned char)ch;
if (cupsFileWrite(fp, (char *)buffer, 4) == 4)
return (0);