Bug 1677000 - Address unpublished clang-tidy lints r=Gijs
☠☠ backed out by 36baeb20dfe6 ☠ ☠
authorBarret Rennie <barret@brennie.ca>
Wed, 09 Dec 2020 04:31:55 +0000
changeset 559939 3521334cfc38561e81522629d74b09ed6f4c1405
parent 559938 737f380c2cf2d4694d45dd9059d88fcd6e8d45a0
child 559940 68555f8b4ce2ea32bc6c9293240c9ff833943d03
push id132355
push userbrennie@mozilla.com
push dateWed, 09 Dec 2020 04:38:04 +0000
treeherderautoland@3521334cfc38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1677000
milestone85.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1677000 - Address unpublished clang-tidy lints r=Gijs There are two new lints introduced since IOUtils was written that we're hitting now: * IOUtils::InternalFileInfo's constructor does not initialize `mType`, `mSize`, `mLastModified`, and `mPermissions`; and * We should be using a nested namespace statement. We haven't hit them since these lines haven't been touched, but I noticed them on the code review frontend. Differential Revision: https://phabricator.services.mozilla.com/D99163
dom/system/IOUtils.cpp
dom/system/IOUtils.h
--- a/dom/system/IOUtils.cpp
+++ b/dom/system/IOUtils.cpp
@@ -54,18 +54,17 @@
     if (nsresult _rv = (_file)->InitWithPath((_path)); NS_FAILED(_rv)) { \
       (_promise)->MaybeRejectWithOperationError(                         \
           FormatErrorMessage(_rv, "Could not parse path (%s)",           \
                              NS_ConvertUTF16toUTF8(_path).get()));       \
       return (_promise).forget();                                        \
     }                                                                    \
   } while (0)
 
-namespace mozilla {
-namespace dom {
+namespace mozilla::dom {
 
 // static helper functions
 
 /**
  * Platform-specific (e.g. Windows, Unix) implementations of XPCOM APIs may
  * report I/O errors inconsistently. For convenience, this function will attempt
  * to match a |nsresult| against known results which imply a file cannot be
  * found.
@@ -1412,13 +1411,12 @@ IOUtils::InternalWriteOpts::FromBinding(
           NS_ConvertUTF16toUTF8(aOptions.mTmpPath.Value()).get()));
     }
   }
 
   opts.mCompress = aOptions.mCompress;
   return opts;
 }
 
-}  // namespace dom
-}  // namespace mozilla
+}  // namespace mozilla::dom
 
 #undef REJECT_IF_SHUTTING_DOWN
 #undef REJECT_IF_INIT_PATH_FAILED
--- a/dom/system/IOUtils.h
+++ b/dom/system/IOUtils.h
@@ -402,21 +402,21 @@ class IOUtils::IOError {
  * for private use in the IOUtils implementation.
  *
  * Because web IDL dictionaries are not easily copy/moveable, this class is
  * used instead, until converted to the proper |mozilla::dom::FileInfo| before
  * returning any results to JavaScript.
  */
 struct IOUtils::InternalFileInfo {
   nsString mPath;
-  FileType mType;
-  uint64_t mSize;
-  uint64_t mLastModified;
+  FileType mType = FileType::Other;
+  uint64_t mSize = 0;
+  uint64_t mLastModified = 0;
   Maybe<uint64_t> mCreationTime;
-  uint32_t mPermissions;
+  uint32_t mPermissions = 0;
 };
 
 /**
  * This is an easier to work with representation of a
  * |mozilla::dom::WriteOptions| for private use in the |IOUtils|
  * implementation.
  *
  * Because web IDL dictionaries are not easily copy/moveable, this class is