ronantakizawa/codereview-bench huggingface dataset:
Repository: xbmc/xbmc
File: xbmc/XBDateTime.cpp (C++)

Code before:
#define SECONDS_TO_FILETIME 10000000L

static const char *DAY_NAMES[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char *MONTH_NAMES[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

/////////////////////////////////////////////////
//
// CDateTimeSpan
//

CDateTimeSpan::CDateTimeSpan()
{
  m_timeSpan.highDateTime = 0;
  m_timeSpan.lowDateTime = 0;
}

CDateTimeSpan::CDateTimeSpan(const CDateTimeSpan& span)
{
  m_timeSpan.highDateTime = span.m_timeSpan.highDateTime;
  m_timeSpan.lowDateTime = span.m_timeSpan.lowDateTime;
}

CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second)
{
  m_timeSpan.highDateTime = 0;
  m_timeSpan.lowDateTime = 0;
  SetDateTimeSpan(day, hour, minute, second);
}

bool CDateTimeSpan::operator >(const CDateTimeSpan& right) const
{
  return KODI::TIME::CompareFileTime(&m_timeSpan, &right.m_timeSpan) > 0;
}

bool CDateTimeSpan::operator >=(const CDateTimeSpan& right) const
{
  return operator >(right) || operator ==(right);
}

bool CDateTimeSpan::operator <(const CDateTimeSpan& right) const
{
  return KODI::TIME::CompareFileTime(&m_timeSpan, &right.m_timeSpan) < 0;
}

bool CDateTimeSpan::operator <=(const CDateTimeSpan& right) const
{
  return operator <(right) || operator ==(right);
}

bool CDateTimeSpan::operator ==(const CDateTimeSpan& right) const
{

Review comment (suggestion):
It's simpler to use a delegating constructor like this IMO:
```cpp
CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second) : CDateTimeSpan()
{
  SetDateTimeSpan(day, hour, minute, second);
}
```

Code after:
#define SECONDS_TO_FILETIME 10000000L

static const char *DAY_NAMES[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
static const char *MONTH_NAMES[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

/////////////////////////////////////////////////
//
// CDateTimeSpan
//

CDateTimeSpan::CDateTimeSpan()
{
  m_timeSpan.highDateTime = 0;
  m_timeSpan.lowDateTime = 0;
}

CDateTimeSpan::CDateTimeSpan(const CDateTimeSpan& span)
{
  m_timeSpan.highDateTime = span.m_timeSpan.highDateTime;
  m_timeSpan.lowDateTime = span.m_timeSpan.lowDateTime;
}

CDateTimeSpan::CDateTimeSpan(int day, int hour, int minute, int second) : CDateTimeSpan()
{
  SetDateTimeSpan(day, hour, minute, second);
}

bool CDateTimeSpan::operator >(const CDateTimeSpan& right) const
{
  return KODI::TIME::CompareFileTime(&m_timeSpan, &right.m_timeSpan) > 0;
}

bool CDateTimeSpan::operator >=(const CDateTimeSpan& right) const
{
  return operator >(right) || operator ==(right);
}

bool CDateTimeSpan::operator <(const CDateTimeSpan& right) const
{
  return KODI::TIME::CompareFileTime(&m_timeSpan, &right.m_timeSpan) < 0;
}

bool CDateTimeSpan::operator <=(const CDateTimeSpan& right) const
{
  return operator <(right) || operator ==(right);
}

bool CDateTimeSpan::operator ==(const CDateTimeSpan& right) const
{
  return KODI::TIME::CompareFileTime(&m_timeSpan, &right.m_timeSpan) == 0;
}
Repository: xbmc/xbmc
File: xbmc/dbwrappers/mysqldataset.cpp (C++)

Code before:

/*
** Initialize a string accumulator
*/
void MysqlDatabase::mysqlStrAccumInit(StrAccum* p, char* zBase, int n, int mx)
{
  p->zText = p->zBase = zBase;
  p->nChar = 0;
  p->nAlloc = n;
  p->mxAlloc = mx;
  p->tooBig = false;
  p->mallocFailed = false;
}

/*
** Print into memory obtained from mysql_malloc().  Omit the internal
** %-conversion extensions.
*/
std::string MysqlDatabase::mysql_vmprintf(const char* zFormat, va_list ap)
{
  char zBase[MYSQL_PRINT_BUF_SIZE];
  StrAccum acc;

  mysqlStrAccumInit(&acc, zBase, sizeof(zBase), MYSQL_MAX_LENGTH);
  mysqlVXPrintf(&acc, 0, zFormat, ap);
  std::string strResult = std::string(mysqlStrAccumFinish(&acc));
  // Free acc.zText to avoid memory leak.
  mysqlStrAccumReset(&acc);
  return strResult;
}

//************* MysqlDataset implementation ***************

MysqlDataset::MysqlDataset() : Dataset()
{
  haveError = false;
  db = NULL;
  autorefresh = false;
}

MysqlDataset::MysqlDataset(MysqlDatabase* newDb) : Dataset(newDb)
{
  haveError = false;
  db = newDb;
  autorefresh = false;
}

MysqlDataset::~MysqlDataset()
{
}


Review comment (suggestion):
```suggestion
  std::string strResult = mysqlStrAccumFinish(&acc);
```

Code after:

/*
** Initialize a string accumulator
*/
void MysqlDatabase::mysqlStrAccumInit(StrAccum* p, char* zBase, int n, int mx)
{
  p->zText = p->zBase = zBase;
  p->nChar = 0;
  p->nAlloc = n;
  p->mxAlloc = mx;
  p->tooBig = false;
  p->mallocFailed = false;
}

/*
** Print into memory obtained from mysql_malloc().  Omit the internal
** %-conversion extensions.
*/
std::string MysqlDatabase::mysql_vmprintf(const char* zFormat, va_list ap)
{
  char zBase[MYSQL_PRINT_BUF_SIZE];
  StrAccum acc;

  mysqlStrAccumInit(&acc, zBase, sizeof(zBase), MYSQL_MAX_LENGTH);
  mysqlVXPrintf(&acc, 0, zFormat, ap);
  std::string strResult = mysqlStrAccumFinish(&acc);
  // Free acc.zText to avoid memory leak.
  mysqlStrAccumReset(&acc);
  return strResult;
}

//************* MysqlDataset implementation ***************

MysqlDataset::MysqlDataset() : Dataset()
{
  haveError = false;
  db = NULL;
  autorefresh = false;
}

MysqlDataset::MysqlDataset(MysqlDatabase* newDb) : Dataset(newDb)
{
  haveError = false;
  db = newDb;
  autorefresh = false;
}

MysqlDataset::~MysqlDataset()
{
}
Repository: xbmc/xbmc
File: xbmc/windows/GUIMediaWindow.cpp (C++)

Code before:
    }
  }
}

void CGUIMediaWindow::OnDeleteItem(int iItem)
{
  if ( iItem < 0 || iItem >= m_vecItems->Size()) return;
  CFileItemPtr item = m_vecItems->Get(iItem);

  if (PLAYLIST::IsPlayList(*item))
    item->m_bIsFolder = false;

  const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();

  if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked())
  {
    if (!g_passwordManager.IsMasterLockUnlocked(true))
      return;
  }

  CGUIComponent *gui = CServiceBroker::GetGUI();

  bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
    CSettings::SETTING_FILELISTS_CONFIRMFILEDELETE);

  if (gui && (!confirm || gui->ConfirmDelete(item->GetPath())))
  {
    if (!CFileUtils::DeleteItem(item))
      return;
  }
  else
    return;

  Refresh(true);
  m_viewControl.SetSelectedItem(iItem);
}

