Fixes coverity warnings in system_wrappers.
Review URL: https://webrtc-codereview.appspot.com/389003 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1645 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
0e7c060256
commit
143abd95a3
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -118,7 +118,7 @@ int FileWrapperImpl::OpenFile(const char *fileNameUTF8, bool readOnly,
|
|||||||
bool loop, bool text)
|
bool loop, bool text)
|
||||||
{
|
{
|
||||||
size_t length = strlen(fileNameUTF8);
|
size_t length = strlen(fileNameUTF8);
|
||||||
if (length > kMaxFileNameSize)
|
if (length > kMaxFileNameSize - 1)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -64,15 +64,19 @@ ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
|
|||||||
_dead(true),
|
_dead(true),
|
||||||
_prio(prio),
|
_prio(prio),
|
||||||
_event(EventWrapper::Create()),
|
_event(EventWrapper::Create()),
|
||||||
_setThreadName(false)
|
_name(),
|
||||||
{
|
_setThreadName(false),
|
||||||
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
||||||
_pid = -1;
|
_pid(-1),
|
||||||
#endif
|
#endif
|
||||||
|
_attr(),
|
||||||
|
_thread(NULL)
|
||||||
|
{
|
||||||
if (threadName != NULL)
|
if (threadName != NULL)
|
||||||
{
|
{
|
||||||
_setThreadName = true;
|
_setThreadName = true;
|
||||||
strncpy(_name, threadName, kThreadMaxNameLength);
|
strncpy(_name, threadName, kThreadMaxNameLength);
|
||||||
|
_name[kThreadMaxNameLength - 1] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Use of this source code is governed by a BSD-style license
|
* Use of this source code is governed by a BSD-style license
|
||||||
* that can be found in the LICENSE file in the root of the source
|
* that can be found in the LICENSE file in the root of the source
|
||||||
@ -57,11 +57,11 @@ private:
|
|||||||
bool _setThreadName;
|
bool _setThreadName;
|
||||||
|
|
||||||
// handle to thread
|
// handle to thread
|
||||||
pthread_attr_t _attr;
|
|
||||||
pthread_t _thread;
|
|
||||||
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
||||||
pid_t _pid;
|
pid_t _pid;
|
||||||
#endif
|
#endif
|
||||||
|
pthread_attr_t _attr;
|
||||||
|
pthread_t _thread;
|
||||||
};
|
};
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user