You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/01/04 18:03:51 UTC

[arrow] branch master updated: ARROW-4122: [C++] Initialize class members based on codebase static analysis

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new cc9e228  ARROW-4122: [C++] Initialize class members based on codebase static analysis
cc9e228 is described below

commit cc9e228dd4a9b3403d52de07f134603a824b3354
Author: minmin.fmm <mi...@alipay.com>
AuthorDate: Fri Jan 4 12:03:44 2019 -0600

    ARROW-4122: [C++] Initialize class members based on codebase static analysis
    
    Author: minmin.fmm <mi...@alipay.com>
    
    Closes #3267 from micafan/fix_cpp_uninit_ctor and squashes the following commits:
    
    71a86c5e3 <minmin.fmm> fix lint error
    270a992c5 <minmin.fmm> fix cpp uninit ctor
---
 cpp/src/arrow/array/builder_dict.cc     | 3 ++-
 cpp/src/arrow/io/compressed.cc          | 2 +-
 cpp/src/arrow/io/hdfs.cc                | 2 +-
 cpp/src/arrow/ipc/feather-internal.h    | 2 +-
 cpp/src/arrow/ipc/feather.cc            | 1 +
 cpp/src/arrow/ipc/reader.cc             | 4 +++-
 cpp/src/arrow/python/arrow_to_pandas.cc | 5 ++++-
 cpp/src/arrow/util/bit-stream-utils.h   | 7 ++++++-
 cpp/src/arrow/util/compression_zlib.cc  | 2 +-
 cpp/src/plasma/client.cc                | 2 +-
 10 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/cpp/src/arrow/array/builder_dict.cc b/cpp/src/arrow/array/builder_dict.cc
index e534c3c..8993959 100644
--- a/cpp/src/arrow/array/builder_dict.cc
+++ b/cpp/src/arrow/array/builder_dict.cc
@@ -161,7 +161,7 @@ DictionaryBuilder<T>::~DictionaryBuilder() {}
 template <typename T>
 DictionaryBuilder<T>::DictionaryBuilder(const std::shared_ptr<DataType>& type,
                                         MemoryPool* pool)