void CGUIMediaWindow::OnRenameItem(int iItem)
{
  if (iItem < 0 || iItem >= m_vecItems->Size())
    return;

  const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();

  if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked())
  {
    if (!g_passwordManager.IsMasterLockUnlocked(true))
      return;
  }

  if (!CFileUtils::RenameFile(m_vecItems->Get(iItem)->GetPath()))

Review comment (bug):
No need to calculate `confirm` in case `gui`is `nullptr`. Move the calculation inside the `if (gui)` block, please.

Code after:
    }
  }
}

void CGUIMediaWindow::OnDeleteItem(int iItem)
{
  if ( iItem < 0 || iItem >= m_vecItems->Size()) return;
  CFileItemPtr item = m_vecItems->Get(iItem);

  if (PLAYLIST::IsPlayList(*item))
    item->m_bIsFolder = false;

  const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();

  if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked())
  {
    if (!g_passwordManager.IsMasterLockUnlocked(true))
      return;
  }

  if (!CFileUtils::DeleteItemWithConfirm(item))
    return;

  Refresh(true);
  m_viewControl.SetSelectedItem(iItem);
}

void CGUIMediaWindow::OnRenameItem(int iItem)
{
  if (iItem < 0 || iItem >= m_vecItems->Size())
    return;

  const std::shared_ptr<CProfileManager> profileManager = CServiceBroker::GetSettingsComponent()->GetProfileManager();

  if (profileManager->GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE && profileManager->GetCurrentProfile().filesLocked())
  {
    if (!g_passwordManager.IsMasterLockUnlocked(true))
      return;
  }

  if (!CFileUtils::RenameFile(m_vecItems->Get(iItem)->GetPath()))
    return;

  Refresh(true);
  m_viewControl.SetSelectedItem(iItem);
}

