1
0
Fork 0

fix some msvc64bit warnings

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3217
This commit is contained in:
Sebastian Strohhäcker 2008-09-07 10:55:16 +00:00
parent a94ef4eddc
commit c994a9a25e
23 changed files with 145 additions and 128 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cdrom_aspi_win32.cpp,v 1.19 2008-08-06 18:32:34 c2woody Exp $ */
/* $Id: cdrom_aspi_win32.cpp,v 1.20 2008-09-07 10:55:14 c2woody Exp $ */
#if defined (WIN32)
@ -224,9 +224,9 @@ bool CDROM_Interface_Aspi::GetVendor(BYTE HA_num, BYTE SCSI_Id, BYTE SCSI_Lun, c
return false;
} else {
safe_strncpy(szBuffer,szBuffer+8,26);
int len = strlen(szBuffer);
for (int i=0; i<len; i++) if (szBuffer[i]<=32) szBuffer[i]='_';
};
size_t len = strlen(szBuffer);
for (size_t i=0; i<len; i++) if (szBuffer[i]<=32) szBuffer[i]='_';
}
return true;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2008 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: cdrom_image.cpp,v 1.20 2008-04-19 09:25:48 qbix79 Exp $ */
/* $Id: cdrom_image.cpp,v 1.21 2008-09-07 10:55:14 c2woody Exp $ */
#include <cctype>
#include <cmath>
@ -65,7 +65,7 @@ bool CDROM_Interface_Image::BinaryFile::read(Bit8u *buffer, int seek, int count)
int CDROM_Interface_Image::BinaryFile::getLength()
{
file->seekg(0, ios::end);
int length = file->tellg();
int length = (int)file->tellg();
if (file->fail()) return -1;
return length;
}
@ -170,7 +170,7 @@ bool CDROM_Interface_Image::SetDevice(char* path, int forceCD)
// print error message on dosbox console
char buf[MAX_LINE_LENGTH];
snprintf(buf, MAX_LINE_LENGTH, "Could not load image file: %s\n", path);
Bit16u size = strlen(buf);
Bit16u size = (Bit16u)strlen(buf);
DOS_WriteFile(STDOUT, (Bit8u*)buf, &size);
return false;
}
@ -185,7 +185,7 @@ bool CDROM_Interface_Image::GetUPC(unsigned char& attr, char* upc)
bool CDROM_Interface_Image::GetAudioTracks(int& stTrack, int& end, TMSF& leadOut)
{
stTrack = 1;
end = tracks.size() - 1;
end = (int)(tracks.size() - 1);
FRAMES_TO_MSF(tracks[tracks.size() - 1].start + 150, &leadOut.min, &leadOut.sec, &leadOut.fr);
return true;
}
@ -639,7 +639,7 @@ bool CDROM_Interface_Image::GetCueFrame(int &frames, istream &in)
bool CDROM_Interface_Image::GetCueString(string &str, istream &in)
{
int pos = in.tellg();
int pos = (int)in.tellg();
in >> str;
if (str[0] == '\"') {
if (str[str.size() - 1] == '\"') {

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos.cpp,v 1.112 2008-05-28 09:53:31 qbix79 Exp $ */
/* $Id: dos.cpp,v 1.113 2008-09-07 10:55:14 c2woody Exp $ */
#include <stdlib.h>
#include <string.h>
@ -645,7 +645,7 @@ static Bitu DOS_21Handler(void) {
break;
case 0x47: /* CWD Get current directory */
if (DOS_GetCurrentDir(reg_dl,name1)) {
MEM_BlockWrite(SegPhys(ds)+reg_si,name1,strlen(name1)+1);
MEM_BlockWrite(SegPhys(ds)+reg_si,name1,(Bitu)(strlen(name1)+1));
reg_ax=0x0100;
CALLBACK_SCF(false);
} else {
@ -821,7 +821,7 @@ static Bitu DOS_21Handler(void) {
MEM_StrCopy(SegPhys(ds)+reg_dx,name1,DOSNAMEBUF);
if (DOS_CreateTempFile(name1,&handle)) {
reg_ax=handle;
MEM_BlockWrite(SegPhys(ds)+reg_dx,name1,strlen(name1)+1);
MEM_BlockWrite(SegPhys(ds)+reg_dx,name1,(Bitu)(strlen(name1)+1));
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;
@ -870,7 +870,7 @@ static Bitu DOS_21Handler(void) {
case 0x60: /* Canonicalize filename or path */
MEM_StrCopy(SegPhys(ds)+reg_si,name1,DOSNAMEBUF);
if (DOS_Canonicalize(name1,name2)) {
MEM_BlockWrite(SegPhys(es)+reg_di,name2,strlen(name2)+1);
MEM_BlockWrite(SegPhys(es)+reg_di,name2,(Bitu)(strlen(name2)+1));
CALLBACK_SCF(false);
} else {
reg_ax=dos.errorcode;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2008 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_classes.cpp,v 1.54 2008-01-21 21:26:49 qbix79 Exp $ */
/* $Id: dos_classes.cpp,v 1.55 2008-09-07 10:55:14 c2woody Exp $ */
#include <string.h>
#include <stdlib.h>
@ -25,12 +25,6 @@
#include "dos_inc.h"
#include "support.h"
/*
Work in progress, making classes for handling certain internal memory structures in dos
This should make it somewhat easier for porting to other endian machines and make
dos work a bit easier.
*/
void DOS_ParamBlock::Clear(void) {
memset(&exec,0,sizeof(exec));
@ -345,12 +339,13 @@ void DOS_DTA::SetupSearch(Bit8u _sdrive,Bit8u _sattr,char * pattern) {
char * find_ext;
find_ext=strchr(pattern,'.');
if (find_ext) {
Bitu size=find_ext-pattern;if (size>8) size=8;
Bitu size=(Bitu)(find_ext-pattern);
if (size>8) size=8;
MEM_BlockWrite(pt+offsetof(sDTA,sname),pattern,size);
find_ext++;
MEM_BlockWrite(pt+offsetof(sDTA,sext),find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));
MEM_BlockWrite(pt+offsetof(sDTA,sext),find_ext,(strlen(find_ext)>3) ? 3 : (Bitu)strlen(find_ext));
} else {
MEM_BlockWrite(pt+offsetof(sDTA,sname),pattern,(strlen(pattern) > 8) ? 8 : strlen(pattern));
MEM_BlockWrite(pt+offsetof(sDTA,sname),pattern,(strlen(pattern) > 8) ? 8 : (Bitu)strlen(pattern));
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2008 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_execute.cpp,v 1.63 2007-11-18 10:30:12 c2woody Exp $ */
/* $Id: dos_execute.cpp,v 1.64 2008-09-07 10:55:14 c2woody Exp $ */
#include <string.h>
#include <ctype.h>
@ -201,7 +201,7 @@ static bool MakeEnv(char * name,Bit16u * segment) {
envwrite+=2;
char namebuf[DOS_PATHLENGTH];
if (DOS_Canonicalize(name,namebuf)) {
MEM_BlockWrite(envwrite,namebuf,strlen(namebuf)+1);
MEM_BlockWrite(envwrite,namebuf,(Bitu)(strlen(namebuf)+1));
return true;
} else return false;
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_files.cpp,v 1.98 2008-08-06 18:32:34 c2woody Exp $ */
/* $Id: dos_files.cpp,v 1.99 2008-09-07 10:55:14 c2woody Exp $ */
#include <string.h>
#include <stdlib.h>
@ -153,7 +153,7 @@ bool DOS_MakeName(char const * const name,char * const fullname,Bit8u * drive) {
}
lastdir=strlen(fullname);
lastdir=(Bit32u)strlen(fullname);
if (lastdir!=0) strcat(fullname,"\\");
char * ext=strchr(tempdir,'.');
@ -814,9 +814,11 @@ static void DTAExtendName(char * const name,char * const filename,char * const e
*find=0;
} else ext[0]=0;
strcpy(filename,name);
Bitu i;
for (i=strlen(name);i<8;i++) filename[i]=' ';filename[8]=0;
for (i=strlen(ext);i<3;i++) ext[i]=' ';ext[3]=0;
size_t i;
for (i=strlen(name);i<8;i++) filename[i]=' ';
filename[8]=0;
for (i=strlen(ext);i<3;i++) ext[i]=' ';
ext[3]=0;
}
static void SaveFindResult(DOS_FCB & find_fcb) {

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_ioctl.cpp,v 1.32 2008-05-25 17:24:59 c2woody Exp $ */
/* $Id: dos_ioctl.cpp,v 1.33 2008-09-07 10:55:14 c2woody Exp $ */
#include <string.h>
#include "dosbox.h"
@ -152,7 +152,8 @@ bool DOS_IOCTL(void) {
char const* find_ext=strchr(bufin,'.');
if (find_ext) {
Bitu size=find_ext-bufin;if (size>8) size=8;
Bitu size=(Bitu)(find_ext-bufin);
if (size>8) size=8;
memcpy(buffer,bufin,size);
find_ext++;
memcpy(buffer+size,find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_misc.cpp,v 1.19 2008-08-06 18:32:34 c2woody Exp $ */
/* $Id: dos_misc.cpp,v 1.20 2008-09-07 10:55:14 c2woody Exp $ */
#include "dosbox.h"
#include "callback.h"
@ -120,22 +120,26 @@ static bool DOS_MultiplexFunctions(void) {
nlen-=(extlen+1);
if (nlen>8) nlen=8;
for (Bitu i=0; i<nlen; i++)
mem_writeb(sftptr+sftofs+0x20+i,filename[i]);
for (Bitu i=nlen; i<8; i++)
mem_writeb(sftptr+sftofs+0x20+i,' ');
size_t i;
for (i=0; i<nlen; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x20+i),filename[i]);
for (i=nlen; i<8; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x20+i),' ');
if (extlen>3) extlen=3;
for (Bitu i=0; i<extlen; i++)
mem_writeb(sftptr+sftofs+0x28+i,dotpos[i]);
for (Bitu i=extlen; i<3; i++)
mem_writeb(sftptr+sftofs+0x28+i,' ');
for (i=0; i<extlen; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x28+i),dotpos[i]);
for (i=extlen; i<3; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x28+i),' ');
} else {
size_t i;
size_t nlen=strlen(filename);
if (nlen>8) nlen=8;
for (Bitu i=0; i<nlen; i++)
mem_writeb(sftptr+sftofs+0x20+i,filename[i]);
for (Bitu i=nlen; i<11; i++)
mem_writeb(sftptr+sftofs+0x20+i,' ');
for (i=0; i<nlen; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x20+i),filename[i]);
for (i=nlen; i<11; i++)
mem_writeb((PhysPt)(sftptr+sftofs+0x20+i),' ');
}
SegSet16(es,RealSeg(sftrealpt));

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_mscdex.cpp,v 1.54 2008-08-06 18:32:34 c2woody Exp $ */
/* $Id: dos_mscdex.cpp,v 1.55 2008-09-07 10:55:14 c2woody Exp $ */
#include <string.h>
#include <ctype.h>
@ -666,10 +666,10 @@ bool CMscdex::GetDirectoryEntry(Bit16u drive, bool copyFlag, PhysPt pathname, Ph
upcase(searchName);
char* searchPos = searchName;
//strip of tailing . (XCOM APOCALIPSE)
int searchlen = strlen(searchName);
if(searchlen > 1 && strcmp(searchName,".."))
if(searchName[searchlen-1] =='.') searchName[searchlen-1] = 0;
//strip of tailing . (XCOM APOCALYPSE)
size_t searchlen = strlen(searchName);
if (searchlen > 1 && strcmp(searchName,".."))
if (searchName[searchlen-1] =='.') searchName[searchlen-1] = 0;
//LOG(LOG_MISC,LOG_ERROR)("MSCDEX: Get DirEntry : Find : %s",searchName);
// read vtoc

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_programs.cpp,v 1.86 2008-08-06 18:32:34 c2woody Exp $ */
/* $Id: dos_programs.cpp,v 1.87 2008-09-07 10:55:14 c2woody Exp $ */
#include "dosbox.h"
#include <stdlib.h>
@ -678,7 +678,7 @@ public:
FILE *tfile = getFSFile("system.rom", &sz1, &sz2, true);
if (tfile!=NULL) {
fseek(tfile, 0x3000L, SEEK_SET);
Bit32u drd=fread(rombuf, 1, 0xb000, tfile);
Bit32u drd=(Bit32u)fread(rombuf, 1, 0xb000, tfile);
if (drd==0xb000) {
for(i=0;i<0xb000;i++) phys_writeb(0xf3000+i,rombuf[i]);
}
@ -1075,7 +1075,7 @@ public:
}
// find all file parameters, assuming that all option parameters have been removed
while(cmd->FindCommand(paths.size() + 2, temp_line) && temp_line.size()) {
while(cmd->FindCommand((unsigned int)(paths.size() + 2), temp_line) && temp_line.size()) {
struct stat test;
if (stat(temp_line.c_str(),&test)) {

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drive_iso.cpp,v 1.23 2008-05-24 18:50:39 c2woody Exp $ */
/* $Id: drive_iso.cpp,v 1.24 2008-09-07 10:55:14 c2woody Exp $ */
#include <cctype>
#include <cstring>
@ -510,8 +510,10 @@ int isoDrive :: readDirEntry(isoDirEntry *de, Bit8u *data)
// remove any file version identifiers as there are some cdroms that don't have them
strreplace((char*)de->ident, ';', 0);
// if file has no extension remove the trailing dot
int tmp = strlen((char*)de->ident);
if (tmp > 0 && de->ident[tmp - 1] == '.') de->ident[tmp - 1] = 0;
size_t tmp = strlen((char*)de->ident);
if (tmp > 0) {
if (de->ident[tmp - 1] == '.') de->ident[tmp - 1] = 0;
}
}
const char* dotpos = strchr((char*)de->ident, '.');
if (dotpos!=NULL) {
@ -554,8 +556,10 @@ bool isoDrive :: lookup(isoDirEntry *de, const char *path)
if (IS_DIR(de->fileFlags)) {
// remove the trailing dot if present
int nameLength = strlen(name);
if (nameLength > 0 && name[nameLength - 1] == '.') name[nameLength - 1] = 0;
size_t nameLength = strlen(name);
if (nameLength > 0) {
if (name[nameLength - 1] == '.') name[nameLength - 1] = 0;
}
// look for the current path element
int dirIterator = GetDirIterator(de);

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2008 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drive_local.cpp,v 1.76 2007-11-01 12:15:34 qbix79 Exp $ */
/* $Id: drive_local.cpp,v 1.77 2008-09-07 10:55:14 c2woody Exp $ */
#include <stdio.h>
#include <stdlib.h>
@ -443,7 +443,7 @@ localDrive::localDrive(const char * startdir,Bit16u _bytes_sector,Bit8u _sectors
bool localFile::Read(Bit8u * data,Bit16u * size) {
if (last_action==WRITE) fseek(fhandle,ftell(fhandle),SEEK_SET);
last_action=READ;
*size=fread(data,1,*size,fhandle);
*size=(Bit16u)fread(data,1,*size,fhandle);
/* Fake harddrive motion. Inspector Gadget with soundblaster compatible */
/* Same for Igor */
/* hardrive motion => unmask irq 2. Only do it when it's masked as unmasking is realitively heavy to emulate */
@ -460,7 +460,7 @@ bool localFile::Write(Bit8u * data,Bit16u * size) {
}
else
{
*size=fwrite(data,1,*size,fhandle);
*size=(Bit16u)fwrite(data,1,*size,fhandle);
return true;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2002-2007 The DOSBox Team
* Copyright (C) 2002-2008 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drives.cpp,v 1.13 2008-01-21 21:25:17 qbix79 Exp $ */
/* $Id: drives.cpp,v 1.14 2008-09-07 10:55:14 c2woody Exp $ */
#include "dosbox.h"
#include "dos_system.h"
@ -40,7 +40,8 @@ bool WildFileCmp(const char * file, const char * wild)
find_ext=strrchr(file,'.');
if (find_ext) {
Bitu size=find_ext-file;if (size>8) size=8;
Bitu size=(Bitu)(find_ext-file);
if (size>8) size=8;
memcpy(file_name,file,size);
find_ext++;
memcpy(file_ext,find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));
@ -50,7 +51,8 @@ bool WildFileCmp(const char * file, const char * wild)
upcase(file_name);upcase(file_ext);
find_ext=strrchr(wild,'.');
if (find_ext) {
Bitu size=find_ext-wild;if (size>8) size=8;
Bitu size=(Bitu)(find_ext-wild);
if (size>8) size=8;
memcpy(wild_name,wild,size);
find_ext++;
memcpy(wild_ext,find_ext,(strlen(find_ext)>3) ? 3 : strlen(find_ext));