From 9aceaadbccaf3f42137234d7c285eb174ab59702 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Thu, 4 Apr 2013 03:19:50 -0400 Subject: [PATCH] Some small code cleanups via static analysis (cppcheck) --- DShowPlugin/MediaInfoStuff.cpp | 8 ++++---- OBSApi/GraphicsSystem.h | 1 + OBSApi/Utility/Profiler.cpp | 6 +++--- OBSApi/Utility/Template.h | 1 + OBSApi/Utility/XFile.h | 2 ++ OBSApi/Utility/XString.cpp | 6 +----- OBSApi/Utility/XString.h | 1 + OBSApi/VolumeMeter.cpp | 15 ++++++++------- Source/API.cpp | 1 + Source/BitmapTransitionSource.cpp | 4 ++-- Source/CodeTokenizer.cpp | 3 --- Source/CrashDumpHandler.cpp | 5 ++--- Source/D3D10ShaderProcessor.cpp | 5 +---- Source/D3D10System.cpp | 3 --- Source/D3D10Texture.cpp | 7 ++----- Source/DesktopImageSource.cpp | 6 +----- Source/Encoder_MP3.cpp | 3 --- Source/Encoder_x264.cpp | 2 -- Source/OBSCapture.cpp | 8 ++++---- Source/OBSVideoCapture.cpp | 7 ++----- Source/RTMPPublisher.cpp | 24 +++++++++++++++--------- Source/RTMPPublisher.h | 2 +- Source/RTMPStuff.cpp | 6 +++--- Source/SettingsEncoding.cpp | 2 +- Source/SettingsVideo.cpp | 7 ++----- Source/TextOutputSource.cpp | 2 +- Source/Updater.cpp | 9 +++++---- Source/WindowStuff.cpp | 13 +++---------- 28 files changed, 67 insertions(+), 92 deletions(-) diff --git a/DShowPlugin/MediaInfoStuff.cpp b/DShowPlugin/MediaInfoStuff.cpp index 994e69f7..9e016554 100644 --- a/DShowPlugin/MediaInfoStuff.cpp +++ b/DShowPlugin/MediaInfoStuff.cpp @@ -34,10 +34,10 @@ void WINAPI FreeMediaType(AM_MEDIA_TYPE& mt) HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource) { - *pmtTarget = *pmtSource; - if(!pmtSource || !pmtTarget) return S_FALSE; + *pmtTarget = *pmtSource; + if(pmtSource->cbFormat && pmtSource->pbFormat) { pmtTarget->pbFormat = (PBYTE)CoTaskMemAlloc(pmtSource->cbFormat); @@ -195,7 +195,7 @@ bool GetVideoOutputTypes(const List &outputList, UINT width, UI for(UINT i=0; i(outputInfo.mediaType->pbFormat); + //VIDEOINFOHEADER *pVih = reinterpret_cast(outputInfo.mediaType->pbFormat); if( outputInfo.minCX <= width && outputInfo.maxCX >= width && outputInfo.minCY <= height && outputInfo.maxCY >= height && @@ -223,7 +223,7 @@ MediaOutputInfo* GetBestMediaOutput(const List &outputList, UIN for(UINT i=0; i(outputInfo.mediaType->pbFormat); + //VIDEOINFOHEADER *pVih = reinterpret_cast(outputInfo.mediaType->pbFormat); if( outputInfo.minCX <= width && outputInfo.maxCX >= width && outputInfo.minCY <= height && outputInfo.maxCY >= height) diff --git a/OBSApi/GraphicsSystem.h b/OBSApi/GraphicsSystem.h index 9c414eaf..15d43a71 100644 --- a/OBSApi/GraphicsSystem.h +++ b/OBSApi/GraphicsSystem.h @@ -118,6 +118,7 @@ struct VBData if(s.IsLoading()) { + //FIXME: ??? s << dwSize; UVList.SetSize(dwSize); } diff --git a/OBSApi/Utility/Profiler.cpp b/OBSApi/Utility/Profiler.cpp index 4f06e599..7495e870 100644 --- a/OBSApi/Utility/Profiler.cpp +++ b/OBSApi/Utility/Profiler.cpp @@ -145,13 +145,13 @@ BOOL bProfilingEnabled = FALSE; HANDLE hProfilerTimer = NULL; -void STDCALL EnableProfiling(BOOL bEnable, float minPercentage, float minTime) +void STDCALL EnableProfiling(BOOL bEnable, float pminPercentage, float pminTime) { //if(engine && !engine->InEditor()) bProfilingEnabled = bEnable; - minPercentage = minPercentage; - minTime = minTime; + minPercentage = pminPercentage; + minTime = pminTime; } void STDCALL DumpProfileData() diff --git a/OBSApi/Utility/Template.h b/OBSApi/Utility/Template.h index 851830a8..3f268127 100644 --- a/OBSApi/Utility/Template.h +++ b/OBSApi/Utility/Template.h @@ -448,6 +448,7 @@ public: { if(s.IsLoading()) { + //FIXME: ??? UINT num; s << num; list.SetSize(num); diff --git a/OBSApi/Utility/XFile.h b/OBSApi/Utility/XFile.h index 7f6a51d2..7a7a530b 100644 --- a/OBSApi/Utility/XFile.h +++ b/OBSApi/Utility/XFile.h @@ -143,6 +143,8 @@ public: ret = file.SetPos(INT64(GetPos())+offset, XFILE_BEGIN); else if(seekType == SERIALIZE_SEEK_END) ret = file.SetPos(offset, XFILE_END); + else + return 0; Cache(); diff --git a/OBSApi/Utility/XString.cpp b/OBSApi/Utility/XString.cpp index 715a8251..a2073364 100644 --- a/OBSApi/Utility/XString.cpp +++ b/OBSApi/Utility/XString.cpp @@ -334,8 +334,6 @@ String& String::operator+=(const String &str) lpString = (TSTR)Allocate((curLength+1)*sizeof(TCHAR)); scpy(lpString, str.lpString); } - - int strlenthingy = slen(lpString); } else { @@ -661,7 +659,6 @@ String String::GetToken(int id, TCHAR token) const void String::GetTokenList(StringList &strList, TCHAR token, BOOL bIncludeEmpty) const { TSTR lpTemp = lpString; - UINT curTokenID = 0; do { @@ -976,6 +973,7 @@ Serializer& operator<<(Serializer &s, String &str) { if(s.IsLoading()) { + //FIXME: ??? UINT utf8Length; s << utf8Length; @@ -1011,7 +1009,6 @@ BOOL STDCALL ValidFloatString(CTSTR lpStr) BOOL bFoundDecimal = FALSE; BOOL bFoundExp = FALSE; - BOOL bFoundEndThingy = FALSE; if((*lpStr == '-') || (*lpStr == '+')) ++lpStr; @@ -1053,7 +1050,6 @@ BOOL STDCALL ValidFloatString(CTSTR lpStr) if(*++lpStr != 0) return FALSE; - bFoundEndThingy = TRUE; break; } else if((*lpStr > '9') || (*lpStr < '0')) diff --git a/OBSApi/Utility/XString.h b/OBSApi/Utility/XString.h index e991effd..b8fef641 100644 --- a/OBSApi/Utility/XString.h +++ b/OBSApi/Utility/XString.h @@ -544,6 +544,7 @@ public: { if(s.IsLoading()) { + //FIXME: ??? UINT num; s << num; list.SetSize(num); diff --git a/OBSApi/VolumeMeter.cpp b/OBSApi/VolumeMeter.cpp index 5efef446..7713ce8f 100644 --- a/OBSApi/VolumeMeter.cpp +++ b/OBSApi/VolumeMeter.cpp @@ -117,15 +117,16 @@ LRESULT CALLBACK VolumeMeterProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM { meter = GetVolumeMeterData(hwnd); - DeleteObject(meter->hRed); - DeleteObject(meter->hGreen); - DeleteObject(meter->hGreenDark); - DeleteObject(meter->hBlack); - DeleteObject(meter->hGray); - DeleteObject(meter->hLightGray); - if(meter) + { + DeleteObject(meter->hRed); + DeleteObject(meter->hGreen); + DeleteObject(meter->hGreenDark); + DeleteObject(meter->hBlack); + DeleteObject(meter->hGray); + DeleteObject(meter->hLightGray); free(meter); + } break; } diff --git a/Source/API.cpp b/Source/API.cpp index 83a64048..f09242d7 100644 --- a/Source/API.cpp +++ b/Source/API.cpp @@ -581,6 +581,7 @@ UINT OBSAPIInterface::CreateHotkey(DWORD hotkey, OBSHOTKEYPROC hotkeyProc, UPARA if(!hotkey) return 0; + //FIXME: vk and fsModifiers aren't used? DWORD vk = LOBYTE(hotkey); DWORD modifier = HIBYTE(hotkey); DWORD fsModifiers = 0; diff --git a/Source/BitmapTransitionSource.cpp b/Source/BitmapTransitionSource.cpp index b9e74d6b..dfd46b43 100644 --- a/Source/BitmapTransitionSource.cpp +++ b/Source/BitmapTransitionSource.cpp @@ -513,11 +513,11 @@ bool STDCALL ConfigureBitmapTransitionSource(XElement *element, bool bCreating) configInfo.data = data; return (DialogBoxParam(hinstMain, MAKEINTRESOURCE(IDD_CONFIGURETRANSITIONSOURCE), hwndMain, ConfigureBitmapTransitionProc, (LPARAM)&configInfo) == IDOK); - { + /*{ element->SetInt(TEXT("cx"), configInfo.cx); element->SetInt(TEXT("cy"), configInfo.cy); return true; } - return false; + return false;*/ } diff --git a/Source/CodeTokenizer.cpp b/Source/CodeTokenizer.cpp index 19ca7fb2..4c95cca3 100644 --- a/Source/CodeTokenizer.cpp +++ b/Source/CodeTokenizer.cpp @@ -266,7 +266,6 @@ BOOL CodeTokenizer::GetNextTokenEval(String &token, BOOL *bFloatOccurance, int c TSTR lpLastSafePos = lpTemp; String curVal, curToken; BOOL bFoundNumber = FALSE; - BOOL bUsedBracers = FALSE; if(!GetNextToken(curToken)) return FALSE; @@ -291,8 +290,6 @@ BOOL CodeTokenizer::GetNextTokenEval(String &token, BOOL *bFloatOccurance, int c token = TEXT("("); return TRUE; } - - bUsedBracers = TRUE; } if(curToken == TEXT("-") && iswdigit(*lpTemp)) diff --git a/Source/CrashDumpHandler.cpp b/Source/CrashDumpHandler.cpp index 251dec82..54f0c8f7 100644 --- a/Source/CrashDumpHandler.cpp +++ b/Source/CrashDumpHandler.cpp @@ -57,7 +57,7 @@ LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo) SYMBOL_INFO *symInfo; DWORD64 fnOffset; TCHAR logPath[MAX_PATH]; - TCHAR dumpPath[MAX_PATH]; + OSVERSIONINFOEX osInfo; SYSTEMTIME timeInfo; @@ -76,8 +76,6 @@ LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo) DWORD64 InstructionPtr; DWORD imageType; - BOOL wantUpload = TRUE; - TCHAR searchPath[MAX_PATH], *p; static BOOL inExceptionHandler = FALSE; @@ -296,6 +294,7 @@ LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo) //generate a minidump if possible if (fnMiniDumpWriteDump) { + TCHAR dumpPath[MAX_PATH]; HANDLE hFile; tsprintf_s (dumpPath, _countof(dumpPath)-1, TEXT("%s\\crashDumps\\OBSCrashDump%.4d-%.2d-%.2d_%d.dmp"), lpAppDataPath, timeInfo.wYear, timeInfo.wMonth, timeInfo.wDay, i); diff --git a/Source/D3D10ShaderProcessor.cpp b/Source/D3D10ShaderProcessor.cpp index 34cdd2cb..95927289 100644 --- a/Source/D3D10ShaderProcessor.cpp +++ b/Source/D3D10ShaderProcessor.cpp @@ -231,8 +231,7 @@ BOOL ShaderProcessor::ProcessShader(CTSTR input) TSTR lpSavedPos = lpTemp; String savedToken = curToken; - BOOL bUniform; - if(bUniform = (curToken == TEXT("uniform"))) + if(curToken == TEXT("uniform")) HandMeAToken(curToken); String strType = curToken; @@ -284,8 +283,6 @@ BOOL ShaderProcessor::ProcessShader(CTSTR input) } else { - UINT paramID = Params.Num(); - ShaderParam *param = Params.CreateNew(); param->name = strName; diff --git a/Source/D3D10System.cpp b/Source/D3D10System.cpp index 0f4e3bef..e9731d25 100644 --- a/Source/D3D10System.cpp +++ b/Source/D3D10System.cpp @@ -23,7 +23,6 @@ void GetDisplayDevices(DeviceOutputs &deviceList) { HRESULT err; - UINT count = 0; deviceList.ClearData(); @@ -453,8 +452,6 @@ void D3D10System::LoadVertexBuffer(VertexBuffer* vb) { if(vb != curVertexBuffer) { - UINT offset = 0; - D3D10VertexBuffer *d3dVB = static_cast(vb); if(curVertexShader) { diff --git a/Source/D3D10Texture.cpp b/Source/D3D10Texture.cpp index d7b4853f..acac47b3 100644 --- a/Source/D3D10Texture.cpp +++ b/Source/D3D10Texture.cpp @@ -392,7 +392,6 @@ Texture* D3D10Texture::CreateGDITexture(unsigned int width, unsigned int height) td.Usage = D3D10_USAGE_DEFAULT; td.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE; - LPBYTE lpData = NULL; D3D10_SUBRESOURCE_DATA srd; zero(&srd, sizeof(srd)); @@ -509,7 +508,7 @@ void CopyPackedRGB(BYTE *lpDest, BYTE *lpSource, UINT nPixels) DWORD *lpDWDest = (DWORD*)lpDest; DWORD *lpDWSrc = (DWORD*)lpSource; - DWORD *lpEnd = (DWORD*)(lpSource+alignedBytes); + while(nDWords) { switch(curComponent) @@ -557,7 +556,7 @@ void D3D10Texture::SetImage(void *lpData, GSImageFormat imageFormat, UINT pitch) } bool bMatchingFormat = false; - UINT pixelBytes = 0; + UINT pixelBytes = 0; //What is this needed for? switch(format) { @@ -605,8 +604,6 @@ void D3D10Texture::SetImage(void *lpData, GSImageFormat imageFormat, UINT pitch) //------------------------------------------------------------------------- else { - UINT rowWidth = width*pixelBytes; - if(pitch == map.RowPitch) { if(App->SSE2Available()) diff --git a/Source/DesktopImageSource.cpp b/Source/DesktopImageSource.cpp index e556b7d0..a9bc0b55 100644 --- a/Source/DesktopImageSource.cpp +++ b/Source/DesktopImageSource.cpp @@ -132,8 +132,6 @@ public: if(duplicator) { - Texture *newTex = NULL; - switch(duplicator->AquireNextFrame(0)) { case DuplicatorInfo_Lost: @@ -276,7 +274,7 @@ public: bMouseCaptured = bCaptureMouse && GetCursorInfo(&ci); - bool bWindowMinimized = false, bWindowNotFound = false; + bool bWindowNotFound = false; HWND hwndCapture = NULL; if(captureType == 1) { @@ -720,8 +718,6 @@ void RefreshWindowList(HWND hwndCombobox, StringList &classList) RECT clientRect; GetClientRect(hwndCurrent, &clientRect); - HWND hwndParent = GetParent(hwndCurrent); - DWORD exStyles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_EXSTYLE); DWORD styles = (DWORD)GetWindowLongPtr(hwndCurrent, GWL_STYLE); diff --git a/Source/Encoder_MP3.cpp b/Source/Encoder_MP3.cpp index 3a0840be..0102a4b8 100644 --- a/Source/Encoder_MP3.cpp +++ b/Source/Encoder_MP3.cpp @@ -105,11 +105,8 @@ public: curEncodeTimestamp = timestamp + ((outputFrameSize-lastSampleSize)*10/441); } - int framenum1 = lame_get_frameNum(lgf); int ret = lame_encode_buffer_interleaved_ieee_float(lgf, (float*)input, numInputFrames, MP3OutputBuffer.Array()+1, dwMP3MaxSize); - int framesEncoded = lame_get_frameNum(lgf)-framenum1; - if(ret < 0) { AppWarning(TEXT("MP3 encode failed")); diff --git a/Source/Encoder_x264.cpp b/Source/Encoder_x264.cpp index ef3cf0ec..0575c869 100644 --- a/Source/Encoder_x264.cpp +++ b/Source/Encoder_x264.cpp @@ -56,8 +56,6 @@ const float baseCRF = 22.0f; bool valid_x264_string(const String &str, const char **x264StringList) { - bool bValidString = false; - do { if(str.CompareI(String(*x264StringList))) diff --git a/Source/OBSCapture.cpp b/Source/OBSCapture.cpp index 3d4f9730..32afe6ec 100644 --- a/Source/OBSCapture.cpp +++ b/Source/OBSCapture.cpp @@ -372,11 +372,12 @@ void OBS::Start() { String strFileExtension = GetPathExtension(strOutputFile); String strFileWithoutExtension = GetPathWithoutExtension(strOutputFile); - UINT curFile = 0; if(strFileExtension.IsValid() && !ofd.bDirectory) { String strNewFilePath; + UINT curFile = 0; + do { strNewFilePath.Clear() << strFileWithoutExtension << TEXT(" (") << FormattedString(TEXT("%02u"), ++curFile) << TEXT(").") << strFileExtension; @@ -806,11 +807,10 @@ bool OBS::QueryNewAudio(QWORD ×tamp) { bool bNewAudio = false; - UINT audioRet; timestamp = INVALID_LL; QWORD desktopTimestamp; - while((audioRet = desktopAudio->QueryAudio(curDesktopVol)) != NoAudioAvailable) + while((desktopAudio->QueryAudio(curDesktopVol)) != NoAudioAvailable) { bNewAudio = true; @@ -832,7 +832,7 @@ bool OBS::QueryNewAudio(QWORD ×tamp) if(micAudio) { - while((audioRet = micAudio->QueryAudio(curMicVol)) != NoAudioAvailable); + while((micAudio->QueryAudio(curMicVol)) != NoAudioAvailable); } } diff --git a/Source/OBSVideoCapture.cpp b/Source/OBSVideoCapture.cpp index e874c548..a4865121 100644 --- a/Source/OBSVideoCapture.cpp +++ b/Source/OBSVideoCapture.cpp @@ -257,8 +257,6 @@ void OBS::MainCaptureLoop() HANDLE hScaleVal = yuvScalePixelShader->GetParameterByName(TEXT("baseDimensionI")); - LPVOID nullBuff = NULL; - //---------------------------------------- // x264 input buffers @@ -299,6 +297,7 @@ void OBS::MainCaptureLoop() bool bWasLaggedFrame = false; #else DWORD streamTimeStart = OSGetTime(); + DWORD fpsTimeAdjust = 0; #endif totalStreamTime = 0; @@ -308,8 +307,6 @@ void OBS::MainCaptureLoop() DWORD fpsTimeNumerator = 1000-(frameTime*fps); DWORD fpsTimeDenominator = fps; - DWORD fpsTimeAdjust = 0; - DWORD cfrTime = 0; DWORD cfrTimeAdjust = 0; @@ -399,7 +396,7 @@ void OBS::MainCaptureLoop() lastStreamTime = firstFrameTime-frameTime; #endif - bool bFirstAudioPacket = true; + //bool bFirstAudioPacket = true; while(bRunning) { diff --git a/Source/RTMPPublisher.cpp b/Source/RTMPPublisher.cpp index 0afd00ea..7e347396 100644 --- a/Source/RTMPPublisher.cpp +++ b/Source/RTMPPublisher.cpp @@ -240,7 +240,6 @@ RTMPPublisher::~RTMPPublisher() queuedPackets[i].data.Clear(); queuedPackets.Clear(); - double dTotalFrames = double(totalFrames); double dBFrameDropPercentage = double(numBFramesDumped)/NumTotalVideoFrames()*100.0; double dPFrameDropPercentage = double(numPFramesDumped)/NumTotalVideoFrames()*100.0; @@ -355,7 +354,8 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp bConnecting = true; } - if (bFirstKeyframe) { + if (bFirstKeyframe) + { if (!bConnected || type != PacketType_VideoHighest) return; @@ -363,8 +363,10 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp bFirstKeyframe = false; } - if (bufferedPackets.Num() == MAX_BUFFERED_PACKETS) { - if (!bBufferFull) { + if (bufferedPackets.Num() == MAX_BUFFERED_PACKETS) + { + if (!bBufferFull) + { InitializeBuffer(); bBufferFull = true; } @@ -379,13 +381,17 @@ void RTMPPublisher::SendPacket(BYTE *data, UINT size, DWORD timestamp, PacketTyp timestamp -= firstTimestamp; TimedPacket *packet; - UINT newID; - if (type == PacketType_Audio) { + + if (type == PacketType_Audio) + { + UINT newID; timestamp -= audioTimeOffset; newID = FindClosestBufferIndex(timestamp); packet = bufferedPackets.InsertNew(newID); - } else { + } + else + { packet = bufferedPackets.CreateNew(); } @@ -773,12 +779,12 @@ end: double RTMPPublisher::GetPacketStrain() const { return (curDataBufferLen / (double)dataBufferSize) * 100.0; - if(packetWaitType >= PacketType_VideoHigh) + /*if(packetWaitType >= PacketType_VideoHigh) return min(100.0, dNetworkStrain*100.0); else if(bNetworkStrain) return dNetworkStrain*66.0; - return dNetworkStrain*33.0; + return dNetworkStrain*33.0;*/ } QWORD RTMPPublisher::GetCurrentSentBytes() diff --git a/Source/RTMPPublisher.h b/Source/RTMPPublisher.h index cde6b847..a8d56f7f 100644 --- a/Source/RTMPPublisher.h +++ b/Source/RTMPPublisher.h @@ -131,7 +131,7 @@ protected: void SendLoop(); void SocketLoop(); - int RTMPPublisher::FlushDataBuffer(); + int FlushDataBuffer(); static DWORD SendThread(RTMPPublisher *publisher); static DWORD SocketThread(RTMPPublisher *publisher); diff --git a/Source/RTMPStuff.cpp b/Source/RTMPStuff.cpp index 441a9931..0a2d3055 100644 --- a/Source/RTMPStuff.cpp +++ b/Source/RTMPStuff.cpp @@ -222,20 +222,20 @@ char* OBS::EncMetaData(char *enc, char *pend, bool bFLVFile) int audioBitRate = GetAudioEncoder()->GetBitRate(); CTSTR lpAudioCodec = GetAudioEncoder()->GetCodec(); - double audioCodecID; + //double audioCodecID; const AVal *av_codecFourCC; #ifdef USE_AAC if(scmpi(lpAudioCodec, TEXT("AAC")) == 0) { av_codecFourCC = &av_mp4a; - audioCodecID = 10.0; + //audioCodecID = 10.0; } else #endif { av_codecFourCC = &av_mp3; - audioCodecID = 2.0; + //audioCodecID = 2.0; } if(bFLVFile) diff --git a/Source/SettingsEncoding.cpp b/Source/SettingsEncoding.cpp index 73750106..b27c3225 100644 --- a/Source/SettingsEncoding.cpp +++ b/Source/SettingsEncoding.cpp @@ -60,7 +60,7 @@ void SettingsEncoding::ApplySettings() AppConfig->SetInt(TEXT("Video Encoding"), TEXT("MaxBitrate"), bitrate); UINT bufSize = GetEditText(GetDlgItem(hwnd, IDC_BUFFERSIZE)).ToInt(); - if(bufSize < 100) bitrate = bufSize; + //if(bufSize < 100) bufSize = bitrate; //R1CH: Allow users to enter 0 buffer size to disable VBV, its protected by checkbox anyway AppConfig->SetInt(TEXT("Video Encoding"), TEXT("BufferSize"), bufSize); String strTemp = GetCBText(GetDlgItem(hwnd, IDC_AUDIOCODEC)); diff --git a/Source/SettingsVideo.cpp b/Source/SettingsVideo.cpp index ba915f3d..5fb6ca76 100644 --- a/Source/SettingsVideo.cpp +++ b/Source/SettingsVideo.cpp @@ -141,11 +141,11 @@ void SettingsVideo::RefreshFilters(HWND hwndParent, bool bGetConfig) if(bGetConfig) curFilter = AppConfig->GetInt(TEXT("Video"), TEXT("Filter"), 0); else - curFilter = (int)SendMessage(GetDlgItem(hwnd, IDC_FILTER), CB_GETCURSEL, 0, 0); + curFilter = (int)SendMessage(hwndFilter, CB_GETCURSEL, 0, 0); float downscale = 1.0f; - int curSel = (int)SendMessage(GetDlgItem(hwnd, IDC_DOWNSCALE), CB_GETCURSEL, 0, 0); + int curSel = (int)SendMessage(hwndDownscale, CB_GETCURSEL, 0, 0); if(curSel != CB_ERR) downscale = downscaleMultipliers[curSel]; @@ -411,9 +411,6 @@ INT_PTR SettingsVideo::ProcMessage(UINT message, WPARAM wParam, LPARAM lParam) if(HIWORD(wParam) != EN_CHANGE) break; - String strInt = GetEditText((HWND)lParam); - int iVal = strInt.ToInt(); - int cx = GetEditText(GetDlgItem(hwnd, IDC_SIZEX)).ToInt(); int cy = GetEditText(GetDlgItem(hwnd, IDC_SIZEY)).ToInt(); diff --git a/Source/TextOutputSource.cpp b/Source/TextOutputSource.cpp index a34d1135..2219a8b6 100644 --- a/Source/TextOutputSource.cpp +++ b/Source/TextOutputSource.cpp @@ -731,7 +731,7 @@ void DoCancelStuff(HWND hwnd) { ConfigTextSourceInfo *configInfo = (ConfigTextSourceInfo*)GetWindowLongPtr(hwnd, DWLP_USER); ImageSource *source = API->GetSceneImageSource(configInfo->lpName); - XElement *data = configInfo->data; + //XElement *data = configInfo->data; if(source) source->UpdateSettings(); diff --git a/Source/Updater.cpp b/Source/Updater.cpp index e929a11a..7c930b02 100644 --- a/Source/Updater.cpp +++ b/Source/Updater.cpp @@ -51,7 +51,6 @@ VOID GenerateGUID(String &strGUID) BOOL CalculateFileHash (TCHAR *path, BYTE *hash) { - BYTE buff[65536]; HCRYPTHASH hHash; if (!CryptCreateHash(hProvider, CALG_SHA1, 0, 0, &hHash)) @@ -61,6 +60,8 @@ BOOL CalculateFileHash (TCHAR *path, BYTE *hash) if (file.Open(path, XFILE_READ, OPEN_EXISTING)) { + BYTE buff[65536]; + for (;;) { DWORD read = file.Read(buff, sizeof(buff)); @@ -226,11 +227,11 @@ BOOL ParseUpdateManifest (TCHAR *path, BOOL *updatesAvailable, String &descripti filePath << path; filePath << fileName; - BYTE fileHash[20]; - TCHAR fileHashString[41]; - if (OSFileExists(filePath)) { + BYTE fileHash[20]; + TCHAR fileHashString[41]; + if (!CalculateFileHash(filePath, fileHash)) continue; diff --git a/Source/WindowStuff.cpp b/Source/WindowStuff.cpp index fae36847..29c65f67 100644 --- a/Source/WindowStuff.cpp +++ b/Source/WindowStuff.cpp @@ -914,7 +914,6 @@ LRESULT CALLBACK OBS::ListboxHook(HWND hwnd, UINT message, WPARAM wParam, LPARAM void OBS::DeleteItems() { HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); - UINT numSelected = ListView_GetSelectedCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources); List selectedSceneItems; @@ -987,7 +986,6 @@ void OBS::DeleteItems() void OBS::SetSourceOrder(StringList &sourceNames) { HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); - UINT numSelected = ListView_GetSelectedCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources); if(numItems == 0) @@ -1042,7 +1040,6 @@ void OBS::SetSourceOrder(StringList &sourceNames) void OBS::MoveSourcesUp() { HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); - UINT numSelected = ListView_GetSelectedCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources); UINT focusedItem = -1, selectionMark; @@ -1184,7 +1181,6 @@ void OBS::MoveSourcesDown() void OBS::MoveSourcesToTop() { HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); - UINT numSelected = ListView_GetSelectedCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources); UINT focusedItem = -1, selectionMark; @@ -1259,7 +1255,6 @@ void OBS::MoveSourcesToTop() void OBS::MoveSourcesToBottom() { HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES); - UINT numSelected = ListView_GetSelectedCount(hwndSources); int numItems = ListView_GetItemCount(hwndSources); UINT focusedItem = -1, selectionMark; @@ -2278,7 +2273,7 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_NOTIFY: { NMHDR nmh = *(LPNMHDR)lParam; - static bool bHighlighted; + switch(wParam) { case ID_SOURCES: @@ -2473,10 +2468,10 @@ LRESULT CALLBACK OBS::OBSProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa int newWidth = MAX(screenSize.right - screenSize.left, minClientWidth+App->borderXSize); int newHeight = MAX(screenSize.bottom - screenSize.top , minClientHeight+App->borderYSize); - int maxCX = GetSystemMetrics(SM_CXFULLSCREEN); + /*int maxCX = GetSystemMetrics(SM_CXFULLSCREEN); int maxCY = GetSystemMetrics(SM_CYFULLSCREEN); - /*if(newWidth > maxCX) + if(newWidth > maxCX) newWidth = maxCX; if(newHeight > maxCY) newHeight = maxCY;*/ @@ -2839,8 +2834,6 @@ LRESULT CALLBACK OBS::RenderFrameProc(HWND hwnd, UINT message, WPARAM wParam, LP List items; App->scene->GetSelectedItems(items); - bool bInside = false; - App->scaleItem = NULL; App->modifyType = ItemModifyType_None;