do not assign in conditional statements
This commit is contained in:
parent
50f34f8b05
commit
9357cee2ef
|
@ -631,9 +631,9 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
|
||||||
// Returns the current directory
|
// Returns the current directory
|
||||||
std::string GetCurrentDir()
|
std::string GetCurrentDir()
|
||||||
{
|
{
|
||||||
char* dir;
|
|
||||||
// Get the current working directory (getcwd uses malloc)
|
// Get the current working directory (getcwd uses malloc)
|
||||||
if (!(dir = __getcwd(nullptr, 0)))
|
char* dir = __getcwd(nullptr, 0);
|
||||||
|
if (!dir)
|
||||||
{
|
{
|
||||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str());
|
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -248,8 +248,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pixel_format;
|
int pixel_format = ChoosePixelFormat(m_dc, &pfd);
|
||||||
if (!(pixel_format = ChoosePixelFormat(m_dc, &pfd)))
|
if (!pixel_format)
|
||||||
{
|
{
|
||||||
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
PanicAlert("(2) Can't find a suitable PixelFormat.");
|
||||||
return false;
|
return false;
|
||||||
|
@ -261,7 +261,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(m_rc = wglCreateContext(m_dc)))
|
m_rc = wglCreateContext(m_dc);
|
||||||
|
if (!m_rc)
|
||||||
{
|
{
|
||||||
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
PanicAlert("(4) Can't create an OpenGL rendering context.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -471,7 +471,8 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops)
|
||||||
std::transform(s.begin(), s.end(), s.begin(), toupper);
|
std::transform(s.begin(), s.end(), s.begin(), toupper);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ret = alphatobin(uCodes, vCodes, (int)vCodes.size())))
|
ret = alphatobin(uCodes, vCodes, (int)vCodes.size());
|
||||||
|
if (ret)
|
||||||
{
|
{
|
||||||
// Return value is index + 1, 0 being the success flag value.
|
// Return value is index + 1, 0 being the success flag value.
|
||||||
PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s",
|
PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s",
|
||||||
|
|
|
@ -146,11 +146,12 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
|
||||||
File::CreateFullPath(filename);
|
File::CreateFullPath(filename);
|
||||||
Profiler::WriteProfileResults(filename);
|
Profiler::WriteProfileResults(filename);
|
||||||
|
|
||||||
wxFileType* filetype = nullptr;
|
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension("txt");
|
||||||
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension("txt")))
|
if (!filetype)
|
||||||
{
|
{
|
||||||
// From extension failed, trying with MIME type now
|
// From extension failed, trying with MIME type now
|
||||||
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain")))
|
filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
|
||||||
|
if (!filetype)
|
||||||
// MIME type failed, aborting mission
|
// MIME type failed, aborting mission
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,27 +266,26 @@ static bool CheckDeviceAccess(libusb_device* device)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((ret = libusb_kernel_driver_active(s_handle, 0)) == 1)
|
else
|
||||||
{
|
{
|
||||||
if ((ret = libusb_detach_kernel_driver(s_handle, 0)) && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
ret = libusb_kernel_driver_active(s_handle, 0);
|
||||||
|
if (ret == 1)
|
||||||
{
|
{
|
||||||
ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret);
|
ret = libusb_detach_kernel_driver(s_handle, 0);
|
||||||
|
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
||||||
|
ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this split is needed so that we don't avoid claiming the interface when
|
// this split is needed so that we don't avoid claiming the interface when
|
||||||
// detaching the kernel driver is successful
|
// detaching the kernel driver is successful
|
||||||
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
else if ((ret = libusb_claim_interface(s_handle, 0)))
|
ret = libusb_claim_interface(s_handle, 0);
|
||||||
{
|
if (ret)
|
||||||
ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret);
|
ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,8 +159,9 @@ bool AVIDump::CreateVideoFile()
|
||||||
|
|
||||||
const AVCodec* codec = nullptr;
|
const AVCodec* codec = nullptr;
|
||||||
|
|
||||||
if (!(codec = avcodec_find_encoder(codec_id)) ||
|
codec = avcodec_find_encoder(codec_id);
|
||||||
!(s_codec_context = avcodec_alloc_context3(codec)))
|
s_codec_context = avcodec_alloc_context3(codec);
|
||||||
|
if (!codec || !s_codec_context)
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "Could not find encoder or allocate codec context");
|
ERROR_LOG(VIDEO, "Could not find encoder or allocate codec context");
|
||||||
return false;
|
return false;
|
||||||
|
@ -203,8 +204,8 @@ bool AVIDump::CreateVideoFile()
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(s_stream = avformat_new_stream(s_format_context, codec)) ||
|
s_stream = avformat_new_stream(s_format_context, codec);
|
||||||
!AVStreamCopyContext(s_stream, s_codec_context))
|
if (!s_stream || !AVStreamCopyContext(s_stream, s_codec_context))
|
||||||
{
|
{
|
||||||
ERROR_LOG(VIDEO, "Could not create stream");
|
ERROR_LOG(VIDEO, "Could not create stream");
|
||||||
return false;
|
return false;
|
||||||
|
@ -299,9 +300,10 @@ void AVIDump::AddFrame(const u8* data, int width, int height, int stride, const
|
||||||
s_src_frame->height = s_height;
|
s_src_frame->height = s_height;
|
||||||
|
|
||||||
// Convert image from {BGR24, RGBA} to desired pixel format
|
// Convert image from {BGR24, RGBA} to desired pixel format
|
||||||
if ((s_sws_context =
|
s_sws_context =
|
||||||
sws_getCachedContext(s_sws_context, width, height, s_pix_fmt, s_width, s_height,
|
sws_getCachedContext(s_sws_context, width, height, s_pix_fmt, s_width, s_height,
|
||||||
s_codec_context->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr)))
|
s_codec_context->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr);
|
||||||
|
if (s_sws_context)
|
||||||
{
|
{
|
||||||
sws_scale(s_sws_context, s_src_frame->data, s_src_frame->linesize, 0, height,
|
sws_scale(s_sws_context, s_src_frame->data, s_src_frame->linesize, 0, height,
|
||||||
s_scaled_frame->data, s_scaled_frame->linesize);
|
s_scaled_frame->data, s_scaled_frame->linesize);
|
||||||
|
|
Loading…
Reference in New Issue