Warning fixes.

This commit is contained in:
leo 2016-03-06 20:19:02 +00:00
parent 836a508224
commit 9278a6fe1e
8 changed files with 17 additions and 14 deletions

View file

@ -151,7 +151,7 @@ bool Image::FileLoad(lcMemFile& File)
unsigned char* Buffer = File.mBuffer + File.mPosition; unsigned char* Buffer = File.mBuffer + File.mPosition;
size_t BufferLength = File.mFileSize - File.mPosition; size_t BufferLength = File.mFileSize - File.mPosition;
if (!Image.loadFromData(Buffer, BufferLength)) if (!Image.loadFromData(Buffer, (int)BufferLength))
return false; return false;
CopyFromQImage(Image, *this); CopyFromQImage(Image, *this);

View file

@ -45,7 +45,7 @@ void lcMemFile::Seek(long Offset, int From)
long lcMemFile::GetPosition() const long lcMemFile::GetPosition() const
{ {
return mPosition; return (long)mPosition;
} }
void lcMemFile::SetLength(size_t NewLength) void lcMemFile::SetLength(size_t NewLength)
@ -206,7 +206,7 @@ void lcDiskFile::Seek(long Offset, int From)
void lcDiskFile::SetLength(size_t NewLength) void lcDiskFile::SetLength(size_t NewLength)
{ {
fseek(mFile, NewLength, SEEK_SET); fseek(mFile, (int)NewLength, SEEK_SET);
} }
size_t lcDiskFile::GetLength() const size_t lcDiskFile::GetLength() const
@ -267,7 +267,7 @@ bool lcDiskFile::Open(const char* FileName, const char* Mode)
char* lcDiskFile::ReadLine(char* Buffer, size_t BufferSize) char* lcDiskFile::ReadLine(char* Buffer, size_t BufferSize)
{ {
return fgets(Buffer, BufferSize, mFile); return fgets(Buffer, (int)BufferSize, mFile);
} }
void lcDiskFile::CopyFrom(lcMemFile& Source) void lcDiskFile::CopyFrom(lcMemFile& Source)

View file

@ -394,7 +394,7 @@ bool lcMesh::FileSave(lcMemFile& File)
if (Section.Texture) if (Section.Texture)
{ {
size_t Length = strlen(Section.Texture->mName); lcuint16 Length = (lcuint16)strlen(Section.Texture->mName);
File.WriteU16(Length); File.WriteU16(Length);
File.WriteBuffer(Section.Texture->mName, Length); File.WriteBuffer(Section.Texture->mName, Length);
} }

View file

@ -802,7 +802,7 @@ bool lcZipFile::AddFile(const char* FileName, lcMemFile& File)
Info.crc = Crc32; Info.crc = Crc32;
Info.compressed_size = CompressedFile.GetLength(); Info.compressed_size = CompressedFile.GetLength();
Info.uncompressed_size = File.GetLength(); Info.uncompressed_size = File.GetLength();
Info.size_filename = strlen(FileName); Info.size_filename = (lcuint16)strlen(FileName);
Info.size_file_extra = 0; Info.size_file_extra = 0;
Info.size_file_comment = 0; Info.size_file_comment = 0;
Info.disk_num_start = 0; Info.disk_num_start = 0;

View file

@ -619,7 +619,7 @@ void Project::Export3DStudio(const QString& FileName)
File.WriteU16(0x1100); // CHK_BIT_MAP File.WriteU16(0x1100); // CHK_BIT_MAP
QByteArray BackgroundImage = Properties.mBackgroundImage.toLatin1(); QByteArray BackgroundImage = Properties.mBackgroundImage.toLatin1();
File.WriteU32(6 + 1 + strlen(BackgroundImage.constData())); File.WriteU32(6 + 1 + (lcuint32)strlen(BackgroundImage.constData()));
File.WriteBuffer(BackgroundImage.constData(), strlen(BackgroundImage.constData()) + 1); File.WriteBuffer(BackgroundImage.constData(), strlen(BackgroundImage.constData()) + 1);
File.WriteU16(0x1300); // CHK_V_GRADIENT File.WriteU16(0x1300); // CHK_V_GRADIENT

