patches/thunderbird3-37-ots-makepair.diff
branchgnome-2-30
changeset 21145 da75e4637c4a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/thunderbird3-37-ots-makepair.diff	Fri Dec 10 04:48:00 2010 +0000
@@ -0,0 +1,152 @@
+diff --git a/gfx/ots/src/cff.cc b/gfx/ots/src/cff.cc
+--- a/gfx/ots/src/cff.cc
++++ b/gfx/ots/src/cff.cc
+@@ -182,23 +182,23 @@ bool ParseDictDataBcd(
+   while (true) {
+     if (!table->ReadU8(&nibble)) {
+       return OTS_FAILURE();
+     }
+     if ((nibble & 0xf0) == 0xf0) {
+       if ((nibble & 0xf) == 0xf) {
+         // TODO(yusukes): would be better to store actual double value,
+         // rather than the dummy integer.
+-        operands->push_back(std::make_pair(0, DICT_OPERAND_REAL));
++        operands->push_back(std::make_pair((unsigned)0, DICT_OPERAND_REAL));
+         return true;
+       }
+       return OTS_FAILURE();
+     }
+     if ((nibble & 0x0f) == 0x0f) {
+-      operands->push_back(std::make_pair(0, DICT_OPERAND_REAL));
++      operands->push_back(std::make_pair((unsigned)0, DICT_OPERAND_REAL));
+       return true;
+     }
+ 
+     // check number format
+     uint8_t nibbles[2];
+     nibbles[0] = (nibble & 0xf0) >> 8;
+     nibbles[1] = (nibble & 0x0f);
+     for (unsigned i = 0; i < 2; ++i) {
+@@ -257,28 +257,28 @@ bool ParseDictDataNumber(
+   uint8_t b4 = 0;
+ 
+   switch (b0) {
+     case 28:  // shortint
+       if (!table->ReadU8(&b1) ||
+           !table->ReadU8(&b2)) {
+         return OTS_FAILURE();
+       }
+-      operands->push_back(std::make_pair((b1 << 8) + b2, DICT_OPERAND_INTEGER));
++      operands->push_back(std::make_pair((unsigned)((b1 << 8) + b2), DICT_OPERAND_INTEGER));
+       return true;
+ 
+     case 29:  // longint
+       if (!table->ReadU8(&b1) ||
+           !table->ReadU8(&b2) ||
+           !table->ReadU8(&b3) ||
+           !table->ReadU8(&b4)) {
+         return OTS_FAILURE();
+       }
+-      operands->push_back(std::make_pair(
+-          (b1 << 24) + (b2 << 16) + (b3 << 8) + b4, DICT_OPERAND_INTEGER));
++      operands->push_back(std::make_pair((unsigned)
++          ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4), DICT_OPERAND_INTEGER));
+       return true;
+ 
+     case 30:  // binary coded decimal
+       return ParseDictDataBcd(table, operands);
+ 
+     default:
+       break;
+   }
+@@ -310,17 +310,17 @@ bool ParseDictDataReadNext(
+   uint8_t op = 0;
+   if (!table->ReadU8(&op)) {
+     return OTS_FAILURE();
+   }
+   if (op <= 21) {
+     if (op == 12) {
+       return ParseDictDataEscapedOperator(table, operands);
+     }
+-    operands->push_back(std::make_pair(op, DICT_OPERATOR));
++    operands->push_back(std::make_pair((unsigned)op, DICT_OPERATOR));
+     return true;
+   } else if (op <= 27 || op == 31 || op == 255) {
+     // reserved area.
+     return OTS_FAILURE();
+   }
+ 
+   return ParseDictDataNumber(table, op, operands);
+ }
+diff --git a/gfx/ots/src/cmap.cc b/gfx/ots/src/cmap.cc
+--- a/gfx/ots/src/cmap.cc
++++ b/gfx/ots/src/cmap.cc
+@@ -643,19 +643,19 @@ bool ots_cmap_parse(OpenTypeFile *file, 
+ 
+     if (!uniq_checker.insert(std::make_pair(subtable_headers[i].offset,
+                                             end_byte)).second) {
+       // Sometimes Unicode table and MS table share exactly the same data.
+       // We'll allow this.
+       continue;
+     }
+     overlap_checker.push_back(
+-        std::make_pair(subtable_headers[i].offset, 1 /* start */));
++        std::make_pair(subtable_headers[i].offset, (uint8_t)1 /* start */));
+     overlap_checker.push_back(
+-        std::make_pair(end_byte, 0 /* end */));
++        std::make_pair(end_byte, (uint8_t)0 /* end */));
+   }
+   std::sort(overlap_checker.begin(), overlap_checker.end());
+   int overlap_count = 0;
+   for (unsigned i = 0; i < overlap_checker.size(); ++i) {
+     overlap_count += (overlap_checker[i].second ? 1 : -1);
+     if (overlap_count > 1) {
+       return OTS_FAILURE();
+     }
+diff --git a/gfx/ots/src/glyf.cc b/gfx/ots/src/glyf.cc
+--- a/gfx/ots/src/glyf.cc
++++ b/gfx/ots/src/glyf.cc
+@@ -112,17 +112,17 @@ bool ParseSimpleGlyph(ots::OpenTypeFile 
+   if (ots::g_transcode_hints) {
+     glyf->iov.push_back(std::make_pair(
+         data + gly_offset, gly_header_length + bytecode_length));
+   } else {
+     // enqueue two vectors: the glyph data up to the bytecode length, then
+     // a pointer to a static uint16_t 0 to overwrite the length.
+     glyf->iov.push_back(std::make_pair(
+         data + gly_offset, gly_header_length - 2));
+-    glyf->iov.push_back(std::make_pair((const uint8_t*) "\x00\x00", 2));
++    glyf->iov.push_back(std::make_pair((const uint8_t*) "\x00\x00", (unsigned)2));
+   }
+ 
+   if (!table->Skip(bytecode_length)) {
+     return OTS_FAILURE();
+   }
+ 
+   uint32_t flags_count_physical = 0;  // on memory
+   uint32_t xy_coordinates_length = 0;
+diff --git a/gfx/ots/src/ots.cc b/gfx/ots/src/ots.cc
+--- a/gfx/ots/src/ots.cc
++++ b/gfx/ots/src/ots.cc
+@@ -389,19 +389,19 @@ bool ProcessGeneric(ots::OpenTypeFile *h
+   for (unsigned i = 0; i < header->num_tables; ++i) {
+     table_map[tables[i].tag] = tables[i];
+   }
+ 
+   // check that the tables are not overlapping.
+   std::vector<std::pair<uint32_t, uint8_t> > overlap_checker;
+   for (unsigned i = 0; i < header->num_tables; ++i) {
+     overlap_checker.push_back(
+-        std::make_pair(tables[i].offset, 1 /* start */));
++        std::make_pair(tables[i].offset, (uint8_t)1 /* start */));
+     overlap_checker.push_back(
+-        std::make_pair(tables[i].offset + tables[i].length, 0 /* end */));
++        std::make_pair(tables[i].offset + tables[i].length, (uint8_t)0 /* end */));
+   }
+   std::sort(overlap_checker.begin(), overlap_checker.end());
+   int overlap_count = 0;
+   for (unsigned i = 0; i < overlap_checker.size(); ++i) {
+     overlap_count += (overlap_checker[i].second ? 1 : -1);
+     if (overlap_count > 1) {
+       return OTS_FAILURE();
+     }