void CGUIMediaWindow::OnInitWindow()
{
  // initial fetch is done unthreaded to ensure the items are setup prior to skin animations kicking off
  m_backgroundLoad = false;
Repository: xbmc/xbmc
File: xbmc/test/TestUtils.cpp (C++)

Code before:
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "TestUtils.h"

#include "Util.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "platform/Filesystem.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"

#ifdef TARGET_WINDOWS
#include <windows.h>
#else
#include <cstdlib>
#include <climits>
#include <ctime>
#endif

#include <system_error>

namespace fs = KODI::PLATFORM::FILESYSTEM;

class CTempFile : public XFILE::CFile
{
public:
  CTempFile() = default;
  ~CTempFile()
  {

Review comment (refactor):
Remove this empty line. This is only a leftover from a previous iteration of the PR. You do not want to change this file.

Code after:
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "TestUtils.h"
#include "Util.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "platform/Filesystem.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"

#ifdef TARGET_WINDOWS
#include <windows.h>
#else
#include <cstdlib>
#include <climits>
#include <ctime>
#endif

#include <system_error>

namespace fs = KODI::PLATFORM::FILESYSTEM;

class CTempFile : public XFILE::CFile
{
public:
  CTempFile() = default;
  ~CTempFile()
  {
    Delete();
Repository: xbmc/xbmc
File: xbmc/utils/FileUtils.cpp (C++)

Code before:
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}


bool CFileUtils::DeleteWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
      CSettings::SETTING_FILELISTS_CONFIRMFILEDELETE);

  if (confirm)
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}


Review comment (suggestion):
You could save the `confirm`variable and just write

```
if (CServiceBroker::GetSettingsComponent...)
```

Code after:
        {
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}

bool CFileUtils::DeleteItemWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
          CSettings::SETTING_FILELISTS_CONFIRMFILEDELETION))
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}
Repository: xbmc/xbmc
File: xbmc/utils/FileUtils.cpp (C++)

Code before:
        g_charsetConverter.wToUTF8(fullpathW, fullpath, false);
        for (const std::string& whiteEntry : whitelist)
        {
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}

bool CFileUtils::DeleteWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
      CSettings::SETTING_FILELISTS_CONFIRMFILEDELETE);

  if (confirm)
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}


Review comment (bug):
@ksooo what worring me is that DeleteWithConfirm use CFileUtils that is generic, can be ok but
this setting should not be used for files that are not library related (audio/video/music) but nowhere is it specified, and no file type check happens here

anyone can use the DeleteWithConfirm method for anything else...and it is not the intention of the setting,
in the future here it will be forgotten and many wrong implementations will come up

Code after:
        g_charsetConverter.wToUTF8(fullpathW, fullpath, false);
        for (const std::string& whiteEntry : whitelist)
        {
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}

bool CFileUtils::DeleteItemWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
          CSettings::SETTING_FILELISTS_CONFIRMFILEDELETION))
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}
Repository: xbmc/xbmc
File: xbmc/test/TestUtils.cpp (C++)

Code before:
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "TestUtils.h"

#include "Util.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "platform/Filesystem.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"

#ifdef TARGET_WINDOWS
#include <windows.h>
#else
#include <cstdlib>
#include <climits>
#include <ctime>
#endif

#include <system_error>

namespace fs = KODI::PLATFORM::FILESYSTEM;

