зеркало из https://github.com/mozilla/gecko-dev.git
Bug 825762 - Replace VFAT reserved character with '_' to avoid file-transferring failure, r=qdot
This commit is contained in:
Родитель
25904c460c
Коммит
bf9fbe58e5
|
@ -621,6 +621,28 @@ BluetoothOppManager::ExtractBlobHeaders()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothOppManager::IsReservedChar(PRUnichar c)
|
||||
{
|
||||
return (c < 0x0020 ||
|
||||
c == PRUnichar('?') || c == PRUnichar('|') || c == PRUnichar('<') ||
|
||||
c == PRUnichar('>') || c == PRUnichar('"') || c == PRUnichar(':') ||
|
||||
c == PRUnichar('/') || c == PRUnichar('*') || c == PRUnichar('\\'));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::ValidateFileName()
|
||||
{
|
||||
int length = sFileName.Length();
|
||||
|
||||
for (int i = 0; i < length; ++i) {
|
||||
// Replace reserved char of fat file system with '_'
|
||||
if (IsReservedChar(sFileName.CharAt(i))) {
|
||||
sFileName.Replace(i, 1, PRUnichar('_'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
{
|
||||
|
@ -707,6 +729,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
|||
mReceivedDataBufferOffset,
|
||||
&pktHeaders);
|
||||
ExtractPacketHeaders(pktHeaders);
|
||||
ValidateFileName();
|
||||
|
||||
mReceivedDataBufferOffset = 0;
|
||||
|
||||
|
|
|
@ -87,6 +87,9 @@ private:
|
|||
void AfterOppConnected();
|
||||
void AfterFirstPut();
|
||||
void AfterOppDisconnected();
|
||||
void ValidateFileName();
|
||||
bool IsReservedChar(PRUnichar c);
|
||||
|
||||
virtual void OnConnectSuccess() MOZ_OVERRIDE;
|
||||
virtual void OnConnectError() MOZ_OVERRIDE;
|
||||
virtual void OnDisconnect() MOZ_OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче