Bug 785124 - Pt 4 - Whitespace only change. Change "type &var" to "type& var" and ptrs. r=dougt

This commit is contained in:
Dave Hylands 2013-01-07 17:43:02 +01:00
Родитель 6e678052db
Коммит 0569240c40
20 изменённых файлов: 145 добавлений и 145 удалений

Просмотреть файл

@ -96,7 +96,7 @@ static const nsDependentCString sAutoVolumeName[] = { NS_LITERAL_CSTRING("sdcard
**************************************************************************/
static bool
ReadSysFile(const char *aFilename, char *aBuf, size_t aBufSize)
ReadSysFile(const char* aFilename, char* aBuf, size_t aBufSize)
{
int fd = open(aFilename, O_RDONLY);
if (fd < 0) {
@ -117,7 +117,7 @@ ReadSysFile(const char *aFilename, char *aBuf, size_t aBufSize)
}
static bool
ReadSysFile(const char *aFilename, bool *aVal)
ReadSysFile(const char* aFilename, bool* aVal)
{
char valBuf[20];
if (!ReadSysFile(aFilename, valBuf, sizeof(valBuf))) {
@ -133,7 +133,7 @@ ReadSysFile(const char *aFilename, bool *aVal)
/***************************************************************************/
inline const char *SwitchStateStr(const SwitchEvent &aEvent)
inline const char* SwitchStateStr(const SwitchEvent& aEvent)
{
return aEvent.status() == SWITCH_STATE_ON ? "plugged" : "unplugged";
}
@ -168,7 +168,7 @@ IsUsbCablePluggedIn()
class AutoVolumeManagerStateObserver : public VolumeManager::StateObserver
{
public:
virtual void Notify(const VolumeManager::StateChangedEvent &aEvent);
virtual void Notify(const VolumeManager::StateChangedEvent& aEvent);
};
// The AutoVolumeEventObserver allows the AutoMounter to know about card
@ -176,7 +176,7 @@ public:
class AutoVolumeEventObserver : public Volume::EventObserver
{
public:
virtual void Notify(Volume * const &aEvent);
virtual void Notify(Volume * const & aEvent);
};
class AutoMounterResponseCallback : public VolumeResponseCallback
@ -188,7 +188,7 @@ public:
}
protected:
virtual void ResponseReceived(const VolumeCommand *aCommand);
virtual void ResponseReceived(const VolumeCommand* aCommand);
private:
const static int kMaxErrorCount = 3; // Max number of errors before we give up
@ -236,7 +236,7 @@ public:
void UpdateState();
const char *ModeStr(int32_t aMode)
const char* ModeStr(int32_t aMode)
{
switch (aMode) {
case AUTOMOUNTER_DISABLE: return "Disable";
@ -313,7 +313,7 @@ AutoVolumeEventObserver::Notify(Volume * const &)
}
void
AutoMounterResponseCallback::ResponseReceived(const VolumeCommand *aCommand)
AutoMounterResponseCallback::ResponseReceived(const VolumeCommand* aCommand)
{
if (WasSuccessful()) {
@ -487,7 +487,7 @@ ShutdownAutoMounterIOThread()
}
static void
SetAutoMounterModeIOThread(const int32_t &aMode)
SetAutoMounterModeIOThread(const int32_t& aMode)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
MOZ_ASSERT(sAutoMounter);
@ -530,7 +530,7 @@ public:
UnregisterSwitchObserver(SWITCH_USB, this);
}
virtual void Notify(const SwitchEvent &aEvent)
virtual void Notify(const SwitchEvent& aEvent)
{
DBG("UsbCable switch device: %d state: %s\n",
aEvent.device(), SwitchStateStr(aEvent));

Просмотреть файл

@ -35,7 +35,7 @@ public:
SettingsServiceCallback() {}
NS_IMETHOD Handle(const nsAString &aName, const JS::Value &aResult) {
NS_IMETHOD Handle(const nsAString& aName, const JS::Value& aResult) {
if (JSVAL_IS_INT(aResult)) {
int32_t mode = JSVAL_TO_INT(aResult);
SetAutoMounterMode(mode);
@ -43,7 +43,7 @@ public:
return NS_OK;
}
NS_IMETHOD HandleError(const nsAString &aName) {
NS_IMETHOD HandleError(const nsAString& aName) {
ERR("SettingsCallback::HandleError: %s\n", NS_LossyConvertUTF16toASCII(aName).get());
return NS_OK;
}
@ -95,9 +95,9 @@ AutoMounterSetting::~AutoMounterSetting()
NS_IMPL_ISUPPORTS1(AutoMounterSetting, nsIObserver)
NS_IMETHODIMP
AutoMounterSetting::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *aData)
AutoMounterSetting::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
if (strcmp(aTopic, MOZSETTINGS_CHANGED) != 0) {
return NS_OK;
@ -115,7 +115,7 @@ AutoMounterSetting::Observe(nsISupports *aSubject,
ERR("Failed to get JSContextStack");
return NS_OK;
}
JSContext *cx = stack->GetSafeJSContext();
JSContext* cx = stack->GetSafeJSContext();
if (!cx) {
ERR("Failed to GetSafeJSContext");
return NS_OK;
@ -126,7 +126,7 @@ AutoMounterSetting::Observe(nsISupports *aSubject,
!val.isObject()) {
return NS_OK;
}
JSObject &obj(val.toObject());
JSObject& obj(val.toObject());
JS::Value key;
if (!JS_GetProperty(cx, &obj, "key", &key) ||
!key.isString()) {

Просмотреть файл

@ -52,7 +52,7 @@ static int32_t sMountGeneration = 0;
// We don't get media inserted/removed events at startup. So we
// assume it's present, and we'll be told that it's missing.
Volume::Volume(const nsCSubstring &aName)
Volume::Volume(const nsCSubstring& aName)
: mMediaPresent(true),
mState(nsIVolume::STATE_INIT),
mName(aName),
@ -125,7 +125,7 @@ Volume::SetState(Volume::STATE aNewState)
}
void
Volume::SetMountPoint(const nsCSubstring &aMountPoint)
Volume::SetMountPoint(const nsCSubstring& aMountPoint)
{
if (mMountPoint.Equals(aMountPoint)) {
return;
@ -135,38 +135,38 @@ Volume::SetMountPoint(const nsCSubstring &aMountPoint)
}
void
Volume::StartMount(VolumeResponseCallback *aCallback)
Volume::StartMount(VolumeResponseCallback* aCallback)
{
StartCommand(new VolumeActionCommand(this, "mount", "", aCallback));
}
void
Volume::StartUnmount(VolumeResponseCallback *aCallback)
Volume::StartUnmount(VolumeResponseCallback* aCallback)
{
StartCommand(new VolumeActionCommand(this, "unmount", "force", aCallback));
}
void
Volume::StartShare(VolumeResponseCallback *aCallback)
Volume::StartShare(VolumeResponseCallback* aCallback)
{
StartCommand(new VolumeActionCommand(this, "share", "ums", aCallback));
}
void
Volume::StartUnshare(VolumeResponseCallback *aCallback)
Volume::StartUnshare(VolumeResponseCallback* aCallback)
{
StartCommand(new VolumeActionCommand(this, "unshare", "ums", aCallback));
}
void
Volume::StartCommand(VolumeCommand *aCommand)
Volume::StartCommand(VolumeCommand* aCommand)
{
VolumeManager::PostCommand(aCommand);
}
//static
void
Volume::RegisterObserver(Volume::EventObserver *aObserver)
Volume::RegisterObserver(Volume::EventObserver* aObserver)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
@ -181,7 +181,7 @@ Volume::RegisterObserver(Volume::EventObserver *aObserver)
//static
void
Volume::UnregisterObserver(Volume::EventObserver *aObserver)
Volume::UnregisterObserver(Volume::EventObserver* aObserver)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
@ -190,9 +190,9 @@ Volume::UnregisterObserver(Volume::EventObserver *aObserver)
//static
void
Volume::UpdateMountLock(const nsACString &aVolumeName,
const int32_t &aMountGeneration,
const bool &aMountLocked)
Volume::UpdateMountLock(const nsACString& aVolumeName,
const int32_t& aMountGeneration,
const bool& aMountLocked)
{
RefPtr<Volume> vol = VolumeManager::FindVolumeByName(aVolumeName);
if (!vol || (vol->mMountGeneration != aMountGeneration)) {
@ -206,7 +206,7 @@ Volume::UpdateMountLock(const nsACString &aVolumeName,
}
void
Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer &aTokenizer)
Volume::HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer)
{
// The volume name will have already been parsed, and the tokenizer will point
// to the token after the volume name

Просмотреть файл

@ -27,20 +27,20 @@ namespace system {
class Volume : public RefCounted<Volume>
{
public:
Volume(const nsCSubstring &aVolumeName);
Volume(const nsCSubstring& aVolumeName);
typedef long STATE; // States are now defined in nsIVolume.idl
static const char *StateStr(STATE aState) { return NS_VolumeStateStr(aState); }
const char *StateStr() const { return StateStr(mState); }
static const char* StateStr(STATE aState) { return NS_VolumeStateStr(aState); }
const char* StateStr() const { return StateStr(mState); }
STATE State() const { return mState; }
const nsCString &Name() const { return mName; }
const char *NameStr() const { return mName.get(); }
const nsCString& Name() const { return mName; }
const char* NameStr() const { return mName.get(); }
// The mount point is the name of the directory where the volume is mounted.
// (i.e. path that leads to the files stored on the volume).
const nsCString &MountPoint() const { return mMountPoint; }
const nsCString& MountPoint() const { return mMountPoint; }
int32_t MountGeneration() const { return mMountGeneration; }
bool IsMountLocked() const { return mMountLocked; }
@ -50,8 +50,8 @@ public:
typedef mozilla::ObserverList<Volume *> EventObserverList;
// NOTE: that observers must live in the IOThread.
static void RegisterObserver(EventObserver *aObserver);
static void UnregisterObserver(EventObserver *aObserver);
static void RegisterObserver(EventObserver* aObserver);
static void UnregisterObserver(EventObserver* aObserver);
private:
friend class AutoMounter; // Calls StartXxx
@ -62,21 +62,21 @@ private:
// The StartXxx functions will queue up a command to the VolumeManager.
// You can queue up as many commands as you like, and aCallback will
// be called as each one completes.
void StartMount(VolumeResponseCallback *aCallback);
void StartUnmount(VolumeResponseCallback *aCallback);
void StartShare(VolumeResponseCallback *aCallback);
void StartUnshare(VolumeResponseCallback *aCallback);
void StartMount(VolumeResponseCallback* aCallback);
void StartUnmount(VolumeResponseCallback* aCallback);
void StartShare(VolumeResponseCallback* aCallback);
void StartUnshare(VolumeResponseCallback* aCallback);
void SetState(STATE aNewState);
void SetMediaPresent(bool aMediaPresent);
void SetMountPoint(const nsCSubstring &aMountPoint);
void StartCommand(VolumeCommand *aCommand);
void SetMountPoint(const nsCSubstring& aMountPoint);
void StartCommand(VolumeCommand* aCommand);
void HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer &aTokenizer);
void HandleVoldResponse(int aResponseCode, nsCWhitespaceTokenizer& aTokenizer);
static void UpdateMountLock(const nsACString &aVolumeName,
const int32_t &aMountGeneration,
const bool &aMountLocked);
static void UpdateMountLock(const nsACString& aVolumeName,
const int32_t& aMountGeneration,
const bool& aMountLocked);
bool mMediaPresent;
STATE mState;

Просмотреть файл

@ -39,10 +39,10 @@ namespace system {
*
***************************************************************************/
VolumeActionCommand::VolumeActionCommand(Volume *aVolume,
const char *aAction,
const char *aExtraArgs,
VolumeResponseCallback *aCallback)
VolumeActionCommand::VolumeActionCommand(Volume* aVolume,
const char* aAction,
const char* aExtraArgs,
VolumeResponseCallback* aCallback)
: VolumeCommand(aCallback),
mVolume(aVolume)
{
@ -75,7 +75,7 @@ VolumeActionCommand::VolumeActionCommand(Volume *aVolume,
*
***************************************************************************/
VolumeListCommand::VolumeListCommand(VolumeResponseCallback *aCallback)
VolumeListCommand::VolumeListCommand(VolumeResponseCallback* aCallback)
: VolumeCommand(NS_LITERAL_CSTRING("volume list"), aCallback)
{
}

Просмотреть файл

@ -59,14 +59,14 @@ public:
const nsCString &ResponseStr() const { return mResponseStr; }
protected:
virtual void ResponseReceived(const VolumeCommand *aCommand) = 0;
virtual void ResponseReceived(const VolumeCommand* aCommand) = 0;
private:
friend class VolumeCommand; // Calls HandleResponse and SetPending
void HandleResponse(const VolumeCommand *aCommand,
void HandleResponse(const VolumeCommand* aCommand,
int aResponseCode,
nsACString &aResponseStr)
nsACString& aResponseStr)
{
mResponseCode = aResponseCode;
mResponseStr = aResponseStr;
@ -102,14 +102,14 @@ private:
class VolumeCommand : public RefCounted<VolumeCommand>
{
public:
VolumeCommand(VolumeResponseCallback *aCallback)
VolumeCommand(VolumeResponseCallback* aCallback)
: mBytesConsumed(0),
mCallback(aCallback)
{
SetCmd(NS_LITERAL_CSTRING(""));
}
VolumeCommand(const nsACString &aCommand, VolumeResponseCallback *aCallback)
VolumeCommand(const nsACString& aCommand, VolumeResponseCallback* aCallback)
: mBytesConsumed(0),
mCallback(aCallback)
{
@ -118,7 +118,7 @@ public:
virtual ~VolumeCommand() {}
void SetCmd(const nsACString &aCommand)
void SetCmd(const nsACString& aCommand)
{
mCmd = aCommand;
// Add a null character. We want this to be included in the length since
@ -126,8 +126,8 @@ public:
mCmd.Append('\0');
}
const char *CmdStr() const { return mCmd.get(); }
const char *Data() const { return mCmd.Data() + mBytesConsumed; }
const char* CmdStr() const { return mCmd.get(); }
const char* Data() const { return mCmd.Data() + mBytesConsumed; }
size_t BytesConsumed() const { return mBytesConsumed; }
size_t BytesRemaining() const
@ -150,7 +150,7 @@ private:
}
}
void HandleResponse(int aResponseCode, nsACString &aResponseStr)
void HandleResponse(int aResponseCode, nsACString& aResponseStr)
{
if (mCallback) {
mCallback->HandleResponse(this, aResponseCode, aResponseStr);
@ -167,8 +167,8 @@ private:
class VolumeActionCommand : public VolumeCommand
{
public:
VolumeActionCommand(Volume *aVolume, const char *aAction,
const char *aExtraArgs, VolumeResponseCallback *aCallback);
VolumeActionCommand(Volume* aVolume, const char* aAction,
const char* aExtraArgs, VolumeResponseCallback* aCallback);
private:
RefPtr<Volume> mVolume;
@ -177,7 +177,7 @@ private:
class VolumeListCommand : public VolumeCommand
{
public:
VolumeListCommand(VolumeResponseCallback *aCallback);
VolumeListCommand(VolumeResponseCallback* aCallback);
};
} // system

Просмотреть файл

@ -95,20 +95,20 @@ VolumeManager::SetState(STATE aNewState)
//static
void
VolumeManager::RegisterStateObserver(StateObserver *aObserver)
VolumeManager::RegisterStateObserver(StateObserver* aObserver)
{
mStateObserverList.AddObserver(aObserver);
}
//static
void VolumeManager::UnregisterStateObserver(StateObserver *aObserver)
void VolumeManager::UnregisterStateObserver(StateObserver* aObserver)
{
mStateObserverList.RemoveObserver(aObserver);
}
//static
TemporaryRef<Volume>
VolumeManager::FindVolumeByName(const nsCSubstring &aName)
VolumeManager::FindVolumeByName(const nsCSubstring& aName)
{
if (!sVolumeManager) {
return NULL;
@ -126,7 +126,7 @@ VolumeManager::FindVolumeByName(const nsCSubstring &aName)
//static
TemporaryRef<Volume>
VolumeManager::FindAddVolumeByName(const nsCSubstring &aName)
VolumeManager::FindAddVolumeByName(const nsCSubstring& aName)
{
RefPtr<Volume> vol = FindVolumeByName(aName);
if (vol) {
@ -140,7 +140,7 @@ VolumeManager::FindAddVolumeByName(const nsCSubstring &aName)
class VolumeListCallback : public VolumeResponseCallback
{
virtual void ResponseReceived(const VolumeCommand *aCommand)
virtual void ResponseReceived(const VolumeCommand* aCommand)
{
switch (ResponseCode()) {
case ResponseCode::VolumeListResult: {
@ -206,7 +206,7 @@ VolumeManager::OpenSocket()
//static
void
VolumeManager::PostCommand(VolumeCommand *aCommand)
VolumeManager::PostCommand(VolumeCommand* aCommand)
{
if (!sVolumeManager) {
ERR("VolumeManager not initialized. Dropping command '%s'", aCommand->Data());
@ -241,7 +241,7 @@ VolumeManager::WriteCommandData()
return;
}
VolumeCommand *cmd = mCommands.front();
VolumeCommand* cmd = mCommands.front();
if (cmd->BytesRemaining() == 0) {
// All bytes have been written. We're waiting for a response.
return;
@ -275,7 +275,7 @@ void
VolumeManager::OnLineRead(int aFd, nsDependentCSubstring& aMessage)
{
MOZ_ASSERT(aFd == mSocket.get());
char *endPtr;
char* endPtr;
int responseCode = strtol(aMessage.Data(), &endPtr, 10);
if (*endPtr == ' ') {
endPtr++;
@ -292,7 +292,7 @@ VolumeManager::OnLineRead(int aFd, nsDependentCSubstring& aMessage)
} else {
// Everything else is considered to be part of the command response.
if (mCommands.size() > 0) {
VolumeCommand *cmd = mCommands.front();
VolumeCommand* cmd = mCommands.front();
cmd->HandleResponse(responseCode, responseLine);
if (responseCode >= ResponseCode::CommandOkay) {
// That's a terminating response. We can remove the command.
@ -315,7 +315,7 @@ VolumeManager::OnFileCanWriteWithoutBlocking(int aFd)
}
void
VolumeManager::HandleBroadcast(int aResponseCode, nsCString &aResponseLine)
VolumeManager::HandleBroadcast(int aResponseCode, nsCString& aResponseLine)
{
// Format of the line is something like:
//

Просмотреть файл

@ -103,8 +103,8 @@ public:
};
static STATE State();
static const char *StateStr(STATE aState);
static const char *StateStr() { return StateStr(State()); }
static const char* StateStr(STATE aState);
static const char* StateStr() { return StateStr(State()); }
class StateChangedEvent
{
@ -115,8 +115,8 @@ public:
typedef mozilla::Observer<StateChangedEvent> StateObserver;
typedef mozilla::ObserverList<StateChangedEvent> StateObserverList;
static void RegisterStateObserver(StateObserver *aObserver);
static void UnregisterStateObserver(StateObserver *aObserver);
static void RegisterStateObserver(StateObserver* aObserver);
static void UnregisterStateObserver(StateObserver* aObserver);
//-----------------------------------------------------------------------
@ -124,10 +124,10 @@ public:
static VolumeArray::size_type NumVolumes();
static TemporaryRef<Volume> GetVolume(VolumeArray::index_type aIndex);
static TemporaryRef<Volume> FindVolumeByName(const nsCSubstring &aName);
static TemporaryRef<Volume> FindAddVolumeByName(const nsCSubstring &aName);
static TemporaryRef<Volume> FindVolumeByName(const nsCSubstring& aName);
static TemporaryRef<Volume> FindAddVolumeByName(const nsCSubstring& aName);
static void PostCommand(VolumeCommand *aCommand);
static void PostCommand(VolumeCommand* aCommand);
protected:
@ -144,7 +144,7 @@ private:
void Restart();
void WriteCommandData();
void HandleBroadcast(int aResponseCode, nsCString &aResponseLine);
void HandleBroadcast(int aResponseCode, nsCString& aResponseLine);
typedef std::queue<RefPtr<VolumeCommand> > CommandQueue;

Просмотреть файл

@ -12,7 +12,7 @@
namespace mozilla {
namespace system {
VolumeServiceIOThread::VolumeServiceIOThread(nsVolumeService *aVolumeService)
VolumeServiceIOThread::VolumeServiceIOThread(nsVolumeService* aVolumeService)
: mVolumeService(aVolumeService)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
@ -30,7 +30,7 @@ VolumeServiceIOThread::~VolumeServiceIOThread()
}
void
VolumeServiceIOThread::Notify(Volume * const &aVolume)
VolumeServiceIOThread::Notify(Volume* const & aVolume)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
if (VolumeManager::State() != VolumeManager::VOLUMES_READY) {
@ -40,7 +40,7 @@ VolumeServiceIOThread::Notify(Volume * const &aVolume)
}
void
VolumeServiceIOThread::Notify(const VolumeManager::StateChangedEvent &aEvent)
VolumeServiceIOThread::Notify(const VolumeManager::StateChangedEvent& aEvent)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
UpdateAllVolumes();
@ -65,7 +65,7 @@ VolumeServiceIOThread::UpdateAllVolumes()
static StaticRefPtr<VolumeServiceIOThread> sVolumeServiceIOThread;
void
InitVolumeServiceIOThread(nsVolumeService * const &aVolumeService)
InitVolumeServiceIOThread(nsVolumeService* const & aVolumeService)
{
MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());
sVolumeServiceIOThread = new VolumeServiceIOThread(aVolumeService);

Просмотреть файл

@ -23,19 +23,19 @@ class VolumeServiceIOThread : public VolumeManager::StateObserver,
public RefCounted<VolumeServiceIOThread>
{
public:
VolumeServiceIOThread(nsVolumeService *aVolumeService);
VolumeServiceIOThread(nsVolumeService* aVolumeService);
~VolumeServiceIOThread();
private:
void UpdateAllVolumes();
virtual void Notify(const VolumeManager::StateChangedEvent &aEvent);
virtual void Notify(Volume * const &aVolume);
virtual void Notify(const VolumeManager::StateChangedEvent& aEvent);
virtual void Notify(Volume* const & aVolume);
RefPtr<nsVolumeService> mVolumeService;
};
void InitVolumeServiceIOThread(nsVolumeService * const &aVolumeService);
void InitVolumeServiceIOThread(nsVolumeService* const & aVolumeService);
void ShutdownVolumeServiceIOThread();
} // system

Просмотреть файл

@ -55,7 +55,7 @@ public:
obs->RemoveObserver(this, NS_VOLUME_STATE_CHANGED);
}
void LogVolume(nsIVolume *vol)
void LogVolume(nsIVolume* vol)
{
nsString volName;
nsString mountPoint;
@ -92,9 +92,9 @@ static nsCOMPtr<VolumeTestObserver> sTestObserver;
NS_IMPL_ISUPPORTS1(VolumeTestObserver, nsIObserver)
NS_IMETHODIMP
VolumeTestObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const PRUnichar *aData)
VolumeTestObserver::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
LOG("TestObserver: topic: %s", aTopic);

Просмотреть файл

@ -56,7 +56,7 @@ namespace mozilla {
namespace system {
// Convert a state into a loggable/printable string.
const char *NS_VolumeStateStr(int32_t aState);
const char* NS_VolumeStateStr(int32_t aState);
} // system
} // mozilla

Просмотреть файл

@ -40,7 +40,7 @@ NS_VolumeStateStr(int32_t aState)
NS_IMPL_THREADSAFE_ISUPPORTS1(nsVolume, nsIVolume)
nsVolume::nsVolume(const Volume *aVolume)
nsVolume::nsVolume(const Volume* aVolume)
: mName(NS_ConvertUTF8toUTF16(aVolume->Name())),
mMountPoint(NS_ConvertUTF8toUTF16(aVolume->MountPoint())),
mState(aVolume->State()),
@ -49,19 +49,19 @@ nsVolume::nsVolume(const Volume *aVolume)
{
}
NS_IMETHODIMP nsVolume::GetName(nsAString &aName)
NS_IMETHODIMP nsVolume::GetName(nsAString& aName)
{
aName = mName;
return NS_OK;
}
NS_IMETHODIMP nsVolume::GetMountGeneration(int32_t *aMountGeneration)
NS_IMETHODIMP nsVolume::GetMountGeneration(int32_t* aMountGeneration)
{
*aMountGeneration = mMountGeneration;
return NS_OK;
}
NS_IMETHODIMP nsVolume::GetMountLockName(nsAString &aMountLockName)
NS_IMETHODIMP nsVolume::GetMountLockName(nsAString& aMountLockName)
{
aMountLockName = NS_LITERAL_STRING("volume-") + Name();
aMountLockName.AppendPrintf("-%d", mMountGeneration);
@ -69,13 +69,13 @@ NS_IMETHODIMP nsVolume::GetMountLockName(nsAString &aMountLockName)
return NS_OK;
}
NS_IMETHODIMP nsVolume::GetMountPoint(nsAString &aMountPoint)
NS_IMETHODIMP nsVolume::GetMountPoint(nsAString& aMountPoint)
{
aMountPoint = mMountPoint;
return NS_OK;
}
NS_IMETHODIMP nsVolume::GetState(int32_t *aState)
NS_IMETHODIMP nsVolume::GetState(int32_t* aState)
{
*aState = mState;
return NS_OK;
@ -104,7 +104,7 @@ nsVolume::LogState() const
LOG("nsVolume: %s state %s", NameStr(), StateStr());
}
void nsVolume::Set(const nsVolume *aVolume)
void nsVolume::Set(const nsVolume* aVolume)
{
mName = aVolume->mName;
mMountPoint = aVolume->mMountPoint;
@ -137,7 +137,7 @@ void nsVolume::Set(const nsVolume *aVolume)
}
void
nsVolume::UpdateMountLock(const nsAString &aMountLockState)
nsVolume::UpdateMountLock(const nsAString& aMountLockState)
{
// There are 3 states, unlocked, locked-background, and locked-foreground
// I figured it was easier to use negtive logic and compare for unlocked.

Просмотреть файл

@ -23,11 +23,11 @@ public:
NS_DECL_NSIVOLUME
// This constructor is used by the UpdateVolumeRunnable constructor
nsVolume(const Volume *aVolume);
nsVolume(const Volume* aVolume);
// This constructor is used by ContentChild::RecvFileSystemUpdate
nsVolume(const nsAString &aName, const nsAString &aMountPoint,
const int32_t &aState, const int32_t &aMountGeneration)
nsVolume(const nsAString& aName, const nsAString& aMountPoint,
const int32_t& aState, const int32_t& aMountGeneration)
: mName(aName),
mMountPoint(aMountPoint),
mState(aState),
@ -38,7 +38,7 @@ public:
// This constructor is used by nsVolumeService::FindAddVolumeByName, and
// will be followed shortly by a Set call.
nsVolume(const nsAString &aName)
nsVolume(const nsAString& aName)
: mName(aName),
mState(STATE_INIT),
mMountGeneration(-1),
@ -46,7 +46,7 @@ public:
{
}
bool Equals(const nsVolume *aVolume)
bool Equals(const nsVolume* aVolume)
{
return mName.Equals(aVolume->mName)
&& mMountPoint.Equals(aVolume->mMountPoint)
@ -55,21 +55,21 @@ public:
&& (mMountLocked == aVolume->mMountLocked);
}
void Set(const nsVolume *aVolume);
void Set(const nsVolume* aVolume);
void LogState() const;
const nsString &Name() const { return mName; }
const char *NameStr() const { return NS_LossyConvertUTF16toASCII(mName).get(); }
const nsString& Name() const { return mName; }
const char* NameStr() const { return NS_LossyConvertUTF16toASCII(mName).get(); }
int32_t MountGeneration() const { return mMountGeneration; }
bool IsMountLocked() const { return mMountLocked; }
const nsString &MountPoint() const { return mMountPoint; }
const char *MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
const nsString& MountPoint() const { return mMountPoint; }
const char* MountPointStr() const { return NS_LossyConvertUTF16toASCII(mMountPoint).get(); }
int32_t State() const { return mState; }
const char *StateStr() const { return NS_VolumeStateStr(mState); }
const char* StateStr() const { return NS_VolumeStateStr(mState); }
typedef nsTArray<nsRefPtr<nsVolume> > Array;
@ -77,7 +77,7 @@ private:
~nsVolume() {}
friend class nsVolumeService; // Calls the following XxxMountLock functions
void UpdateMountLock(const nsAString &aMountLockState);
void UpdateMountLock(const nsAString& aMountLockState);
void UpdateMountLock(bool aMountLocked);
nsString mName;

Просмотреть файл

@ -27,7 +27,7 @@ NS_IMPL_ISUPPORTS3(nsVolumeMountLock, nsIVolumeMountLock,
// static
already_AddRefed<nsVolumeMountLock>
nsVolumeMountLock::Create(const nsAString &aVolumeName)
nsVolumeMountLock::Create(const nsAString& aVolumeName)
{
DBG("nsVolumeMountLock::Create called");
@ -38,7 +38,7 @@ nsVolumeMountLock::Create(const nsAString &aVolumeName)
return mountLock.forget();
}
nsVolumeMountLock::nsVolumeMountLock(const nsAString &aVolumeName)
nsVolumeMountLock::nsVolumeMountLock(const nsAString& aVolumeName)
: mVolumeName(aVolumeName),
mVolumeGeneration(-1),
mUnlocked(false)
@ -92,7 +92,7 @@ NS_IMETHODIMP nsVolumeMountLock::Unlock()
return NS_OK;
}
NS_IMETHODIMP nsVolumeMountLock::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
NS_IMETHODIMP nsVolumeMountLock::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData)
{
if (strcmp(aTopic, NS_VOLUME_STATE_CHANGED) != 0) {
return NS_OK;

Просмотреть файл

@ -31,12 +31,12 @@ public:
NS_DECL_NSIOBSERVER
NS_DECL_NSIVOLUMEMOUNTLOCK
static already_AddRefed<nsVolumeMountLock> Create(const nsAString &volumeName);
static already_AddRefed<nsVolumeMountLock> Create(const nsAString& volumeName);
const nsString &VolumeName() const { return mVolumeName; }
const nsString& VolumeName() const { return mVolumeName; }
private:
nsVolumeMountLock(const nsAString &aVolumeName);
nsVolumeMountLock(const nsAString& aVolumeName);
~nsVolumeMountLock();
nsresult Init();

Просмотреть файл

@ -108,13 +108,13 @@ nsVolumeService::~nsVolumeService()
}
// Callback for nsIDOMMozWakeLockListener
NS_IMETHODIMP nsVolumeService::Callback(const nsAString &aTopic, const nsAString &aState)
NS_IMETHODIMP nsVolumeService::Callback(const nsAString& aTopic, const nsAString& aState)
{
CheckMountLock(aTopic, aState);
return NS_OK;
}
NS_IMETHODIMP nsVolumeService::BroadcastVolume(const nsAString &aVolName)
NS_IMETHODIMP nsVolumeService::BroadcastVolume(const nsAString& aVolName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
nsRefPtr<nsVolume> vol = FindVolumeByName(aVolName);
@ -133,7 +133,7 @@ NS_IMETHODIMP nsVolumeService::BroadcastVolume(const nsAString &aVolName)
return NS_OK;
}
NS_IMETHODIMP nsVolumeService::GetVolumeByName(const nsAString &aVolName, nsIVolume **aResult)
NS_IMETHODIMP nsVolumeService::GetVolumeByName(const nsAString& aVolName, nsIVolume **aResult)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
nsRefPtr<nsVolume> vol = FindVolumeByName(aVolName);
@ -147,7 +147,7 @@ NS_IMETHODIMP nsVolumeService::GetVolumeByName(const nsAString &aVolName, nsIVol
return NS_OK;
}
NS_IMETHODIMP nsVolumeService::GetVolumeByPath(const nsAString &aPath, nsIVolume **aResult)
NS_IMETHODIMP nsVolumeService::GetVolumeByPath(const nsAString& aPath, nsIVolume **aResult)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
nsCString utf8Path = NS_ConvertUTF16toUTF8(aPath);
@ -190,7 +190,7 @@ NS_IMETHODIMP nsVolumeService::GetVolumeByPath(const nsAString &aPath, nsIVolume
return NS_OK;
}
NS_IMETHODIMP nsVolumeService::CreateMountLock(const nsAString &aVolumeName, nsIVolumeMountLock **aResult)
NS_IMETHODIMP nsVolumeService::CreateMountLock(const nsAString& aVolumeName, nsIVolumeMountLock **aResult)
{
nsRefPtr<nsVolumeMountLock> mountLock = nsVolumeMountLock::Create(aVolumeName);
if (!mountLock) {
@ -200,8 +200,8 @@ NS_IMETHODIMP nsVolumeService::CreateMountLock(const nsAString &aVolumeName, nsI
return NS_OK;
}
void nsVolumeService::CheckMountLock(const nsAString &aMountLockName,
const nsAString &aMountLockState)
void nsVolumeService::CheckMountLock(const nsAString& aMountLockName,
const nsAString& aMountLockState)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(NS_IsMainThread());
@ -219,7 +219,7 @@ void nsVolumeService::CheckMountLock(const nsAString &aMountLockName,
}
}
already_AddRefed<nsVolume> nsVolumeService::FindVolumeByName(const nsAString &aName)
already_AddRefed<nsVolume> nsVolumeService::FindVolumeByName(const nsAString& aName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(NS_IsMainThread());
@ -236,7 +236,7 @@ already_AddRefed<nsVolume> nsVolumeService::FindVolumeByName(const nsAString &aN
}
//static
already_AddRefed<nsVolume> nsVolumeService::FindAddVolumeByName(const nsAString &aName)
already_AddRefed<nsVolume> nsVolumeService::FindAddVolumeByName(const nsAString& aName)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(NS_IsMainThread());
@ -252,7 +252,7 @@ already_AddRefed<nsVolume> nsVolumeService::FindAddVolumeByName(const nsAString
return vol.forget();
}
void nsVolumeService::UpdateVolume(const nsVolume *aVolume)
void nsVolumeService::UpdateVolume(const nsVolume* aVolume)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
MOZ_ASSERT(NS_IsMainThread());
@ -278,7 +278,7 @@ void nsVolumeService::UpdateVolume(const nsVolume *aVolume)
class UpdateVolumeRunnable : public nsRunnable
{
public:
UpdateVolumeRunnable(nsVolumeService *aVolumeService, const Volume *aVolume)
UpdateVolumeRunnable(nsVolumeService* aVolumeService, const Volume* aVolume)
: mVolumeService(aVolumeService),
mVolume(new nsVolume(aVolume))
{
@ -303,7 +303,7 @@ private:
nsRefPtr<nsVolume> mVolume;
};
void nsVolumeService::UpdateVolumeIOThread(const Volume *aVolume)
void nsVolumeService::UpdateVolumeIOThread(const Volume* aVolume)
{
DBG("UpdateVolumeIOThread: Volume '%s' state %s mount '%s' gen %d locked %d",
aVolume->NameStr(), aVolume->StateStr(), aVolume->MountPoint().get(),

Просмотреть файл

@ -36,15 +36,15 @@ public:
nsVolumeService();
static already_AddRefed<nsVolumeService> GetSingleton();
//static nsVolumeService *GetSingleton();
//static nsVolumeService* GetSingleton();
static void Shutdown();
void CheckMountLock(const nsAString &aMountLockName,
const nsAString &aMountLockState);
already_AddRefed<nsVolume> FindVolumeByName(const nsAString &aName);
already_AddRefed<nsVolume> FindAddVolumeByName(const nsAString &aName);
void UpdateVolume(const nsVolume *aVolume);
void UpdateVolumeIOThread(const Volume *aVolume);
void CheckMountLock(const nsAString& aMountLockName,
const nsAString& aMountLockState);
already_AddRefed<nsVolume> FindVolumeByName(const nsAString& aName);
already_AddRefed<nsVolume> FindAddVolumeByName(const nsAString& aName);
void UpdateVolume(const nsVolume* aVolume);
void UpdateVolumeIOThread(const Volume* aVolume);
private:
~nsVolumeService();

Просмотреть файл

@ -10,7 +10,7 @@ namespace system {
NS_IMPL_ISUPPORTS1(nsVolumeStat, nsIVolumeStat)
nsVolumeStat::nsVolumeStat(const nsAString &aPath)
nsVolumeStat::nsVolumeStat(const nsAString& aPath)
{
nsCString utf8Path = NS_ConvertUTF16toUTF8(aPath);
@ -24,14 +24,14 @@ nsVolumeStat::~nsVolumeStat()
}
/* readonly attribute long long totalBytes; */
NS_IMETHODIMP nsVolumeStat::GetTotalBytes(int64_t *aTotalBytes)
NS_IMETHODIMP nsVolumeStat::GetTotalBytes(int64_t* aTotalBytes)
{
*aTotalBytes = mStat.f_blocks * mStat.f_bsize;
return NS_OK;
}
/* readonly attribute long long freeBytes; */
NS_IMETHODIMP nsVolumeStat::GetFreeBytes(int64_t *aFreeBytes)
NS_IMETHODIMP nsVolumeStat::GetFreeBytes(int64_t* aFreeBytes)
{
*aFreeBytes = mStat.f_bfree * mStat.f_bsize;
return NS_OK;

Просмотреть файл

@ -18,7 +18,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIVOLUMESTAT
nsVolumeStat(const nsAString &aPath);
nsVolumeStat(const nsAString& aPath);
private:
~nsVolumeStat();