View file

@ -62,7 +62,7 @@ const String& String::operator+= (const String& src)
const String& String::operator+= (char ch) const String& String::operator+= (char ch)
{ {
int len = GetLength (); size_t len = GetLength ();
char *tmp = new char[len + 1 + 1]; char *tmp = new char[len + 1 + 1];
strcpy (tmp, m_pData); strcpy (tmp, m_pData);
tmp[len] = ch; tmp[len] = ch;
@ -138,7 +138,7 @@ String& String::Mid (int first, int count) const
if (count < 0) if (count < 0)
count = 0; count = 0;
else if (count > (int)GetLength ()) else if (count > (int)GetLength ())
count = GetLength (); count = (int)GetLength ();
String s; String s;
strncpy (s.GetBuffer (count+1), m_pData + first, count); strncpy (s.GetBuffer (count+1), m_pData + first, count);
@ -153,7 +153,7 @@ String& String::Left (int count) const
if (count < 0) if (count < 0)
count = 0; count = 0;
else if (count > (int)GetLength ()) else if (count > (int)GetLength ())
count = GetLength (); count = (int)GetLength ();
String s; String s;
strncpy (s.GetBuffer (count+1), m_pData, count); strncpy (s.GetBuffer (count+1), m_pData, count);
@ -168,7 +168,7 @@ String& String::Right (int count) const
if (count < 0) if (count < 0)
count = 0; count = 0;
else if (count > (int)GetLength ()) else if (count > (int)GetLength ())
count = GetLength (); count = (int)GetLength ();
String s; String s;
strncpy (s.GetBuffer (count+1), m_pData + GetLength () - count, count); strncpy (s.GetBuffer (count+1), m_pData + GetLength () - count, count);
@ -223,7 +223,7 @@ bool String::Match(const String& Expression) const
String LeftStr, RightStr; String LeftStr, RightStr;
LeftStr = Expression.Left((p - Expression) - 1); LeftStr = Expression.Left((p - Expression) - 1);
RightStr = Expression.Right(Expression.GetLength() - (p - Expression) - 1); RightStr = Expression.Right((int)Expression.GetLength() - (p - Expression) - 1);
if (*p == '|') if (*p == '|')
return Match(LeftStr) || Match(RightStr); return Match(LeftStr) || Match(RightStr);
@ -302,7 +302,7 @@ bool String::Match(const String& Expression) const
if (WholeWord) if (WholeWord)
{ {
char End = GetAt(Result + strlen(Word)); char End = GetAt(Result + (int)strlen(Word));
if ((End != 0) && (End != ' ')) if ((End != 0) && (End != ' '))
return false; return false;

View file

@ -224,7 +224,7 @@ void TexFont::PrintText(lcContext* Context, float Left, float Top, float Z, cons
Context->SetVertexBufferPointer(Verts); Context->SetVertexBufferPointer(Verts);
Context->SetVertexFormat(0, 3, 2, 0); Context->SetVertexFormat(0, 3, 2, 0);
Context->DrawPrimitives(GL_QUADS, 0, 4 * Length); Context->DrawPrimitives(GL_QUADS, 0, 4 * (GLsizei)Length);
Context->ClearVertexBuffer(); // context remove Context->ClearVertexBuffer(); // context remove

View file

@ -9,9 +9,12 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#pragma warning(push)
#pragma warning(disable : 4091)
#include <dbghelp.h> #include <dbghelp.h>
#include <direct.h> #include <direct.h>
#include <shlobj.h> #include <shlobj.h>
#pragma warning(pop)
#ifdef UNICODE #ifdef UNICODE
#ifndef _UNICODE #ifndef _UNICODE