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
|
||||
* 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)
|
||||
{
|
||||
size_t length = strlen(fileNameUTF8);
|
||||
if (length > kMaxFileNameSize)
|
||||
if (length > kMaxFileNameSize - 1)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
@ -64,15 +64,19 @@ ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
|
||||
_dead(true),
|
||||
_prio(prio),
|
||||
_event(EventWrapper::Create()),
|
||||
_setThreadName(false)
|
||||
{
|
||||
_name(),
|
||||
_setThreadName(false),
|
||||
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
||||
_pid = -1;
|
||||
_pid(-1),
|
||||
#endif
|
||||
_attr(),
|
||||
_thread(NULL)
|
||||
{
|
||||
if (threadName != NULL)
|
||||
{
|
||||
_setThreadName = true;
|
||||
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
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -57,11 +57,11 @@ private:
|
||||
bool _setThreadName;
|
||||
|
||||
// handle to thread
|
||||
pthread_attr_t _attr;
|
||||
pthread_t _thread;
|
||||
#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID))
|
||||
pid_t _pid;
|
||||
#endif
|
||||
pthread_attr_t _attr;
|
||||
pthread_t _thread;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user