class CTempFile : public XFILE::CFile
{
public:
  CTempFile() = default;
  ~CTempFile()
  {

Review comment (refactor):
One more time: Remove this empty line. This is only a leftover from a previous iteration of the PR. You do not want to change this file.

Code after:
/*
 *  Copyright (C) 2005-2018 Team Kodi
 *  This file is part of Kodi - https://kodi.tv
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 *  See LICENSES/README.md for more information.
 */

#include "TestUtils.h"
#include "Util.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "platform/Filesystem.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"

#ifdef TARGET_WINDOWS
#include <windows.h>
#else
#include <cstdlib>
#include <climits>
#include <ctime>
#endif

#include <system_error>

namespace fs = KODI::PLATFORM::FILESYSTEM;

class CTempFile : public XFILE::CFile
{
public:
  CTempFile() = default;
  ~CTempFile()
  {
    Delete();
Repository: xbmc/xbmc
File: xbmc/utils/FileUtils.cpp (C++)

Code before:
        std::string fullpath;
        g_charsetConverter.wToUTF8(fullpathW, fullpath, false);
        for (const std::string& whiteEntry : whitelist)
        {
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}

bool CFileUtils::DeleteItemWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
      CSettings::SETTING_FILELISTS_CONFIRMFILEDELETE);

  if (confirm)
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}


Review comment (suggestion):
```suggestion
 const bool confirm = CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
```

Code after:
        std::string fullpath;
        g_charsetConverter.wToUTF8(fullpathW, fullpath, false);
        for (const std::string& whiteEntry : whitelist)
        {
          if (StringUtils::StartsWith(fullpath, whiteEntry))
            return true;
        }
        return CFileUtils::RemoteAccessAllowed(fullpath);
      }
    }
  }
#endif
  // if it isn't a local file, it must be a vfs entry
  if (! isImage)
    return CFileUtils::RemoteAccessAllowed(decodePath);
  return true;
}

bool CFileUtils::Exists(const std::string& strFileName, bool bUseCache)
{
  return CFile::Exists(strFileName, bUseCache);
}

bool CFileUtils::DeleteItemWithConfirm(const std::shared_ptr<CFileItem>& item)
{
  if (CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(
          CSettings::SETTING_FILELISTS_CONFIRMFILEDELETION))
  {
    CGUIComponent* gui = CServiceBroker::GetGUI();

    if (!gui || !gui->ConfirmDelete(item->GetPath()))
      return false;
  }

  return CFileUtils::DeleteItem(item);
}
Repository: xbmc/xbmc
File: xbmc/guilib/Shader.cpp (C++)

Code before:
  return output;
}


//////////////////////////////////////////////////////////////////////
// CGLSLVertexShader
//////////////////////////////////////////////////////////////////////

bool CGLSLVertexShader::Compile()
{
  GLint params[4];

  Free();

  m_vertexShader = glCreateShader(GL_VERTEX_SHADER);
  const char *ptr = m_source.c_str();
  glShaderSource(m_vertexShader, 1, &ptr, 0);
  glCompileShader(m_vertexShader);
  glGetShaderiv(m_vertexShader, GL_COMPILE_STATUS, params);
  VerifyGLState();
  if (params[0] != GL_TRUE)
  {
    GLchar log[LOG_SIZE];
    CLog::Log(LOGERROR, "GL: Error compiling vertex shader");
    GLsizei length;
    glGetShaderInfoLog(m_vertexShader, LOG_SIZE, &length, log);
    if (length > 0)
    {
      CLog::Log(LOGDEBUG, "GL: Vertex Shader compilation log:");
      CLog::Log(LOGDEBUG, "{}", log);
    }
    m_lastLog = log;
    m_compiled = false;
  }
  else
  {
    GLchar log[LOG_SIZE];
    GLsizei length;
    glGetShaderInfoLog(m_vertexShader, LOG_SIZE, &length, log);
    if (length > 0)
    {
      CLog::Log(LOGDEBUG, "GL: Vertex Shader compilation log:");
      CLog::Log(LOGDEBUG, "{}", log);
    }
    m_lastLog = log;
    m_compiled = true;
  }
  return m_compiled;
}

void CGLSLVertexShader::Free()

Review comment (suggestion):
apparently it's possible to dynamically allocate the required size of the log by using `GL_INFO_LOG_LENGTH` with `glGetShaderiv`. Might be something worth looking into in the future instead of having a static buffer.

Code after:
  return output;
}


//////////////////////////////////////////////////////////////////////
// CGLSLVertexShader
//////////////////////////////////////////////////////////////////////

bool CGLSLVertexShader::Compile()
{
  GLint params[4];

  Free();

  m_vertexShader = glCreateShader(GL_VERTEX_SHADER);
  const char *ptr = m_source.c_str();
  glShaderSource(m_vertexShader, 1, &ptr, 0);
  glCompileShader(m_vertexShader);
  glGetShaderiv(m_vertexShader, GL_COMPILE_STATUS, params);
  VerifyGLState();
  if (params[0] != GL_TRUE)
  {
    GLchar log[LOG_SIZE];
    CLog::Log(LOGERROR, "GL: Error compiling vertex shader");
    GLsizei length;
    glGetShaderInfoLog(m_vertexShader, LOG_SIZE, &length, log);
    if (length > 0)
    {
      CLog::Log(LOGERROR, "GL: Vertex Shader compilation log:");
      CLog::Log(LOGERROR, "{}", log);
    }
    m_lastLog = log;
    m_compiled = false;
  }
  else
  {
    GLchar log[LOG_SIZE];
    GLsizei length;
    glGetShaderInfoLog(m_vertexShader, LOG_SIZE, &length, log);
    if (length > 0)
    {
      CLog::Log(LOGERROR, "GL: Vertex Shader compilation log:");
      CLog::Log(LOGERROR, "{}", log);
    }
    m_lastLog = log;
    m_compiled = true;
  }
  return m_compiled;
}

void CGLSLVertexShader::Free()
Repository: xbmc/xbmc
File: xbmc/cores/VideoPlayer/DVDInputStreams/DVDInputStreamNavigator.cpp (C++)

Code before:
    info.codecName = "dts";
    break;
  case DVD_AUDIO_FORMAT_SDDS:
    info.codecDesc = "SDDS";
    break;
  default:
    info.codecDesc = "Other";
    break;
  }

  switch(audio_attributes.channels + 1)
  {
  case 1:
    info.codecDesc += " Mono";
    break;
  case 2:
    info.codecDesc += " Stereo";
    break;
  case 6:
    info.codecDesc += " 5.1";
    break;
  case 7:
    info.codecDesc += " 6.1";
    break;
  default:
    info.codecDesc += StringUtils::Format(" {:d}-chs", audio_attributes.channels + 1);
  }
}

AudioStreamInfo CDVDInputStreamNavigator::GetAudioStreamInfo(const int iId)
{
  AudioStreamInfo info;
  if (!m_dvdnav)
    return info;

  audio_attr_t audio_attributes;

  if (m_dll.dvdnav_get_audio_attr(m_dvdnav, iId, &audio_attributes) == DVDNAV_STATUS_OK)
  {
    SetAudioStreamName(info, audio_attributes);

    char lang[3];
    lang[2] = 0;
    lang[1] = (audio_attributes.lang_code & 255);
    lang[0] = (audio_attributes.lang_code >> 8) & 255;

    info.language = g_LangCodeExpander.ConvertToISO6392B(lang);
    info.channels = audio_attributes.channels + 1;
  }

  return info;

Review comment (suggestion):
use localized string
```suggestion
    info.codecDesc += StringUtils::Format(" {:d} {}", audio_attributes.channels + 1,
                                          g_localizeStrings.Get(10127));
```
and add the file path to the relative id on
addons\resource.language.en_gb\resources\strings.po

Code after:
  case DVD_AUDIO_FORMAT_DTS:
    info.codecDesc = "DTS";
    info.codecName = "dts";
    break;
  case DVD_AUDIO_FORMAT_SDDS:
    info.codecDesc = "SDDS";
    break;
  default:
    info.codecDesc = g_localizeStrings.Get(13205); // "Unknown"
    CLog::LogF(LOGINFO, "unknown dvd audio codec");
    break;
  }

  info.codecDesc.append(" ");

  switch(audio_attributes.channels + 1)
  {
  case 1:
    info.codecDesc += g_localizeStrings.Get(37003); // "mono"
    break;
  case 2:
    info.codecDesc += g_localizeStrings.Get(37004); // "stereo"
    break;
  case 6:
    info.codecDesc += "5.1";
    break;
  case 7:
    info.codecDesc += "6.1";
    break;
  default:
    info.codecDesc += StringUtils::Format("{:d} {}", audio_attributes.channels + 1,
                                          g_localizeStrings.Get(10127)); // "channels"
  }
}

AudioStreamInfo CDVDInputStreamNavigator::GetAudioStreamInfo(const int iId)
{
  AudioStreamInfo info;
  if (!m_dvdnav)
    return info;

  audio_attr_t audio_attributes;

  if (m_dll.dvdnav_get_audio_attr(m_dvdnav, iId, &audio_attributes) == DVDNAV_STATUS_OK)
  {
    SetAudioStreamName(info, audio_attributes);

    char lang[3];
    lang[2] = 0;
    lang[1] = (audio_attributes.lang_code & 255);
    lang[0] = (audio_attributes.lang_code >> 8) & 255;