Bug 1330495 - Unbreak FreeBSD build after bug 1324739. r?jfkthame draft
authorJan Beich <jbeich@FreeBSD.org>
Thu, 12 Jan 2017 03:19:33 +0000
changeset 459670 635f314ff06d53d392264e701ede8fe61b38cafc
parent 459611 97d6f73643940256c0eb61e384c49bf6f6c49847
child 541969 4424a2a0fbe580c6e3ee0da2c53e07fb8c37a814
push id41300
push userbmo:jbeich@FreeBSD.org
push dateThu, 12 Jan 2017 13:15:12 +0000
reviewersjfkthame
bugs1330495, 1324739
milestone53.0a1
Bug 1330495 - Unbreak FreeBSD build after bug 1324739. r?jfkthame MozReview-Commit-ID: 5UmQVREYMRq
gfx/sfntly/cpp/src/sample/subtly/utils.cc
gfx/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
gfx/sfntly/cpp/src/test/autogenerated/cmap_basic_test.cc
gfx/sfntly/cpp/src/test/cmap_editing_test.cc
gfx/sfntly/cpp/src/test/cmap_iterator_test.cc
gfx/sfntly/cpp/src/test/cmap_test.cc
gfx/sfntly/cpp/src/test/test_font_utils.cc
--- a/gfx/sfntly/cpp/src/sample/subtly/utils.cc
+++ b/gfx/sfntly/cpp/src/sample/subtly/utils.cc
@@ -74,17 +74,17 @@ bool SerializeFont(const char* font_path
   factory->SerializeFont(font, &output_stream);
   // Serializing the stream to a file.
   FILE* output_file = NULL;
 #if defined WIN32
   fopen_s(&output_file, font_path, "wb");
 #else
   output_file = fopen(font_path, "wb");
 #endif
-  if (output_file == reinterpret_cast<FILE*>(NULL))
+  if (output_file == static_cast<FILE*>(NULL))
     return false;
   for (size_t i = 0; i < output_stream.Size(); ++i) {
     fwrite(&(output_stream.Get()[i]), 1, 1, output_file);
   }
   fflush(output_file);
   fclose(output_file);
   return true;
 }
--- a/gfx/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
+++ b/gfx/sfntly/cpp/src/sfntly/table/core/cmap_table.cc
@@ -434,17 +434,17 @@ CMapTable::CMapFormat0::Builder::Builder
     ReadableFontData* data,
     int32_t offset,
     const CMapId& cmap_id)
     : CMapTable::CMap::Builder(data, CMapFormat::kFormat0, cmap_id) {
   UNREFERENCED_PARAMETER(offset);
 }
 
 CMapTable::CMapFormat0::Builder::Builder(const CMapId& cmap_id)
-    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+    : CMap::Builder(static_cast<ReadableFontData*>(NULL),
                     CMapFormat::kFormat0,
                     cmap_id) {
 }
 
 CMapTable::CMapFormat0::Builder::~Builder() {
 }
 
 CALLER_ATTACH FontDataTable*
@@ -558,28 +558,28 @@ CMapTable::CMap::CharacterIterator* CMap
  * CMapTable::CMapFormat2::Builder
  ******************************************************************************/
 CMapTable::CMapFormat2::Builder::Builder(WritableFontData* data,
                                          int32_t offset,
                                          const CMapId& cmap_id)
     : CMapTable::CMap::Builder(data ? down_cast<WritableFontData*>(
                                    data->Slice(offset, data->ReadUShort(
                                        offset + Offset::kFormat0Length)))
-                               : reinterpret_cast<WritableFontData*>(NULL),
+                               : static_cast<WritableFontData*>(NULL),
                                CMapFormat::kFormat2, cmap_id) {
   // TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix.
 }
 
 CMapTable::CMapFormat2::Builder::Builder(ReadableFontData* data,
                                          int32_t offset,
                                          const CMapId& cmap_id)
     : CMapTable::CMap::Builder(data ? down_cast<ReadableFontData*>(
                                    data->Slice(offset, data->ReadUShort(
                                        offset + Offset::kFormat0Length)))
-                               : reinterpret_cast<ReadableFontData*>(NULL),
+                               : static_cast<ReadableFontData*>(NULL),
                                CMapFormat::kFormat2, cmap_id) {
   // TODO(arthurhsu): FIXIT: heavy lifting and leak, need fix.
 }
 
 CMapTable::CMapFormat2::Builder::~Builder() {
 }
 
 CALLER_ATTACH FontDataTable*
@@ -953,25 +953,25 @@ CMapTable::CMapFormat4::Builder::Builder
                                          const CMapId& cmap_id)
     : CMap::Builder(data, CMapFormat::kFormat4, cmap_id) {
   UNREFERENCED_PARAMETER(offset);
 }
 
 CMapTable::CMapFormat4::Builder::Builder(SegmentList* segments,
                                          IntegerList* glyph_id_array,
                                          const CMapId& cmap_id)
-    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+    : CMap::Builder(static_cast<ReadableFontData*>(NULL),
                     CMapFormat::kFormat4, cmap_id),
       segments_(segments->begin(), segments->end()),
       glyph_id_array_(glyph_id_array->begin(), glyph_id_array->end()) {
   set_model_changed();
 }
 
 CMapTable::CMapFormat4::Builder::Builder(const CMapId& cmap_id)
-    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
+    : CMap::Builder(static_cast<ReadableFontData*>(NULL),
                     CMapFormat::kFormat4, cmap_id) {
 }
 
 CMapTable::CMapFormat4::Builder::~Builder() {}
 
 void CMapTable::CMapFormat4::Builder::Initialize(ReadableFontData* data) {
   if (data == NULL || data->Length() == 0)
     return;
--- a/gfx/sfntly/cpp/src/test/autogenerated/cmap_basic_test.cc
+++ b/gfx/sfntly/cpp/src/test/autogenerated/cmap_basic_test.cc
@@ -62,35 +62,35 @@ void CMapBasicTests::SetUp() {
   std::string font_name = "../../";
 #if defined (WIN32)
   font_name += "../";
 #endif
   font_name += std::string(GetParam());
   LoadFont(font_name.c_str(), font_factory, &font_array);
   ASSERT_FALSE(font_array.empty());
   Ptr<Font> font = font_array.at(0);
-  ASSERT_NE(font, reinterpret_cast<Font*>(NULL));
+  ASSERT_NE(font, static_cast<Font*>(NULL));
   cmap_table_ = down_cast<CMapTable*>(font->GetTable(Tag::cmap));
   if (!cmap_table_)
     fprintf(stderr, "No CMap: %s\n", font_name.c_str());
-  ASSERT_NE(cmap_table_, reinterpret_cast<CMapTable*>(NULL));
+  ASSERT_NE(cmap_table_, static_cast<CMapTable*>(NULL));
 
   // Loading the XML file
   document_ = TiXmlDocument((font_name + ".xml").c_str());
   ASSERT_TRUE(document_.LoadFile());
 }
 
 TEST_P(CMapBasicTests, BasicTest) {
   TiXmlNodeVector* cmap_table = GetNodesWithName(&document_, "cmap_table");
   // A font can only have one CMap table
   ASSERT_EQ(cmap_table->size(), (size_t)1);
   TiXmlNodeVector* cmaps = GetNodesWithName(cmap_table->at(0), "cmap");
   const TiXmlAttribute* num_cmaps_attr = GetAttribute(cmap_table->at(0),
                                                       "num_cmaps");
-  ASSERT_NE(num_cmaps_attr, reinterpret_cast<TiXmlAttribute*>(NULL));
+  ASSERT_NE(num_cmaps_attr, static_cast<TiXmlAttribute*>(NULL));
   // But there may be more than one CMap in this table
   ASSERT_LE(cmaps->size(), (size_t)num_cmaps_attr->IntValue());
   for (TiXmlNodeVector::iterator it = cmaps->begin();
        it != cmaps->end(); ++it) {
     int32_t platform_id = GetAttribute(*it, "platform_id")->IntValue();
     int32_t encoding_id = GetAttribute(*it, "encoding_id")->IntValue();
     Ptr<CMapTable::CMap> cmap;
     cmap.Attach(cmap_table_->GetCMap(platform_id, encoding_id));
--- a/gfx/sfntly/cpp/src/test/cmap_editing_test.cc
+++ b/gfx/sfntly/cpp/src/test/cmap_editing_test.cc
@@ -36,17 +36,17 @@ TEST(CMapEditingTest, RemoveAllButOneCMa
   FontBuilderArray builders;
   FontFactoryPtr font_factory;
   font_factory.Attach(FontFactory::GetInstance());
   BuilderForFontFile(SAMPLE_TTF_FILE, font_factory, &builders);
   ASSERT_FALSE(builders.empty());
   FontBuilderPtr font_builder = builders[0];
   Ptr<CMapTable::Builder> cmap_table_builder =
       (CMapTable::Builder*)font_builder->GetTableBuilder(Tag::cmap);
-  ASSERT_NE(cmap_table_builder, reinterpret_cast<CMapTable::Builder*>(NULL));
+  ASSERT_NE(cmap_table_builder, static_cast<CMapTable::Builder*>(NULL));
   CMapTable::CMapBuilderMap*
       cmap_builders = cmap_table_builder->GetCMapBuilders();
   ASSERT_FALSE(cmap_builders->empty());
 
   for (CMapTable::CMapBuilderMap::iterator
            it = cmap_builders->begin(); it != cmap_builders->end();) {
     if (it->second->cmap_id() == CMapTable::WINDOWS_BMP) {
       ++it;
@@ -90,12 +90,12 @@ TEST(CMapEditingTest, CopyAllCMapsToNewF
 
   FontPtr new_font;
   new_font.Attach(font_builder->Build());
   CMapTablePtr new_cmap_table =
       down_cast<CMapTable*>(font->GetTable(Tag::cmap));
   ASSERT_EQ(cmap_table->NumCMaps(), new_cmap_table->NumCMaps());
   CMapTable::CMapPtr cmap;
   cmap.Attach(cmap_table->GetCMap(CMapTable::WINDOWS_BMP));
-  ASSERT_NE(cmap, reinterpret_cast<CMapTable::CMap*>(NULL));
+  ASSERT_NE(cmap, static_cast<CMapTable::CMap*>(NULL));
   ASSERT_EQ(CMapTable::WINDOWS_BMP, cmap->cmap_id());
 }
 }
--- a/gfx/sfntly/cpp/src/test/cmap_iterator_test.cc
+++ b/gfx/sfntly/cpp/src/test/cmap_iterator_test.cc
@@ -127,17 +127,17 @@ CompareCMapIterAndBitSet(CMapTable::CMap
   return iterator_not_bitset_count;
 }
 
 TEST_P(CMapIteratorTests, IteratorTest) {
   BitSet* bit_set = GenerateCMapEntries(0, 0x10ffff);
   CMapTable::CMap::CharacterIterator* character_iterator = NULL;
   character_iterator = cmap_->Iterator();
   EXPECT_NE(character_iterator,
-            reinterpret_cast<CMapTable::CMap::CharacterIterator*>(NULL));
+            static_cast<CMapTable::CMap::CharacterIterator*>(NULL));
   CompareCMapIterAndBitSet(character_iterator, bit_set);
   delete character_iterator;
   delete bit_set;
 }
 
 CMapIteratorTestCase kCMapIteratorTestsTestCases[] = {
   CMapIteratorTestCase(CMapTable::WINDOWS_BMP.platform_id,
                        CMapTable::WINDOWS_BMP.encoding_id,
--- a/gfx/sfntly/cpp/src/test/cmap_test.cc
+++ b/gfx/sfntly/cpp/src/test/cmap_test.cc
@@ -110,29 +110,29 @@ class CMapTests : public :: testing::Tes
             << test_case->second_platform_id() << ", "
             << test_case->second_encoding_id() << ", "
             << test_case->second_charset_name() << ", "
             << test_case->low_char() << ", "
             << test_case->high_char() << ")";
 }
 
 void CMapTests::CommonSetUp(FontArray* font_array) {
-  ASSERT_NE(font_array, reinterpret_cast<FontArray*>(NULL));
+  ASSERT_NE(font_array, static_cast<FontArray*>(NULL));
   ASSERT_FALSE(font_array->empty());
   Ptr<Font> font;
   font = font_array->at(0);
-  ASSERT_NE(font, reinterpret_cast<Font*>(NULL));
+  ASSERT_NE(font, static_cast<Font*>(NULL));
   Ptr<CMapTable> cmap_table =
       down_cast<CMapTable*>(font->GetTable(Tag::cmap));
   cmap1_.Attach(cmap_table->GetCMap(GetParam().first_platform_id(),
                                     GetParam().first_encoding_id()));
-  ASSERT_NE((cmap1_), reinterpret_cast<CMapTable::CMap*>(NULL));
+  ASSERT_NE((cmap1_), static_cast<CMapTable::CMap*>(NULL));
   cmap2_.Attach(cmap_table->GetCMap(GetParam().second_platform_id(),
                                     GetParam().second_encoding_id()));
-  ASSERT_NE((cmap2_), reinterpret_cast<CMapTable::CMap*>(NULL));
+  ASSERT_NE((cmap2_), static_cast<CMapTable::CMap*>(NULL));
   encoder1_ = TestUtils::GetEncoder(GetParam().first_charset_name());
   encoder2_ = TestUtils::GetEncoder(GetParam().second_charset_name());
   successful_setup_ = true;
 }
 
 void CMapTests::TearDown() {
   if (encoder1_)
     ucnv_close(encoder1_);
--- a/gfx/sfntly/cpp/src/test/test_font_utils.cc
+++ b/gfx/sfntly/cpp/src/test/test_font_utils.cc
@@ -65,17 +65,17 @@ void LoadFile(const char* input_file_pat
   assert(input_buffer);
 
   FILE* input_file = NULL;
 #if defined WIN32
   fopen_s(&input_file, input_file_path, "rb");
 #else
   input_file = fopen(input_file_path, "rb");
 #endif
-  EXPECT_NE(input_file, reinterpret_cast<FILE*>(NULL));
+  EXPECT_NE(input_file, static_cast<FILE*>(NULL));
   fseek(input_file, 0, SEEK_END);
   size_t file_size = ftell(input_file);
   fseek(input_file, 0, SEEK_SET);
   input_buffer->resize(file_size);
   size_t bytes_read = fread(&((*input_buffer)[0]), 1, file_size, input_file);
   EXPECT_EQ(bytes_read, file_size);
   fclose(input_file);
 }
@@ -85,17 +85,17 @@ void SerializeToFile(MemoryOutputStream*
   assert(output_stream);
 
   FILE* output_file = NULL;
 #if defined WIN32
   fopen_s(&output_file, file_path, "wb");
 #else
   output_file = fopen(file_path, "wb");
 #endif
-  EXPECT_NE(output_file, reinterpret_cast<FILE*>(NULL));
+  EXPECT_NE(output_file, static_cast<FILE*>(NULL));
   fwrite(output_stream->Get(), 1, output_stream->Size(), output_file);
   fflush(output_file);
   fclose(output_file);
 }
 
 void HexDump(const unsigned char* byte_data, size_t length) {
   if (byte_data == NULL || length == 0) {
     fprintf(stderr, "<NULL>\n");