UniquePtr<T> is better and encourages people to write clearer code. nsAutoArrayPtr should be converted to use UniquePtr<T> instead; the idiomatic way of declaring and defining a UniquePtr is: auto var = MakeUnique<T>(length); Since nsAutoArrayPtr implicitly converts to T* and UniquePtr does not, you'll have to add |.get()| calls for all uses of the raw pointer. Accesses such as |var[i]| do not need any special treatment.
This is a small problem, 5 occurrences: https://dxr.mozilla.org/comm-central/search?q=nsAutoArrayPtr&redirect=false&case=false mailnews/base/search/src/nsMsgSearchAdapter.cpp 555 nsAutoArrayPtr<char> newValue(new char[2*strlen(vptr) + 1]); mailnews/base/src/nsMsgSearchDBView.cpp 782 nsAutoArrayPtr<nsTArray<uint32_t> > indexArrays; mailnews/base/util/nsMsgCompressIStream.h 28 nsAutoArrayPtr<char> m_zbuf; 29 nsAutoArrayPtr<char> m_databuf; mailnews/base/util/nsMsgCompressOStream.h 25 nsAutoArrayPtr<char> m_zbuf;
Fixed 3 of 5, patch coming ;-)
Bug 1229985 (remove nsAutoArrayPtr) has landed on mozilla-inbound
I know, that's why I'm working on it. Now I've fixed 4 out of 5. Stand by for the patch ;-)
Created attachment 8723737 [details] [diff] [review] 1233935.patch (v1) Sorry about the r?-SPAM. This is a pre-active bustage fix, please review asap. One review only ;-)
Comment on attachment 8723737 [details] [diff] [review] 1233935.patch (v1) Review of attachment 8723737 [details] [diff] [review]: ----------------------------------------------------------------- rs=me ::: mailnews/base/src/nsMsgSearchDBView.cpp @@ +882,5 @@ > > nsresult > +nsMsgSearchDBView::PartitionSelectionByFolder(nsMsgViewIndex *indices, > + int32_t numIndices, > + mozilla::UniquePtr<nsTArray<uint32_t>>& indexArrays, Nit: &indexArrays, not & indexArrays. Although this is a nasty typename in general, not that I see a way around it.
Created attachment 8723781 [details] [diff] [review] 1233935.patch (v2) - nit fixed Boy, that was quick, does that mean we can land it and won't actually have bustage ;-)