Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsDirIndex.h" |
michael@0 | 7 | #include "nsISupportsObsolete.h" |
michael@0 | 8 | |
michael@0 | 9 | NS_IMPL_ISUPPORTS(nsDirIndex, |
michael@0 | 10 | nsIDirIndex) |
michael@0 | 11 | |
michael@0 | 12 | nsDirIndex::nsDirIndex() : mType(TYPE_UNKNOWN), |
michael@0 | 13 | mSize(UINT64_MAX), |
michael@0 | 14 | mLastModified(-1) { |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | nsDirIndex::~nsDirIndex() {} |
michael@0 | 18 | |
michael@0 | 19 | NS_IMPL_GETSET(nsDirIndex, Type, uint32_t, mType) |
michael@0 | 20 | |
michael@0 | 21 | // GETSET macros for modern strings would be nice... |
michael@0 | 22 | |
michael@0 | 23 | NS_IMETHODIMP |
michael@0 | 24 | nsDirIndex::GetContentType(char* *aContentType) { |
michael@0 | 25 | *aContentType = ToNewCString(mContentType); |
michael@0 | 26 | if (!*aContentType) |
michael@0 | 27 | return NS_ERROR_OUT_OF_MEMORY; |
michael@0 | 28 | |
michael@0 | 29 | return NS_OK; |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | NS_IMETHODIMP |
michael@0 | 33 | nsDirIndex::SetContentType(const char* aContentType) { |
michael@0 | 34 | mContentType = aContentType; |
michael@0 | 35 | return NS_OK; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | NS_IMETHODIMP |
michael@0 | 39 | nsDirIndex::GetLocation(char* *aLocation) { |
michael@0 | 40 | *aLocation = ToNewCString(mLocation); |
michael@0 | 41 | if (!*aLocation) |
michael@0 | 42 | return NS_ERROR_OUT_OF_MEMORY; |
michael@0 | 43 | |
michael@0 | 44 | return NS_OK; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | NS_IMETHODIMP |
michael@0 | 48 | nsDirIndex::SetLocation(const char* aLocation) { |
michael@0 | 49 | mLocation = aLocation; |
michael@0 | 50 | return NS_OK; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | NS_IMETHODIMP |
michael@0 | 54 | nsDirIndex::GetDescription(char16_t* *aDescription) { |
michael@0 | 55 | *aDescription = ToNewUnicode(mDescription); |
michael@0 | 56 | if (!*aDescription) |
michael@0 | 57 | return NS_ERROR_OUT_OF_MEMORY; |
michael@0 | 58 | |
michael@0 | 59 | return NS_OK; |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | NS_IMETHODIMP |
michael@0 | 63 | nsDirIndex::SetDescription(const char16_t* aDescription) { |
michael@0 | 64 | mDescription.Assign(aDescription); |
michael@0 | 65 | return NS_OK; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | NS_IMPL_GETSET(nsDirIndex, Size, int64_t, mSize) |
michael@0 | 69 | NS_IMPL_GETSET(nsDirIndex, LastModified, PRTime, mLastModified) |
michael@0 | 70 |