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));

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,6 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: render_simple.h,v 1.6 2008-09-07 10:55:15 c2woody Exp $ */
#if defined (SCALERLINEAR)
static void conc4d(SCALERNAME,SBPP,DBPP,L)(const void *s) {
#else
@ -91,7 +93,7 @@ static void conc4d(SCALERNAME,SBPP,DBPP,R)(const void *s) {
}
#if defined(SCALERLINEAR)
#if (SCALERHEIGHT > 1)
Bitu copyLen = (Bit8u*)line1 - (Bit8u*)WC[0];
Bitu copyLen = (Bitu)((Bit8u*)line1 - (Bit8u*)WC[0]);
BituMove(((Bit8u*)line0)-copyLen+render.scale.outPitch ,WC[0], copyLen );
#endif
#if (SCALERHEIGHT > 2)

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: ems.cpp,v 1.57 2008-08-06 18:32:35 c2woody Exp $ */
/* $Id: ems.cpp,v 1.58 2008-09-07 10:55:15 c2woody Exp $ */
#include <string.h>
#include <stdlib.h>
@ -437,7 +437,7 @@ static Bit8u EMM_PartialPageMapping(void) {
return EMM_RestoreMappingTable();
break;
case 0x02: /* Get Partial Page Map Array Size */
reg_al=2+reg_bx*(2+sizeof(EMM_Mapping));
reg_al=(Bit8u)(2+reg_bx*(2+sizeof(EMM_Mapping)));
break;
default:
LOG(LOG_MISC,LOG_ERROR)("EMS:Call %2X Subfunction %2X not supported",reg_ah,reg_al);
@ -1237,7 +1237,7 @@ public:
/* Add a little hack so it appears that there is an actual ems device installed */
char const* emsname="EMMXXXX0";
if(!emsnameseg) emsnameseg=DOS_GetMemory(2); //We have 32 bytes
MEM_BlockWrite(PhysMake(emsnameseg,0xa),emsname,strlen(emsname)+1);
MEM_BlockWrite(PhysMake(emsnameseg,0xa),emsname,(Bitu)(strlen(emsname)+1));
/* Copy the callback piece into the beginning, and set the interrupt vector to it*/
char buf[16];

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: int10_vesa.cpp,v 1.36 2008-05-10 17:33:28 c2woody Exp $ */
/* $Id: int10_vesa.cpp,v 1.37 2008-09-07 10:55:15 c2woody Exp $ */
#include <string.h>
#include <stddef.h>
@ -484,7 +484,7 @@ void INT10_SetupVESA(void) {
phys_writew(PhysMake(0xc000,int10.rom.used),0xffff);
int10.rom.used+=2;
int10.rom.oemstring=RealMake(0xc000,int10.rom.used);
Bitu len=strlen(string_oem)+1;
Bitu len=(Bitu)(strlen(string_oem)+1);
for (i=0;i<len;i++) {
phys_writeb(0xc0000+int10.rom.used++,string_oem[i]);
}

View file

@ -19,7 +19,7 @@
/* TODO:
- make menu a bufferedwindow with shadow
*/
/* $Id: gui_tk.cpp,v 1.3 2008-08-06 18:33:47 c2woody Exp $ */
/* $Id: gui_tk.cpp,v 1.4 2008-09-07 10:55:15 c2woody Exp $ */
/** \file
* \brief Implementation file for gui_tk.
@ -63,7 +63,7 @@ RGB TitlebarText = 0xffffffff;
void Drawable::drawText(const String& text, bool interpret, Size start, Size len) {
if (interpret) {
if (len > text.size()-start) len = text.size()-start;
if (len > text.size()-start) len = (Size)(text.size()-start);
len += start;
Size wordstart = start;
@ -859,7 +859,7 @@ bool Input::keyDown(const Key &key)
start_sel = end_sel = pos;
} else {
start_sel = 0;
pos = end_sel = text.size();
pos = end_sel = (Size)text.size();
}
break;
case 24:
@ -905,7 +905,7 @@ bool Input::keyDown(const Key &key)
case Key::End:
if (multi) {
while (pos < text.size() && f->toSpecial(text[pos]) != Font::LF) pos++;
} else pos = text.size();
} else pos = (Size)text.size();
break;
case Key::Backspace:
if (!key.shift && start_sel != end_sel) clearSelection();

View file

@ -102,7 +102,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
/* $Id: gui_tk.h,v 1.4 2008-08-09 19:42:26 qbix79 Exp $ */
/* $Id: gui_tk.h,v 1.5 2008-09-07 10:55:15 c2woody Exp $ */
#ifndef GUI__TOOLKIT_H
#define GUI__TOOLKIT_H
@ -435,7 +435,7 @@ template <typename STR> void NativeString<STR*>::getString(String &dest, const S
}
template <typename STR> STR* NativeString<STR*>::getNative(const String &src) {
Size strlen = src.size();
Size strlen = (Size)src.size();
STR* dest = new STR[strlen+1];
dest[strlen] = 0;
for (; strlen > 0; strlen--) dest[strlen-1] = src[strlen-1];
@ -447,12 +447,12 @@ template <> class NativeString<std::string*> {
protected:
friend class String;
static void getString(String &dest, const std::string *src) {
Size strlen = src->length();
Size strlen = (Size)src->length();
dest.resize(strlen);
for (Size i = 0; i< strlen; i++) dest[i] = (*src)[i];
}
static std::string* getNative(const String &src) {
Size strlen = src.size();
Size strlen = (Size)src.size();
std::string* dest = new std::string();
for (Size i = 0; i < strlen; i++) dest->append(1,src[i]);
src.addNative(new String::NativeObject<std::string>(dest));
@ -466,12 +466,12 @@ template <> class NativeString<std::string> {
protected:
friend class String;
static void getString(String &dest, const std::string &src) {
Size strlen = src.length();
Size strlen = (Size)src.length();
dest.resize(strlen);
for (Size i = 0; i< strlen; i++) dest[i] = src[i];
}
static std::string& getNative(const String &src) {
Size strlen = src.size();
Size strlen = (Size)src.size();
std::string* dest = new std::string();
for (Size i = 0; i < strlen; i++) dest->append(1,src[i]);
src.addNative(new String::NativeObject<std::string>(dest));
@ -1133,7 +1133,11 @@ protected:
/// Draw \p len characters to a drawable at the current position, starting at string position \p start.
/** This can be used to provide kerning. */
virtual void drawString(Drawable *d, const String &s, Size start, Size len) const { if (len > s.size()-start) len = s.size()-start; len += start; while (start < len) drawChar(d,s[start++]); }
virtual void drawString(Drawable *d, const String &s, Size start, Size len) const {
if (len > s.size()-start) len = (Size)(s.size()-start);
len += start;
while (start < len) drawChar(d,s[start++]);
}
public:
/// Return a font with the given name (case-sensitive).
@ -1173,7 +1177,7 @@ public:
/** Can be used to provide kerning. */
virtual int getWidth(const String &s, Size start = 0, Size len = (Size)-1) const {
int width = 0;
if (start+len > s.size()) len = s.size()-start;
if (start+len > s.size()) len = (Size)(s.size()-start);
while (len--) width += getWidth(s[start++]);
return width;
}
@ -1506,7 +1510,7 @@ public:
String c = getClipboard();
clearSelection();
text.insert(text.begin()+pos,c.begin(),c.end());
start_sel = end_sel = pos += c.size();
start_sel = end_sel = pos += (Size)c.size();
}
/// get character position corresponding to coordinates
@ -1852,7 +1856,7 @@ public:
else if (key.special == Key::Escape) { setVisible(false); return true; }
else return true;
if (items[selected].size() == 0 && items.size() > 1) return keyDown(key);
if (selected < 0) selected = items.size()-1;
if (selected < 0) selected = (int)(items.size()-1);
if (selected >= (int)items.size()) selected = 0;
return true;
}
@ -1988,7 +1992,7 @@ public:
if (selected >= 0 && !menus[selected]->isVisible()) oldselected = -1;
if (selected >= 0) menus[selected]->setVisible(false);
if (x < 0 || x >= lastx) return true;
for (selected = menus.size()-1; menus[selected]->getX() > x; selected--) {};
for (selected = (int)(menus.size()-1); menus[selected]->getX() > x; selected--) {};
if (oldselected == selected) selected = -1;
else menus[selected]->setVisible(true);
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: programs.cpp,v 1.32 2008-07-26 19:06:26 qbix79 Exp $ */
/* $Id: programs.cpp,v 1.33 2008-09-07 10:55:15 c2woody Exp $ */
#include <vector>
#include <ctype.h>
@ -126,12 +126,12 @@ void Program::WriteOut(const char * format,...) {
vsnprintf(buf,2047,format,msg);
va_end(msg);
Bit16u size = strlen(buf);
Bit16u size = (Bit16u)strlen(buf);
DOS_WriteFile(STDOUT,(Bit8u *)buf,&size);
}
void Program::WriteOut_NoParsing(const char * format) {
Bit16u size = strlen(format);
Bit16u size = (Bit16u)strlen(format);
DOS_WriteFile(STDOUT,(Bit8u *)format,&size);
}
@ -145,7 +145,7 @@ bool Program::GetEnvStr(const char * entry,std::string & result) {
do {
MEM_StrCopy(env_read,env_string,1024);
if (!env_string[0]) return false;
env_read+=strlen(env_string)+1;
env_read += (PhysPt)(strlen(env_string)+1);
char* equal = strchr(env_string,'=');
if (!equal) continue;
/* replace the = with \0 to get the length */
@ -167,7 +167,7 @@ bool Program::GetEnvNum(Bitu num,std::string & result) {
MEM_StrCopy(env_read,env_string,1024);
if (!env_string[0]) break;
if (!num) { result=env_string;return true;}
env_read+=strlen(env_string)+1;
env_read += (PhysPt)(strlen(env_string)+1);
num--;
} while (1);
return false;
@ -191,12 +191,12 @@ bool Program::SetEnv(const char * entry,const char * new_string) {
do {
MEM_StrCopy(env_read,env_string,1024);
if (!env_string[0]) break;
env_read+=strlen(env_string)+1;
env_read += (PhysPt)(strlen(env_string)+1);
if (!strchr(env_string,'=')) continue; /* Remove corrupt entry? */
if ((strncasecmp(entry,env_string,strlen(entry))==0) &&
env_string[strlen(entry)]=='=') continue;
MEM_BlockWrite(env_write,env_string,strlen(env_string)+1);
env_write+=strlen(env_string)+1;
MEM_BlockWrite(env_write,env_string,(Bitu)(strlen(env_string)+1));
env_write += (PhysPt)(strlen(env_string)+1);
} while (1);
/* TODO Maybe save the program name sometime. not really needed though */
/* Save the new entry */
@ -205,8 +205,8 @@ bool Program::SetEnv(const char * entry,const char * new_string) {
for (std::string::iterator it = bigentry.begin(); it != bigentry.end(); ++it) *it = toupper(*it);
sprintf(env_string,"%s=%s",bigentry.c_str(),new_string);
// sprintf(env_string,"%s=%s",entry,new_string); //oldcode
MEM_BlockWrite(env_write,env_string,strlen(env_string)+1);
env_write+=strlen(env_string)+1;
MEM_BlockWrite(env_write,env_string,(Bitu)(strlen(env_string)+1));
env_write += (PhysPt)(strlen(env_string)+1);
}
/* Clear out the final piece of the environment */
mem_writed(env_write,0);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: setup.cpp,v 1.50 2008-08-06 18:32:35 c2woody Exp $ */
/* $Id: setup.cpp,v 1.51 2008-09-07 10:55:15 c2woody Exp $ */
#include "dosbox.h"
#include "cross.h"
@ -872,7 +872,7 @@ bool CommandLine::GetStringRemain(std::string & value) {
unsigned int CommandLine::GetCount(void) {
return cmds.size();
return (unsigned int)cmds.size();
}
CommandLine::CommandLine(int argc,char const * const argv[]) {

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: shell.cpp,v 1.93 2008-09-06 14:47:15 c2woody Exp $ */
/* $Id: shell.cpp,v 1.94 2008-09-07 10:55:16 c2woody Exp $ */
#include <stdlib.h>
#include <stdarg.h>
@ -99,7 +99,7 @@ void AutoexecObject::CreateAutoexec(void) {
}
sprintf((autoexec_data+auto_len),"%s\r\n",(*it).c_str());
}
if(first_shell) VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,strlen(autoexec_data));
if(first_shell) VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,(Bit32u)strlen(autoexec_data));
}
AutoexecObject::~AutoexecObject(){
@ -430,7 +430,7 @@ public:
}
}
nomount:
VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,strlen(autoexec_data));
VFILE_Register("AUTOEXEC.BAT",(Bit8u *)autoexec_data,(Bit32u)strlen(autoexec_data));
}
};
@ -598,14 +598,14 @@ void SHELL_Init() {
/* Setup environment */
PhysPt env_write=PhysMake(env_seg,0);
MEM_BlockWrite(env_write,path_string,strlen(path_string)+1);
env_write+=strlen(path_string)+1;
MEM_BlockWrite(env_write,comspec_string,strlen(comspec_string)+1);
env_write+=strlen(comspec_string)+1;
MEM_BlockWrite(env_write,path_string,(Bitu)(strlen(path_string)+1));
env_write += (PhysPt)(strlen(path_string)+1);
MEM_BlockWrite(env_write,comspec_string,(Bitu)(strlen(comspec_string)+1));
env_write += (PhysPt)(strlen(comspec_string)+1);
mem_writeb(env_write++,0);
mem_writew(env_write,1);
env_write+=2;
MEM_BlockWrite(env_write,full_name,strlen(full_name)+1);
MEM_BlockWrite(env_write,full_name,(Bitu)(strlen(full_name)+1));
DOS_PSP psp(psp_seg);
psp.MakeNew(0);
@ -629,7 +629,7 @@ void SHELL_Init() {
psp.SetEnvironment(env_seg);
/* Set the command line for the shell start up */
CommandTail tail;
tail.count=strlen(init_line);
tail.count=(Bit8u)strlen(init_line);
strcpy(tail.buffer,init_line);
MEM_BlockWrite(PhysMake(psp_seg,128),&tail,128);

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: shell_cmds.cpp,v 1.83 2008-08-11 12:54:57 qbix79 Exp $ */
/* $Id: shell_cmds.cpp,v 1.84 2008-09-07 10:55:16 c2woody Exp $ */
#include "dosbox.h"
#include "shell.h"
@ -413,7 +413,7 @@ void DOS_Shell::CMD_DIR(char * args) {
char buffer[CROSS_LEN];
args = trim(args);
Bit32u argLen = strlen(args);
size_t argLen = strlen(args);
if (argLen == 0) {
strcpy(args,"*.*"); //no arguments.
} else {
@ -481,7 +481,10 @@ void DOS_Shell::CMD_DIR(char * args) {
if (attr & DOS_ATTR_DIRECTORY) {
if (optW) {
WriteOut("[%s]",name);
for (Bitu i=14-strlen(name);i>0;i--) WriteOut(" ");
size_t namelen = strlen(name);
if ((namelen>=0) && (namelen<=14)) {
for (Bitu i=14-(Bitu)namelen;i>0;i--) WriteOut(" ");
}
} else {
WriteOut("%-8s %-3s %-16s %02d-%02d-%04d %2d:%02d\n",name,ext,"<DIR>",day,month,year,hour,minute);
}
@ -1003,7 +1006,7 @@ void DOS_Shell::CMD_CHOICE(char * args){
} while (!c || !(ptr = strchr(rem,(optS?c:toupper(c)))));
c = optS?c:toupper(c);
DOS_WriteFile (STDOUT,&c, &n);
dos.return_code = ptr-rem+1;
dos.return_code = (Bit8u)(ptr-rem+1);
}
void DOS_Shell::CMD_ATTRIB(char *args){

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: shell_misc.cpp,v 1.52 2008-03-02 11:13:47 qbix79 Exp $ */
/* $Id: shell_misc.cpp,v 1.53 2008-09-07 10:55:16 c2woody Exp $ */
#include <stdlib.h>
#include <string.h>
@ -78,7 +78,7 @@ void DOS_Shell::InputCommand(char * line) {
line[str_index ++] = c;
DOS_WriteFile(STDOUT,&c,&n);
}
str_len = str_index = it_history->length();
str_len = str_index = (Bitu)it_history->length();
size = CMD_MAXLINE - str_index - 2;
line[str_len] = 0;
}
@ -124,7 +124,7 @@ void DOS_Shell::InputCommand(char * line) {
outc(8); outc(' '); outc(8);
}
strcpy(line, it_history->c_str());
len = it_history->length();
len = (Bit16u)it_history->length();
str_len = str_index = len;
size = CMD_MAXLINE - str_index - 2;
DOS_WriteFile(STDOUT, (Bit8u *)line, &len);
@ -153,7 +153,7 @@ void DOS_Shell::InputCommand(char * line) {
outc(8); outc(' '); outc(8);
}
strcpy(line, it_history->c_str());
len = it_history->length();
len = (Bit16u)it_history->length();
str_len = str_index = len;
size = CMD_MAXLINE - str_index - 2;
DOS_WriteFile(STDOUT, (Bit8u *)line, &len);
@ -224,15 +224,15 @@ void DOS_Shell::InputCommand(char * line) {
if (p_completion_start) {
p_completion_start ++;
completion_index = str_len - strlen(p_completion_start);
completion_index = (Bit16u)(str_len - strlen(p_completion_start));
} else {
p_completion_start = line;
completion_index = 0;
}
char *path;
if ((path = strrchr(line+completion_index,'\\'))) completion_index = path-line+1;
if ((path = strrchr(line+completion_index,'/'))) completion_index = path-line+1;
if ((path = strrchr(line+completion_index,'\\'))) completion_index = (Bit16u)(path-line+1);
if ((path = strrchr(line+completion_index,'/'))) completion_index = (Bit16u)(path-line+1);
// build the completion list
char mask[DOS_PATHLENGTH];
@ -295,7 +295,7 @@ void DOS_Shell::InputCommand(char * line) {
}
strcpy(&line[completion_index], it_completion->c_str());
len = it_completion->length();
len = (Bit16u)it_completion->length();
str_len = str_index = completion_index + len;
size = CMD_MAXLINE - str_index - 2;
DOS_WriteFile(STDOUT, (Bit8u *)it_completion->c_str(), &len);
@ -448,7 +448,7 @@ bool DOS_Shell::Execute(char * name,char * args) {
block.Clear();
//Add a filename
RealPt file_name=RealMakeSeg(ss,reg_sp+0x20);
MEM_BlockWrite(Real2Phys(file_name),fullname,strlen(fullname)+1);
MEM_BlockWrite(Real2Phys(file_name),fullname,(Bitu)(strlen(fullname)+1));
/* HACK: Store full commandline for mount and imgmount */
full_arguments.assign(line);
@ -458,7 +458,7 @@ bool DOS_Shell::Execute(char * name,char * args) {
cmdtail.count = 0;
memset(&cmdtail.buffer,0,126); //Else some part of the string is unitialized (valgrind)
if (strlen(line)>126) line[126]=0;
cmdtail.count=strlen(line);
cmdtail.count=(Bit8u)strlen(line);
memcpy(cmdtail.buffer,line,strlen(line));
cmdtail.buffer[strlen(line)]=0xd;
/* Copy command line in stack block too */