-    : ArrayBuilder(type, pool), byte_width_(-1), values_builder_(pool) {
+    : ArrayBuilder(type, pool), delta_offset_(0), byte_width_(-1), values_builder_(pool) {
   DCHECK_EQ(T::type_id, type->id()) << "inconsistent type passed to DictionaryBuilder";
 }
 
@@ -175,6 +175,7 @@ template <>
 DictionaryBuilder<FixedSizeBinaryType>::DictionaryBuilder(
     const std::shared_ptr<DataType>& type, MemoryPool* pool)
     : ArrayBuilder(type, pool),
+      delta_offset_(0),
       byte_width_(checked_cast<const FixedSizeBinaryType&>(*type).byte_width()) {}
 
 template <typename T>
diff --git a/cpp/src/arrow/io/compressed.cc b/cpp/src/arrow/io/compressed.cc
index e5fd6b4..1311dbc 100644
--- a/cpp/src/arrow/io/compressed.cc
+++ b/cpp/src/arrow/io/compressed.cc
@@ -44,7 +44,7 @@ namespace io {
 class CompressedOutputStream::Impl {
  public:
   Impl(MemoryPool* pool, Codec* codec, const std::shared_ptr<OutputStream>& raw)
-      : pool_(pool), raw_(raw), codec_(codec), is_open_(true) {}
+      : pool_(pool), raw_(raw), codec_(codec), is_open_(true), compressed_pos_(0) {}
 
   ~Impl() { DCHECK(Close().ok()); }
 
diff --git a/cpp/src/arrow/io/hdfs.cc b/cpp/src/arrow/io/hdfs.cc
index 3e9b804..0a50d3d 100644
--- a/cpp/src/arrow/io/hdfs.cc
+++ b/cpp/src/arrow/io/hdfs.cc
@@ -336,7 +336,7 @@ static void SetPathInfo(const hdfsFileInfo* input, HdfsPathInfo* out) {
 // Private implementation
 class HadoopFileSystem::HadoopFileSystemImpl {
  public:
-  HadoopFileSystemImpl() {}
+  HadoopFileSystemImpl() : driver_(NULLPTR), port_(0), fs_(NULLPTR) {}
 
   Status Connect(const HdfsConnectionConfig* config) {
     if (config->driver == HdfsDriver::LIBHDFS3) {
diff --git a/cpp/src/arrow/ipc/feather-internal.h b/cpp/src/arrow/ipc/feather-internal.h
index 90512dd..2aa04b2 100644
--- a/cpp/src/arrow/ipc/feather-internal.h
+++ b/cpp/src/arrow/ipc/feather-internal.h
@@ -119,7 +119,7 @@ class ARROW_EXPORT TableBuilder {
 
 class ARROW_EXPORT TableMetadata {
  public:
-  TableMetadata() {}
+  TableMetadata() : table_(NULLPTR) {}
   ~TableMetadata() = default;
 
   Status Open(const std::shared_ptr<Buffer>& buffer) {
diff --git a/cpp/src/arrow/ipc/feather.cc b/cpp/src/arrow/ipc/feather.cc
index b0ab62c..d28bf75 100644
--- a/cpp/src/arrow/ipc/feather.cc
+++ b/cpp/src/arrow/ipc/feather.cc
@@ -180,6 +180,7 @@ ColumnBuilder::ColumnBuilder(TableBuilder* parent, const std::string& name)
   fbb_ = &parent->fbb();
   name_ = name;
   type_ = ColumnType::PRIMITIVE;
+  meta_time_.unit = TimeUnit::SECOND;
 }
 
 flatbuffers::Offset<void> ColumnBuilder::CreateColumnMetadata() {
diff --git a/cpp/src/arrow/ipc/reader.cc b/cpp/src/arrow/ipc/reader.cc
index b2c2676..59a322a 100644
--- a/cpp/src/arrow/ipc/reader.cc
+++ b/cpp/src/arrow/ipc/reader.cc
@@ -499,7 +499,9 @@ Status RecordBatchStreamReader::ReadNext(std::shared_ptr<RecordBatch>* batch) {
 
 class RecordBatchFileReader::RecordBatchFileReaderImpl {
  public:
-  RecordBatchFileReaderImpl() { dictionary_memo_ = std::make_shared<DictionaryMemo>(); }
+  RecordBatchFileReaderImpl() : file_(NULLPTR), footer_offset_(0), footer_(NULLPTR) {
+    dictionary_memo_ = std::make_shared<DictionaryMemo>();
+  }
 
   Status ReadFooter() {
     int magic_size = static_cast<int>(strlen(kArrowMagicBytes));
diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc b/cpp/src/arrow/python/arrow_to_pandas.cc
index b532bfb..8aa0bf7 100644
--- a/cpp/src/arrow/python/arrow_to_pandas.cc
+++ b/cpp/src/arrow/python/arrow_to_pandas.cc
@@ -1064,7 +1064,10 @@ class CategoricalBlock : public PandasBlock {
  public:
   explicit CategoricalBlock(const PandasOptions& options, MemoryPool* pool,
                             int64_t num_rows)
-      : PandasBlock(options, num_rows, 1), pool_(pool), needs_copy_(false) {}
+      : PandasBlock(options, num_rows, 1),
+        pool_(pool),
+        ordered_(false),
+        needs_copy_(false) {}
 
   Status Allocate() override {
     return Status::NotImplemented(
diff --git a/cpp/src/arrow/util/bit-stream-utils.h b/cpp/src/arrow/util/bit-stream-utils.h
index ff215e4..ae62a7f 100644
--- a/cpp/src/arrow/util/bit-stream-utils.h
+++ b/cpp/src/arrow/util/bit-stream-utils.h
@@ -110,7 +110,12 @@ class BitReader {
     memcpy(&buffered_values_, buffer_ + byte_offset_, num_bytes);
   }
 
-  BitReader() : buffer_(NULL), max_bytes_(0) {}
+  BitReader()
+      : buffer_(NULL),
+        max_bytes_(0),
+        buffered_values_(0),
+        byte_offset_(0),
+        bit_offset_(0) {}
 
   void Reset(const uint8_t* buffer, int buffer_len) {
     buffer_ = buffer;
diff --git a/cpp/src/arrow/util/compression_zlib.cc b/cpp/src/arrow/util/compression_zlib.cc
index dfda317..736b0ab 100644
--- a/cpp/src/arrow/util/compression_zlib.cc
+++ b/cpp/src/arrow/util/compression_zlib.cc
@@ -85,7 +85,7 @@ static Status ZlibErrorPrefix(const char* prefix_msg, const char* msg) {
 
 class GZipDecompressor : public Decompressor {
  public:
-  GZipDecompressor() : initialized_(false) {}
+  GZipDecompressor() : initialized_(false), finished_(false) {}
 
   ~GZipDecompressor() override {
     if (initialized_) {
diff --git a/cpp/src/plasma/client.cc b/cpp/src/plasma/client.cc
index 8d15358..f08d6ef 100644
--- a/cpp/src/plasma/client.cc
+++ b/cpp/src/plasma/client.cc
@@ -261,7 +261,7 @@ class PlasmaClient::Impl : public std::enable_shared_from_this<PlasmaClient::Imp
 
 PlasmaBuffer::~PlasmaBuffer() { ARROW_UNUSED(client_->Release(object_id_)); }
 
-PlasmaClient::Impl::Impl() {
+PlasmaClient::Impl::Impl() : store_conn_(0), store_capacity_(0) {
 #ifdef PLASMA_CUDA
   DCHECK_OK(CudaDeviceManager::GetInstance(&manager_));
 #endif