Bug 1677000 - Address unpublished clang-tidy lints r=Gijs
authorBarret Rennie <barret@brennie.ca>
Wed, 09 Dec 2020 05:48:51 +0000
changeset 559951 6cc33208cf323ec422d39d534e268e3229bd42a5
parent 559950 d61d3d7f909cddacfea26114c2d46999bb80564a
child 559952 936c49ae59a43abda1ff5beb4215e4671de0dc05
push id132359
push userbrennie@mozilla.com
push dateWed, 09 Dec 2020 05:56:04 +0000
treeherderautoland@6cc33208cf32 [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