PVS-StudioWarnings

PVS-Studio warning V631 for ffdshow

Nov 11th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. STDMETHODIMP TmyWriterSink::OnHeader(INSSBuffer *pHeader)
  2. {
  3.   if (!f) f=fopen("c:\\2.wmv","wb");
  4.   BYTE *buf; DWORD len;
  5.   pHeader->GetBufferAndLength(&buf,&len);
  6.   fwrite(buf,1,len,f);
  7.   return S_OK;
  8. }
  9.  
  10. Even if this was written just for the purpose of debugging, you'd better not do it that way. Other programmers may have troubles working with it.
  11.  
  12. This suspicious code was found in ffdshow project by PVS-Studio static code analyzer.
  13. Warning message is:
  14. V631 Consider inspecting the 'fopen' function call. Defining an absolute path to the file or directory is considered a poor style. writersink.cpp 13
  15.  
  16. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment