mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:19:55 +00:00
Merge pull request #3075 from akortunov/warnfix
Fix MSVC's C4244 and C4267 warnings
This commit is contained in:
commit
66a527c3de
32 changed files with 113 additions and 73 deletions
|
@ -603,11 +603,8 @@ if (WIN32)
|
||||||
set(WARNINGS "/W4")
|
set(WARNINGS "/W4")
|
||||||
|
|
||||||
set(WARNINGS_DISABLE
|
set(WARNINGS_DISABLE
|
||||||
# OpenMW specific warnings
|
|
||||||
4100 # Unreferenced formal parameter (-Wunused-parameter)
|
4100 # Unreferenced formal parameter (-Wunused-parameter)
|
||||||
4127 # Conditional expression is constant
|
4127 # Conditional expression is constant
|
||||||
4244 # Storing value of one type in variable of another (size_t in int, for example)
|
|
||||||
4267 # Conversion from 'size_t' to 'int', possible loss of data
|
|
||||||
4996 # Function was declared deprecated
|
4996 # Function was declared deprecated
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -676,7 +676,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const boost::filesystem::p
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line[0] == '[') {
|
if(line[0] == '[') {
|
||||||
int pos = line.find(']');
|
int pos = static_cast<int>(line.find(']'));
|
||||||
if(pos < 2) {
|
if(pos < 2) {
|
||||||
std::cout << "Warning: ini file wrongly formatted (" << line << "). Line ignored." << std::endl;
|
std::cout << "Warning: ini file wrongly formatted (" << line << "). Line ignored." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
|
@ -686,12 +686,12 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const boost::filesystem::p
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int comment_pos = line.find(';');
|
int comment_pos = static_cast<int>(line.find(';'));
|
||||||
if(comment_pos > 0) {
|
if(comment_pos > 0) {
|
||||||
line = line.substr(0,comment_pos);
|
line = line.substr(0,comment_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = line.find('=');
|
int pos = static_cast<int>(line.find('='));
|
||||||
if(pos < 1) {
|
if(pos < 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -722,7 +722,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const boost::filesystem::p
|
||||||
while (std::getline(file, line)) {
|
while (std::getline(file, line)) {
|
||||||
|
|
||||||
// we cant say comment by only looking at first char anymore
|
// we cant say comment by only looking at first char anymore
|
||||||
int comment_pos = line.find('#');
|
int comment_pos = static_cast<int>(line.find('#'));
|
||||||
if(comment_pos > 0) {
|
if(comment_pos > 0) {
|
||||||
line = line.substr(0,comment_pos);
|
line = line.substr(0,comment_pos);
|
||||||
}
|
}
|
||||||
|
@ -731,7 +731,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const boost::filesystem::p
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = line.find('=');
|
int pos = static_cast<int>(line.find('='));
|
||||||
if(pos < 1) {
|
if(pos < 1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ void CSMDoc::Blacklist::add (CSMWorld::UniversalId::Type type,
|
||||||
{
|
{
|
||||||
std::vector<std::string>& list = mIds[type];
|
std::vector<std::string>& list = mIds[type];
|
||||||
|
|
||||||
int size = list.size();
|
size_t size = list.size();
|
||||||
|
|
||||||
list.resize (size+ids.size());
|
list.resize (size+ids.size());
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ CSMFilter::NAryNode::NAryNode (const std::vector<std::shared_ptr<Node> >& nodes,
|
||||||
|
|
||||||
int CSMFilter::NAryNode::getSize() const
|
int CSMFilter::NAryNode::getSize() const
|
||||||
{
|
{
|
||||||
return mNodes.size();
|
return static_cast<int>(mNodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSMFilter::Node& CSMFilter::NAryNode::operator[] (int index) const
|
const CSMFilter::Node& CSMFilter::NAryNode::operator[] (int index) const
|
||||||
|
|
|
@ -11,7 +11,7 @@ CSMTools::MandatoryIdStage::MandatoryIdStage (const CSMWorld::CollectionBase& id
|
||||||
|
|
||||||
int CSMTools::MandatoryIdStage::setup()
|
int CSMTools::MandatoryIdStage::setup()
|
||||||
{
|
{
|
||||||
return mIds.size();
|
return static_cast<int>(mIds.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::MandatoryIdStage::perform (int stage, CSMDoc::Messages& messages)
|
void CSMTools::MandatoryIdStage::perform (int stage, CSMDoc::Messages& messages)
|
||||||
|
|
|
@ -24,7 +24,7 @@ int CSMTools::ReportModel::rowCount (const QModelIndex & parent) const
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return mRows.size();
|
return static_cast<int>(mRows.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMTools::ReportModel::columnCount (const QModelIndex & parent) const
|
int CSMTools::ReportModel::columnCount (const QModelIndex & parent) const
|
||||||
|
@ -140,7 +140,7 @@ bool CSMTools::ReportModel::removeRows (int row, int count, const QModelIndex& p
|
||||||
|
|
||||||
void CSMTools::ReportModel::add (const CSMDoc::Message& message)
|
void CSMTools::ReportModel::add (const CSMDoc::Message& message)
|
||||||
{
|
{
|
||||||
beginInsertRows (QModelIndex(), mRows.size(), mRows.size());
|
beginInsertRows (QModelIndex(), static_cast<int>(mRows.size()), static_cast<int>(mRows.size()));
|
||||||
|
|
||||||
mRows.push_back (message);
|
mRows.push_back (message);
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ void CSMTools::ReportModel::clear()
|
||||||
{
|
{
|
||||||
if (!mRows.empty())
|
if (!mRows.empty())
|
||||||
{
|
{
|
||||||
beginRemoveRows (QModelIndex(), 0, mRows.size()-1);
|
beginRemoveRows (QModelIndex(), 0, static_cast<int>(mRows.size())-1);
|
||||||
mRows.clear();
|
mRows.clear();
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ void CSMWorld::IdTable::reorderRows (int baseIndex, const std::vector<int>& newO
|
||||||
if (!newOrder.empty())
|
if (!newOrder.empty())
|
||||||
if (mIdCollection->reorderRows (baseIndex, newOrder))
|
if (mIdCollection->reorderRows (baseIndex, newOrder))
|
||||||
emit dataChanged (index (baseIndex, 0),
|
emit dataChanged (index (baseIndex, 0),
|
||||||
index (baseIndex+newOrder.size()-1, mIdCollection->getColumns()-1));
|
index (baseIndex+static_cast<int>(newOrder.size())-1, mIdCollection->getColumns()-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<CSMWorld::UniversalId, std::string> CSMWorld::IdTable::view (int row) const
|
std::pair<CSMWorld::UniversalId, std::string> CSMWorld::IdTable::view (int row) const
|
||||||
|
|
|
@ -20,13 +20,13 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char * const *
|
||||||
mFiles.clear();
|
mFiles.clear();
|
||||||
mIndex.clear();
|
mIndex.clear();
|
||||||
|
|
||||||
int baseSize = mBaseDirectory.size();
|
size_t baseSize = mBaseDirectory.size();
|
||||||
|
|
||||||
const std::map<std::string, VFS::File*>& index = vfs->getIndex();
|
const std::map<std::string, VFS::File*>& index = vfs->getIndex();
|
||||||
for (std::map<std::string, VFS::File*>::const_iterator it = index.begin(); it != index.end(); ++it)
|
for (std::map<std::string, VFS::File*>::const_iterator it = index.begin(); it != index.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string filepath = it->first;
|
std::string filepath = it->first;
|
||||||
if (static_cast<int> (filepath.size())<baseSize+1 ||
|
if (filepath.size()<baseSize+1 ||
|
||||||
filepath.substr (0, baseSize)!=mBaseDirectory ||
|
filepath.substr (0, baseSize)!=mBaseDirectory ||
|
||||||
(filepath[baseSize]!='/' && filepath[baseSize]!='\\'))
|
(filepath[baseSize]!='/' && filepath[baseSize]!='\\'))
|
||||||
continue;
|
continue;
|
||||||
|
@ -60,7 +60,7 @@ void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char * const *
|
||||||
|
|
||||||
int CSMWorld::Resources::getSize() const
|
int CSMWorld::Resources::getSize() const
|
||||||
{
|
{
|
||||||
return mFiles.size();
|
return static_cast<int>(mFiles.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CSMWorld::Resources::getId (int index) const
|
std::string CSMWorld::Resources::getId (int index) const
|
||||||
|
|
|
@ -30,7 +30,7 @@ void CSVDoc::Operations::setProgress (int current, int max, int type, int thread
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int oldCount = mOperations.size();
|
int oldCount = static_cast<int>(mOperations.size());
|
||||||
int newCount = oldCount + 1;
|
int newCount = oldCount + 1;
|
||||||
|
|
||||||
Operation *operation = new Operation (type, this);
|
Operation *operation = new Operation (type, this);
|
||||||
|
@ -51,7 +51,7 @@ void CSVDoc::Operations::quitOperation (int type)
|
||||||
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
|
for (std::vector<Operation *>::iterator iter (mOperations.begin()); iter!=mOperations.end(); ++iter)
|
||||||
if ((*iter)->getType()==type)
|
if ((*iter)->getType()==type)
|
||||||
{
|
{
|
||||||
int oldCount = mOperations.size();
|
int oldCount = static_cast<int>(mOperations.size());
|
||||||
int newCount = oldCount - 1;
|
int newCount = oldCount - 1;
|
||||||
|
|
||||||
mLayout->removeItem ((*iter)->getLayout());
|
mLayout->removeItem ((*iter)->getLayout());
|
||||||
|
|
|
@ -30,7 +30,7 @@ void CSVWidget::SceneToolRun::updateIcon()
|
||||||
|
|
||||||
void CSVWidget::SceneToolRun::updatePanel()
|
void CSVWidget::SceneToolRun::updatePanel()
|
||||||
{
|
{
|
||||||
mTable->setRowCount (mProfiles.size());
|
mTable->setRowCount (static_cast<int>(mProfiles.size()));
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ QRect CSVWidget::SceneToolToggle::getIconBox (int index) const
|
||||||
int y = index / xMax;
|
int y = index / xMax;
|
||||||
int x = index % xMax;
|
int x = index % xMax;
|
||||||
|
|
||||||
int total = mButtons.size();
|
int total = static_cast<int>(mButtons.size());
|
||||||
|
|
||||||
int actualYIcons = total/xMax;
|
int actualYIcons = total/xMax;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ void CSVWidget::SceneToolToggle::addButton (const std::string& icon, unsigned in
|
||||||
desc.mMask = mask;
|
desc.mMask = mask;
|
||||||
desc.mSmallIcon = smallIcon;
|
desc.mSmallIcon = smallIcon;
|
||||||
desc.mName = name;
|
desc.mName = name;
|
||||||
desc.mIndex = mButtons.size();
|
desc.mIndex = static_cast<int>(mButtons.size());
|
||||||
|
|
||||||
mButtons.insert (std::make_pair (button, desc));
|
mButtons.insert (std::make_pair (button, desc));
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id, unsigned int mask,
|
||||||
desc.mButtonId = id;
|
desc.mButtonId = id;
|
||||||
desc.mMask = mask;
|
desc.mMask = mask;
|
||||||
desc.mName = name;
|
desc.mName = name;
|
||||||
desc.mIndex = mButtons.size();
|
desc.mIndex = static_cast<int>(mButtons.size());
|
||||||
|
|
||||||
mButtons.insert (std::make_pair (button, desc));
|
mButtons.insert (std::make_pair (button, desc));
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ QValidator::State CSVWorld::IdValidator::validate (QString& input, int& pos) con
|
||||||
|
|
||||||
if (!mNamespace.empty())
|
if (!mNamespace.empty())
|
||||||
{
|
{
|
||||||
std::string namespace_ = input.left (mNamespace.size()).toUtf8().constData();
|
std::string namespace_ = input.left (static_cast<int>(mNamespace.size())).toUtf8().constData();
|
||||||
|
|
||||||
if (Misc::StringUtils::lowerCase (namespace_)!=mNamespace)
|
if (Misc::StringUtils::lowerCase (namespace_)!=mNamespace)
|
||||||
return QValidator::Invalid; // incorrect namespace
|
return QValidator::Invalid; // incorrect namespace
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
#define GAME_SOUND_FFMPEG_DECODER_H
|
#define GAME_SOUND_FFMPEG_DECODER_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
@ -14,6 +20,10 @@ extern "C"
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <components/files/constrainedfilestream.hpp>
|
#include <components/files/constrainedfilestream.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -43,7 +43,7 @@ void BSAFile::fail(const std::string &msg)
|
||||||
BSAFile::Hash getHash(const std::string& name)
|
BSAFile::Hash getHash(const std::string& name)
|
||||||
{
|
{
|
||||||
BSAFile::Hash hash;
|
BSAFile::Hash hash;
|
||||||
unsigned l = (name.size() >> 1);
|
unsigned l = (static_cast<unsigned>(name.size()) >> 1);
|
||||||
unsigned sum, off, temp, i, n;
|
unsigned sum, off, temp, i, n;
|
||||||
|
|
||||||
for (sum = off = i = 0; i < l; i++) {
|
for (sum = off = i = 0; i < l; i++) {
|
||||||
|
@ -163,7 +163,7 @@ void BSAFile::readHeader()
|
||||||
{
|
{
|
||||||
FileStruct &fs = mFiles[i];
|
FileStruct &fs = mFiles[i];
|
||||||
fs.fileSize = offsets[i*2];
|
fs.fileSize = offsets[i*2];
|
||||||
fs.offset = offsets[i*2+1] + fileDataOffset;
|
fs.offset = static_cast<uint32_t>(offsets[i*2+1] + fileDataOffset);
|
||||||
auto namesOffset = offsets[2*filenum+i];
|
auto namesOffset = offsets[2*filenum+i];
|
||||||
fs.setNameInfos(namesOffset, &mStringBuf);
|
fs.setNameInfos(namesOffset, &mStringBuf);
|
||||||
fs.hash = hashes[i];
|
fs.hash = hashes[i];
|
||||||
|
@ -203,11 +203,11 @@ void Bsa::BSAFile::writeHeader()
|
||||||
uint32_t head[3];
|
uint32_t head[3];
|
||||||
head[0] = 0x100;
|
head[0] = 0x100;
|
||||||
auto fileDataOffset = mFiles.empty() ? 12 : mFiles.front().offset;
|
auto fileDataOffset = mFiles.empty() ? 12 : mFiles.front().offset;
|
||||||
head[1] = fileDataOffset - 12 - 8*mFiles.size();
|
head[1] = static_cast<uint32_t>(fileDataOffset - 12 - 8*mFiles.size());
|
||||||
|
|
||||||
output.seekp(0, std::ios_base::end);
|
output.seekp(0, std::ios_base::end);
|
||||||
|
|
||||||
head[2] = mFiles.size();
|
head[2] = static_cast<uint32_t>(mFiles.size());
|
||||||
output.seekp(0);
|
output.seekp(0);
|
||||||
output.write(reinterpret_cast<char*>(head), 12);
|
output.write(reinterpret_cast<char*>(head), 12);
|
||||||
|
|
||||||
|
@ -239,9 +239,9 @@ int BSAFile::getIndex(const char *str) const
|
||||||
if(it == mLookup.end())
|
if(it == mLookup.end())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int res = it->second;
|
size_t res = it->second;
|
||||||
assert(res >= 0 && (size_t)res < mFiles.size());
|
assert(res >= 0 && res < mFiles.size());
|
||||||
return res;
|
return static_cast<int>(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Open an archive file.
|
/// Open an archive file.
|
||||||
|
@ -295,12 +295,12 @@ void Bsa::BSAFile::addFile(const std::string& filename, std::istream& file)
|
||||||
|
|
||||||
FileStruct newFile;
|
FileStruct newFile;
|
||||||
file.seekg(0, std::ios::end);
|
file.seekg(0, std::ios::end);
|
||||||
newFile.fileSize = file.tellg();
|
newFile.fileSize = static_cast<uint32_t>(file.tellg());
|
||||||
newFile.setNameInfos(mStringBuf.size(), &mStringBuf);
|
newFile.setNameInfos(mStringBuf.size(), &mStringBuf);
|
||||||
newFile.hash = getHash(filename);
|
newFile.hash = getHash(filename);
|
||||||
|
|
||||||
if(mFiles.empty())
|
if(mFiles.empty())
|
||||||
newFile.offset = newStartOfDataBuffer;
|
newFile.offset = static_cast<uint32_t>(newStartOfDataBuffer);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<char> buffer;
|
std::vector<char> buffer;
|
||||||
|
@ -312,7 +312,7 @@ void Bsa::BSAFile::addFile(const std::string& filename, std::istream& file)
|
||||||
stream.read(buffer.data(), firstFile.fileSize);
|
stream.read(buffer.data(), firstFile.fileSize);
|
||||||
|
|
||||||
stream.seekp(0, std::ios::end);
|
stream.seekp(0, std::ios::end);
|
||||||
firstFile.offset = stream.tellp();
|
firstFile.offset = static_cast<uint32_t>(stream.tellp());
|
||||||
|
|
||||||
stream.write(buffer.data(), firstFile.fileSize);
|
stream.write(buffer.data(), firstFile.fileSize);
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ void Bsa::BSAFile::addFile(const std::string& filename, std::istream& file)
|
||||||
std::rotate(mFiles.begin(), mFiles.begin() + 1, mFiles.end());
|
std::rotate(mFiles.begin(), mFiles.begin() + 1, mFiles.end());
|
||||||
}
|
}
|
||||||
stream.seekp(0, std::ios::end);
|
stream.seekp(0, std::ios::end);
|
||||||
newFile.offset = stream.tellp();
|
newFile.offset = static_cast<uint32_t>(stream.tellp());
|
||||||
}
|
}
|
||||||
|
|
||||||
mStringBuf.insert(mStringBuf.end(), filename.begin(), filename.end());
|
mStringBuf.insert(mStringBuf.end(), filename.begin(), filename.end());
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
void setNameInfos(size_t index,
|
void setNameInfos(size_t index,
|
||||||
std::vector<char>* stringBuf
|
std::vector<char>* stringBuf
|
||||||
) {
|
) {
|
||||||
namesOffset = index;
|
namesOffset = static_cast<uint32_t>(index);
|
||||||
namesBuffer = stringBuf;
|
namesBuffer = stringBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ protected:
|
||||||
the files[] vector above. The iltstr ensures that file name
|
the files[] vector above. The iltstr ensures that file name
|
||||||
checks are case insensitive.
|
checks are case insensitive.
|
||||||
*/
|
*/
|
||||||
typedef std::map<std::string, int, iltstr> Lookup;
|
typedef std::map<std::string, size_t, iltstr> Lookup;
|
||||||
Lookup mLookup;
|
Lookup mLookup;
|
||||||
|
|
||||||
/// Error handling
|
/// Error handling
|
||||||
|
|
|
@ -39,14 +39,14 @@ namespace Compiler
|
||||||
Codes block;
|
Codes block;
|
||||||
|
|
||||||
if (iter!=mIfCode.rbegin())
|
if (iter!=mIfCode.rbegin())
|
||||||
Generator::jump (iter->second, codes.size()+1);
|
Generator::jump (iter->second, static_cast<int>(codes.size()+1));
|
||||||
|
|
||||||
if (!iter->first.empty())
|
if (!iter->first.empty())
|
||||||
{
|
{
|
||||||
// if or elseif
|
// if or elseif
|
||||||
std::copy (iter->first.begin(), iter->first.end(),
|
std::copy (iter->first.begin(), iter->first.end(),
|
||||||
std::back_inserter (block));
|
std::back_inserter (block));
|
||||||
Generator::jumpOnZero (block, iter->second.size()+1);
|
Generator::jumpOnZero (block, static_cast<int>(iter->second.size()+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy (iter->second.begin(), iter->second.end(),
|
std::copy (iter->second.begin(), iter->second.end(),
|
||||||
|
@ -113,7 +113,7 @@ namespace Compiler
|
||||||
|
|
||||||
Codes skip;
|
Codes skip;
|
||||||
|
|
||||||
Generator::jumpOnZero (skip, mCodeBlock.size()+loop.size()+1);
|
Generator::jumpOnZero (skip, static_cast<int> (mCodeBlock.size()+loop.size()+1));
|
||||||
|
|
||||||
std::copy (skip.begin(), skip.end(), std::back_inserter (mCode));
|
std::copy (skip.begin(), skip.end(), std::back_inserter (mCode));
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,12 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
int Literals::getIntegerSize() const
|
int Literals::getIntegerSize() const
|
||||||
{
|
{
|
||||||
return mIntegers.size() * sizeof (Interpreter::Type_Integer);
|
return static_cast<int>(mIntegers.size() * sizeof (Interpreter::Type_Integer));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Literals::getFloatSize() const
|
int Literals::getFloatSize() const
|
||||||
{
|
{
|
||||||
return mFloats.size() * sizeof (Interpreter::Type_Float);
|
return static_cast<int>(mFloats.size() * sizeof (Interpreter::Type_Float));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Literals::getStringSize() const
|
int Literals::getStringSize() const
|
||||||
|
@ -41,11 +41,11 @@ namespace Compiler
|
||||||
|
|
||||||
code.resize (size+stringBlockSize/4);
|
code.resize (size+stringBlockSize/4);
|
||||||
|
|
||||||
int offset = 0;
|
size_t offset = 0;
|
||||||
|
|
||||||
for (const auto & mString : mStrings)
|
for (const auto & mString : mStrings)
|
||||||
{
|
{
|
||||||
int stringSize = mString.size()+1;
|
size_t stringSize = mString.size()+1;
|
||||||
|
|
||||||
std::copy (mString.c_str(), mString.c_str()+stringSize,
|
std::copy (mString.c_str(), mString.c_str()+stringSize,
|
||||||
reinterpret_cast<char *> (&code[size]) + offset);
|
reinterpret_cast<char *> (&code[size]) + offset);
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Compiler
|
||||||
if (iter==collection.end())
|
if (iter==collection.end())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return iter-collection.begin();
|
return static_cast<int>(iter-collection.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Locals::search (char type, const std::string& name) const
|
bool Locals::search (char type, const std::string& name) const
|
||||||
|
|
|
@ -103,7 +103,7 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
blank();
|
blank();
|
||||||
|
|
||||||
char ch = in.peek();
|
char ch = static_cast<char>(in.peek());
|
||||||
|
|
||||||
if (!in.good())
|
if (!in.good())
|
||||||
return false;
|
return false;
|
||||||
|
@ -130,7 +130,7 @@ namespace Compiler
|
||||||
{
|
{
|
||||||
std::streampos p_orig = in.tellg();
|
std::streampos p_orig = in.tellg();
|
||||||
|
|
||||||
char ch = in.peek();
|
char ch = static_cast<char>(in.peek());
|
||||||
|
|
||||||
if (!in.good())
|
if (!in.good())
|
||||||
return false;
|
return false;
|
||||||
|
@ -156,7 +156,7 @@ namespace Compiler
|
||||||
|
|
||||||
void blank()
|
void blank()
|
||||||
{
|
{
|
||||||
std::fill(mData, mData + sizeof(mData), 0);
|
std::fill(std::begin(mData), std::end(mData), '\0');
|
||||||
mLength = -1;
|
mLength = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,12 +130,12 @@ namespace Crash
|
||||||
DWORD copied = 0;
|
DWORD copied = 0;
|
||||||
do {
|
do {
|
||||||
executablePath.resize(executablePath.size() + MAX_PATH);
|
executablePath.resize(executablePath.size() + MAX_PATH);
|
||||||
copied = GetModuleFileNameW(nullptr, executablePath.data(), executablePath.size());
|
copied = GetModuleFileNameW(nullptr, executablePath.data(), static_cast<DWORD>(executablePath.size()));
|
||||||
} while (copied >= executablePath.size());
|
} while (copied >= executablePath.size());
|
||||||
executablePath.resize(copied);
|
executablePath.resize(copied);
|
||||||
|
|
||||||
memset(mShm->mStartup.mLogFilePath, 0, sizeof(mShm->mStartup.mLogFilePath));
|
memset(mShm->mStartup.mLogFilePath, 0, sizeof(mShm->mStartup.mLogFilePath));
|
||||||
int length = crashLogPath.length();
|
size_t length = crashLogPath.length();
|
||||||
if (length >= MAX_LONG_PATH) length = MAX_LONG_PATH - 1;
|
if (length >= MAX_LONG_PATH) length = MAX_LONG_PATH - 1;
|
||||||
strncpy(mShm->mStartup.mLogFilePath, crashLogPath.c_str(), length);
|
strncpy(mShm->mStartup.mLogFilePath, crashLogPath.c_str(), length);
|
||||||
mShm->mStartup.mLogFilePath[length] = '\0';
|
mShm->mStartup.mLogFilePath[length] = '\0';
|
||||||
|
|
|
@ -203,9 +203,9 @@ void ESMReader::getSubName()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading the subrecord data anyway.
|
// reading the subrecord data anyway.
|
||||||
const size_t subNameSize = mCtx.subName.data_size();
|
const int subNameSize = static_cast<int>(mCtx.subName.data_size());
|
||||||
getExact(mCtx.subName.rw_data(), subNameSize);
|
getExact(mCtx.subName.rw_data(), subNameSize);
|
||||||
mCtx.leftRec -= subNameSize;
|
mCtx.leftRec -= static_cast<uint32_t>(subNameSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESMReader::skipHSub()
|
void ESMReader::skipHSub()
|
||||||
|
@ -327,7 +327,7 @@ std::string ESMReader::getString(int size)
|
||||||
char *ptr = mBuffer.data();
|
char *ptr = mBuffer.data();
|
||||||
getExact(ptr, size);
|
getExact(ptr, size);
|
||||||
|
|
||||||
size = strnlen(ptr, size);
|
size = static_cast<int>(strnlen(ptr, size));
|
||||||
|
|
||||||
// Convert to UTF8 and return
|
// Convert to UTF8 and return
|
||||||
if (mEncoder)
|
if (mEncoder)
|
||||||
|
|
|
@ -217,7 +217,7 @@ namespace ESM
|
||||||
if (mCounting && !mRecords.empty())
|
if (mCounting && !mRecords.empty())
|
||||||
{
|
{
|
||||||
for (std::list<RecordData>::iterator it = mRecords.begin(); it != mRecords.end(); ++it)
|
for (std::list<RecordData>::iterator it = mRecords.begin(); it != mRecords.end(); ++it)
|
||||||
it->size += size;
|
it->size += static_cast<uint32_t>(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
mStream->write(data, size);
|
mStream->write(data, size);
|
||||||
|
|
|
@ -16,17 +16,16 @@ namespace ESM
|
||||||
{
|
{
|
||||||
int base = 0;
|
int base = 0;
|
||||||
esm.getHNT(base, "STBA");
|
esm.getHNT(base, "STBA");
|
||||||
mBase = static_cast<float>(base);
|
mBase = static_cast<T>(base);
|
||||||
|
|
||||||
int mod = 0;
|
int mod = 0;
|
||||||
esm.getHNOT(mod, "STMO");
|
esm.getHNOT(mod, "STMO");
|
||||||
mMod = static_cast<float>(mod);
|
mMod = static_cast<T>(mod);
|
||||||
|
|
||||||
int current = 0;
|
int current = 0;
|
||||||
esm.getHNOT(current, "STCU");
|
esm.getHNOT(current, "STCU");
|
||||||
mCurrent = static_cast<float>(current);
|
mCurrent = static_cast<T>(current);
|
||||||
|
|
||||||
// mDamage was changed to a float; ensure backwards compatibility
|
|
||||||
int oldDamage = 0;
|
int oldDamage = 0;
|
||||||
esm.getHNOT(oldDamage, "STDA");
|
esm.getHNOT(oldDamage, "STDA");
|
||||||
mDamage = static_cast<float>(oldDamage);
|
mDamage = static_cast<float>(oldDamage);
|
||||||
|
|
|
@ -326,7 +326,7 @@ void LowLevelFile::seek (size_t position)
|
||||||
{
|
{
|
||||||
assert (mHandle != INVALID_HANDLE_VALUE);
|
assert (mHandle != INVALID_HANDLE_VALUE);
|
||||||
|
|
||||||
if (SetFilePointer (mHandle, position, nullptr, SEEK_SET) == INVALID_SET_FILE_POINTER)
|
if (SetFilePointer (mHandle, static_cast<LONG>(position), nullptr, SEEK_SET) == INVALID_SET_FILE_POINTER)
|
||||||
if (GetLastError () != NO_ERROR)
|
if (GetLastError () != NO_ERROR)
|
||||||
throw std::runtime_error ("A seek operation on a file failed.");
|
throw std::runtime_error ("A seek operation on a file failed.");
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ size_t LowLevelFile::read (void * data, size_t size)
|
||||||
|
|
||||||
DWORD read;
|
DWORD read;
|
||||||
|
|
||||||
if (!ReadFile (mHandle, data, size, &read, nullptr))
|
if (!ReadFile (mHandle, data, static_cast<DWORD>(size), &read, nullptr))
|
||||||
throw std::runtime_error ("A read operation on a file failed.");
|
throw std::runtime_error ("A read operation on a file failed.");
|
||||||
|
|
||||||
return read;
|
return read;
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Interpreter
|
||||||
|
|
||||||
for (; index; --index)
|
for (; index; --index)
|
||||||
{
|
{
|
||||||
offset += std::strlen (literalBlock+offset) + 1;
|
offset += static_cast<int>(std::strlen (literalBlock+offset)) + 1;
|
||||||
if (offset / 4 >= static_cast<int> (mCode[3]))
|
if (offset / 4 >= static_cast<int> (mCode[3]))
|
||||||
throw std::out_of_range("out of range");
|
throw std::out_of_range("out of range");
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@ namespace osgMyGUI
|
||||||
_left -= globalViewSize.width/2;
|
_left -= globalViewSize.width/2;
|
||||||
_top -= globalViewSize.height/2;
|
_top -= globalViewSize.height/2;
|
||||||
|
|
||||||
_left /= scale;
|
_left = static_cast<int>(_left/scale);
|
||||||
_top /= scale;
|
_top = static_cast<int>(_top/scale);
|
||||||
|
|
||||||
_left += mViewSize.width/2;
|
_left += mViewSize.width/2;
|
||||||
_top += mViewSize.height/2;
|
_top += mViewSize.height/2;
|
||||||
|
@ -84,8 +84,8 @@ namespace osgMyGUI
|
||||||
float ScalingLayer::getScaleFactor() const
|
float ScalingLayer::getScaleFactor() const
|
||||||
{
|
{
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
float w = viewSize.width;
|
float w = static_cast<float>(viewSize.width);
|
||||||
float h = viewSize.height;
|
float h = static_cast<float>(viewSize.height);
|
||||||
|
|
||||||
float heightScale = (h / mViewSize.height);
|
float heightScale = (h / mViewSize.height);
|
||||||
float widthScale = (w / mViewSize.width);
|
float widthScale = (w / mViewSize.width);
|
||||||
|
@ -103,8 +103,8 @@ namespace osgMyGUI
|
||||||
MyGUI::IntSize globalViewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize globalViewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
MyGUI::IntSize viewSize = globalViewSize;
|
MyGUI::IntSize viewSize = globalViewSize;
|
||||||
float scale = getScaleFactor();
|
float scale = getScaleFactor();
|
||||||
viewSize.width /= scale;
|
viewSize.width = static_cast<int>(viewSize.width / scale);
|
||||||
viewSize.height /= scale;
|
viewSize.height = static_cast<int>(viewSize.height / scale);
|
||||||
|
|
||||||
float hoffset = (globalViewSize.width - mViewSize.width*getScaleFactor())/2.f / static_cast<float>(globalViewSize.width);
|
float hoffset = (globalViewSize.width - mViewSize.width*getScaleFactor())/2.f / static_cast<float>(globalViewSize.width);
|
||||||
float voffset = (globalViewSize.height - mViewSize.height*getScaleFactor())/2.f / static_cast<float>(globalViewSize.height);
|
float voffset = (globalViewSize.height - mViewSize.height*getScaleFactor())/2.f / static_cast<float>(globalViewSize.height);
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace Gui
|
||||||
|
|
||||||
unsigned int MWList::getItemCount()
|
unsigned int MWList::getItemCount()
|
||||||
{
|
{
|
||||||
return mItems.size();
|
return static_cast<unsigned int>(mItems.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MWList::getItemNameAt(unsigned int at)
|
std::string MWList::getItemNameAt(unsigned int at)
|
||||||
|
|
15
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
15
extern/osg-ffmpeg-videoplayer/audiodecoder.cpp
vendored
|
@ -4,13 +4,20 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "videostate.hpp"
|
#include "videostate.hpp"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -255,7 +262,7 @@ size_t MovieAudioDecoder::read(char *stream, size_t len)
|
||||||
size_t sampleSize = av_get_bytes_per_sample(mOutputSampleFormat);
|
size_t sampleSize = av_get_bytes_per_sample(mOutputSampleFormat);
|
||||||
char* data[1];
|
char* data[1];
|
||||||
data[0] = stream;
|
data[0] = stream;
|
||||||
av_samples_set_silence((uint8_t**)data, 0, len/sampleSize, 1, mOutputSampleFormat);
|
av_samples_set_silence((uint8_t**)data, 0, static_cast<int>(len/sampleSize), 1, mOutputSampleFormat);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +283,7 @@ size_t MovieAudioDecoder::read(char *stream, size_t len)
|
||||||
|
|
||||||
mFramePos = std::min<ssize_t>(mFrameSize, sample_skip);
|
mFramePos = std::min<ssize_t>(mFrameSize, sample_skip);
|
||||||
if(sample_skip > 0 || mFrameSize > -sample_skip)
|
if(sample_skip > 0 || mFrameSize > -sample_skip)
|
||||||
sample_skip -= mFramePos;
|
sample_skip -= static_cast<int>(mFramePos);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libavutil/avutil.h>
|
#include <libavutil/avutil.h>
|
||||||
|
@ -14,6 +19,10 @@ extern "C"
|
||||||
#include <libavutil/channel_layout.h>
|
#include <libavutil/channel_layout.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||||
#include <basetsd.h>
|
#include <basetsd.h>
|
||||||
|
|
||||||
|
|
9
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
9
extern/osg-ffmpeg-videoplayer/videostate.cpp
vendored
|
@ -9,6 +9,11 @@
|
||||||
|
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
@ -17,6 +22,10 @@ extern "C"
|
||||||
#include <libavutil/time.h>
|
#include <libavutil/time.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char* flushString = "FLUSH";
|
static const char* flushString = "FLUSH";
|
||||||
struct FlushPacket : AVPacket
|
struct FlushPacket : AVPacket
|
||||||
{
|
{
|
||||||
|
|
9
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
9
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
|
@ -15,6 +15,11 @@ namespace osg
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (push)
|
||||||
|
#pragma warning (disable : 4244)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
@ -28,6 +33,10 @@ extern "C"
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma warning (pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "videodefs.hpp"
|
#include "videodefs.hpp"
|
||||||
|
|
||||||
#define VIDEO_PICTURE_QUEUE_SIZE 50
|
#define VIDEO_PICTURE_QUEUE_SIZE 50
|
||||||
|
|
Loading…
Reference in a new issue