From: beware Date: Fri, 22 Nov 2013 02:30:44 +0000 (+0000) Subject: ifdef mswindows instead of win32 for 64 bits support X-Git-Url: http://www.lcore.org/git/lcore.git/commitdiff_plain/968c333d05db5d5ecf3599f8e304c67e64f21159?hp=ed1d49cbe548d9fb26a50f1b2381b693c3c01790 ifdef mswindows instead of win32 for 64 bits support git-svn-id: file:///svnroot/lcore/trunk@127 b1de8a11-f9be-4011-bde0-cc7ace90066a --- diff --git a/binipstuff.pas b/binipstuff.pas index 0b9fcb8..93363e2 100644 --- a/binipstuff.pas +++ b/binipstuff.pas @@ -13,7 +13,7 @@ interface {$include lcoreconfig.inc} uses -{$ifndef win32} +{$ifndef mswindows} sockets, {$endif} pgtypes; @@ -25,7 +25,7 @@ uses const hexchars:array[0..15] of ansichar='0123456789abcdef'; - {$ifdef win32} + {$ifdef mswindows} AF_INET=2; AF_INET6=23; {$else} @@ -39,7 +39,7 @@ const type {$ifdef ipv6} - {$ifdef win32} + {$ifdef mswindows} {$define want_Tin6_addr} {$endif} {$ifdef ver1_0} @@ -70,7 +70,7 @@ type {$endif} end; - {$ifdef win32} + {$ifdef mswindows} TInetSockAddr = packed Record family:Word; port :Word; diff --git a/btime.pas b/btime.pas index 2a4b267..df4f91e 100644 --- a/btime.pas +++ b/btime.pas @@ -12,7 +12,7 @@ unit btime; interface -{$ifdef win32} +{$ifdef mswindows} uses ltimevalstuff; {$endif} @@ -55,7 +55,7 @@ function timestrshort(i:tunixtimeint):string; // Wed Aug 15 16:21:09 2012 function timestriso(i:tunixtimeint):string; // 2012-08-15 16:21:09 function timestrisoutc(i:float):string; // 2012-08-15T14:21:09.255553Z -{$ifdef win32} +{$ifdef mswindows} function unixtimefloat_systemtime:float; {$endif} @@ -63,12 +63,12 @@ function oletounixfloat(t:float):float; function oletounix(t:tdatetime):tunixtimeint; function unixtoole(i:float):tdatetime; -{$ifdef win32} +{$ifdef mswindows} function mmtimefloat:float; function qpctimefloat:float; {$endif} -{$ifdef win32} +{$ifdef mswindows} procedure gettimeofday(var tv:ttimeval); {$endif} @@ -726,7 +726,7 @@ end; procedure init; begin - {$ifdef win32}timebeginperiod(1);{$endif} //ensure stable unchanging clock + {$ifdef mswindows}timebeginperiod(1);{$endif} //ensure stable unchanging clock fillchar(mmtime_driftavg,sizeof(mmtime_driftavg),0); settimebias := 0; gettimezone; diff --git a/dnsasync.pas b/dnsasync.pas index c13f6ab..01bc2ff 100644 --- a/dnsasync.pas +++ b/dnsasync.pas @@ -11,7 +11,7 @@ unit dnsasync; interface uses - {$ifdef win32} + {$ifdef mswindows} dnswin, {$endif} lsocket,lcore, @@ -39,7 +39,7 @@ type dnsserverids : array[0..numsock-1] of integer; startts:double; - {$ifdef win32} + {$ifdef mswindows} dwas : tdnswinasync; {$endif} @@ -49,7 +49,7 @@ type procedure asyncprocess(socketno:integer); procedure receivehandler(sender:tobject;error:word); function sendquery(socketno:integer;const packet:tdnspacket;len:integer):boolean; - {$ifdef win32} + {$ifdef mswindows} procedure winrequestdone(sender:tobject;error:word); {$endif} @@ -199,7 +199,7 @@ begin end; destinations[socketno] := destination; - {$ifdef ipv6}{$ifdef win32} + {$ifdef ipv6}{$ifdef mswindows} if destinations[socketno].family = AF_INET6 then if (requestaf = useaf_default) then requestaf := useaf_preferv6; {$endif}{$endif} @@ -265,7 +265,7 @@ begin if overrideaf = useaf_default then begin {$ifdef ipv6} - {$ifdef win32}if not (usewindns and (addr = '')) then{$endif} + {$ifdef mswindows}if not (usewindns and (addr = '')) then{$endif} initpreferredmode; {$endif} requestaf := useaf; @@ -273,7 +273,7 @@ begin requestaf := overrideaf; end; - {$ifdef win32} + {$ifdef mswindows} if usewindns and (addr = '') then begin dwas := tdnswinasync.create; dwas.onrequestdone := winrequestdone; @@ -305,7 +305,7 @@ end; procedure tdnsasync.reverselookup; begin - {$ifdef win32} + {$ifdef mswindows} if usewindns and (addr = '') then begin dwas := tdnswinasync.create; dwas.onrequestdone := winrequestdone; @@ -342,7 +342,7 @@ procedure tdnsasync.cancel; var socketno : integer; begin - {$ifdef win32} + {$ifdef mswindows} if assigned(dwas) then begin dwas.release; dwas := nil; @@ -365,7 +365,7 @@ begin onrequestdone(self,0); end; -{$ifdef win32} +{$ifdef mswindows} procedure tdnsasync.winrequestdone(sender:tobject;error:word); begin diff --git a/dnscore.pas b/dnscore.pas index 3a9596f..6864398 100644 --- a/dnscore.pas +++ b/dnscore.pas @@ -62,7 +62,7 @@ interface uses binipstuff,classes,pgtypes,lcorernd; -var usewindns : boolean = {$ifdef win32}true{$else}false{$endif}; +var usewindns : boolean = {$ifdef mswindows}true{$else}false{$endif}; {hint to users of this unit that they should use windows dns instead. May be disabled by applications if desired. (e.g. if setting a custom dnsserverlist). diff --git a/dnssync.pas b/dnssync.pas index f6b0281..7dedcca 100644 --- a/dnssync.pas +++ b/dnssync.pas @@ -13,7 +13,7 @@ interface uses dnscore, binipstuff, - {$ifdef win32} + {$ifdef mswindows} winsock, windows, {$else} @@ -60,12 +60,12 @@ const implementation -{$ifdef win32} +{$ifdef mswindows} uses dnswin; {$endif} -{$ifndef win32} +{$ifndef mswindows} {$define syncdnscore} {$endif} @@ -76,7 +76,7 @@ type tdnsstatearr=array[0..numsock-1] of tdnsstate; {$ifdef syncdnscore} -{$ifdef win32} +{$ifdef mswindows} const winsocket = 'wsock32.dll'; function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external winsocket name 'sendto'; @@ -87,7 +87,7 @@ type tdnsstatearr=array[0..numsock-1] of tdnsstate; function getts:integer; -{$ifdef win32} +{$ifdef mswindows} begin result := GetTickCount and tsmask; {$else} @@ -117,7 +117,7 @@ var a,b:integer; Src : TInetSockAddrV; - Srcx : {$ifdef win32}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src; + Srcx : {$ifdef mswindows}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src; SrcLen : Integer; fromip:tbinip; fromport:ansistring; @@ -153,12 +153,12 @@ begin makeinaddrv(biniptemp,inttostr( porttemp ),inaddrtemp); fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0); - bindresult := {$ifdef win32}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp)); + bindresult := {$ifdef mswindows}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp)); dec(retrycount); until (retrycount <= 0) or (bindresult); If (not bindresult) Then begin - {$ifdef win32} + {$ifdef mswindows} raise Exception.create('unable to bind '+inttostr(WSAGetLastError)); {$else} raise Exception.create('unable to bind '+inttostr(socketError)); @@ -186,7 +186,7 @@ begin ip := getcurrentsystemnameserverbin(id); - {$ifdef ipv6}{$ifdef win32} + {$ifdef ipv6}{$ifdef mswindows} if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6; {$endif}{$endif} @@ -327,7 +327,7 @@ begin exit; //it was an IP address, no need for dns end; - {$ifdef win32} + {$ifdef mswindows} if usewindns then begin if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0; result := winforwardlookuplist(name,a,dummy); @@ -398,7 +398,7 @@ var numsockused:integer; state:tdnsstatearr; begin - {$ifdef win32} + {$ifdef mswindows} if usewindns then begin result := winreverselookup(ip,dummy); exit; @@ -412,7 +412,7 @@ begin {$endif} end; -{$ifdef win32} +{$ifdef mswindows} var wsadata : twsadata; diff --git a/lcore.pas b/lcore.pas index 1a2f93c..c936b59 100755 --- a/lcore.pas +++ b/lcore.pas @@ -16,13 +16,13 @@ unit lcore; {$ifdef fpc} {$mode delphi} {$endif} -{$ifdef win32} +{$ifdef mswindows} {$define nosignal} {$endif} interface uses sysutils, - {$ifndef win32} + {$ifndef mswindows} {$ifdef VER1_0} linux, {$else} @@ -136,9 +136,9 @@ interface function RealSend(Data : Pointer; Len : Integer) : Integer; //added for bewarehttpd - procedure myfdclose(fd : integer); virtual;{$ifdef win32}abstract;{$endif} - function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; virtual;{$ifdef win32}abstract;{$endif} - function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; virtual;{$ifdef win32}abstract;{$endif} + procedure myfdclose(fd : integer); virtual;{$ifdef mswindows}abstract;{$endif} + function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; virtual;{$ifdef mswindows}abstract;{$endif} + function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; virtual;{$ifdef mswindows}abstract;{$endif} protected procedure dupnowatch(invalue:longint); end; @@ -165,7 +165,7 @@ interface fontimer : tnotifyevent ; fenabled : boolean ; finterval : integer ; {miliseconds, default 1000} - {$ifndef win32} + {$ifndef mswindows} procedure resettimes; {$endif} // procedure setinitialevent(newvalue : boolean); @@ -248,17 +248,17 @@ implementation {$ifndef nosignal} uses {sockets,}lloopback,lsignal; {$endif} -{$ifdef win32} +{$ifdef mswindows} uses windows,winsock; {$endif} -{$ifndef win32} +{$ifndef mswindows} {$include unixstuff.inc} {$endif} {!!! added sleep call -beware} procedure sleep(i:integer); -{$ifdef win32} +{$ifdef mswindows} begin windows.sleep(i); {$else} @@ -395,13 +395,13 @@ begin eventcore.wmasterclr(fdhandleout);//fd_clr(fdhandleout,fdswmaster); if closehandles then begin - {$ifndef win32} + {$ifndef mswindows} //anyone remember why this is here? --plugwash fcntl(fdhandlein,F_SETFL,0); {$endif} myfdclose(fdhandlein); if fdhandleout <> fdhandlein then begin - {$ifndef win32} + {$ifndef mswindows} fcntl(fdhandleout,F_SETFL,0); {$endif} myfdclose(fdhandleout); @@ -528,7 +528,7 @@ begin fdhandlein := invalue; fdhandleout := invalue; eventcore.setfdreverse(fdhandlein,self); - {$ifndef win32} + {$ifndef mswindows} fcntl(fdhandlein,F_SETFL,OPEN_NONBLOCK); {$endif} state := wsconnected; @@ -561,7 +561,7 @@ begin internalclose(0); end else begin - {$ifdef win32} + {$ifdef mswindows} if getlasterror=WSAEWOULDBLOCK then begin //the asynchronous nature of windows messages means we sometimes //get here with the buffer full @@ -569,7 +569,7 @@ begin end else {$endif} begin - internalclose({$ifdef win32}getlasterror{$else}linuxerror{$endif}); + internalclose({$ifdef mswindows}getlasterror{$else}linuxerror{$endif}); end end; end; @@ -596,7 +596,7 @@ begin internalclose(0); end else if (numread=-1) then begin - {$ifdef win32} + {$ifdef mswindows} //sometimes on windows we get stale messages due to the inherent delays //in the windows message queue if WSAGetLastError = wsaewouldblock then begin @@ -605,7 +605,7 @@ begin {$endif} begin numread := 0; - internalclose({$ifdef win32}wsagetlasterror{$else}linuxerror{$endif}); + internalclose({$ifdef mswindows}wsagetlasterror{$else}linuxerror{$endif}); end; end else if numread > 0 then recvq.add(@tempbuf,numread); end; @@ -622,7 +622,7 @@ begin end; procedure tlasio.flush; -{$ifdef win32} +{$ifdef mswindows} type fdset = tfdset; {$endif} var @@ -651,7 +651,7 @@ begin tlasio(sender).recvq.del(maxlongint); end; -{$ifndef win32} +{$ifndef mswindows} procedure tltimer.resettimes; begin gettimeofday(nextts); @@ -692,7 +692,7 @@ begin if assigned(timerwrapperinterface) then begin timerwrapperinterface.setenabled(wrappedtimer,newvalue); end else begin - {$ifdef win32} + {$ifdef mswindows} raise exception.create('non wrapper timers are not permitted on windows'); {$else} resettimes; @@ -708,7 +708,7 @@ begin if assigned(timerwrapperinterface) then begin timerwrapperinterface.setinterval(wrappedtimer,newvalue); end else begin - {$ifdef win32} + {$ifdef mswindows} raise exception.create('non wrapper timers are not permitted on windows'); {$else} resettimes; @@ -867,7 +867,7 @@ begin if (result > 0) and assigned(onsenddata) then onsenddata(self,result); eventcore.wmasterset(fdhandleout); end; -{$ifndef win32} +{$ifndef mswindows} procedure tlasio.myfdclose(fd : integer); begin fdclose(fd); diff --git a/lcorelocalips.pas b/lcorelocalips.pas index aafddf7..d275012 100644 --- a/lcorelocalips.pas +++ b/lcorelocalips.pas @@ -51,7 +51,7 @@ function getv6localips:tbiniplist; function getsystemdnsservers:tbiniplist; -{$ifdef win32} +{$ifdef mswindows} function gethostname:ansistring; {$endif} @@ -284,7 +284,7 @@ end; -{$ifdef win32} +{$ifdef mswindows} const MAX_HOSTNAME_LEN = 132; MAX_DOMAIN_NAME_LEN = 132; @@ -350,7 +350,7 @@ end; function getsystemdnsservers:tbiniplist; var - {$ifdef win32} + {$ifdef mswindows} fixed_info : pfixed_info; currentdnsserver : pip_addr_string; {$else} @@ -364,7 +364,7 @@ begin result := biniplist_new; - {$ifdef win32} + {$ifdef mswindows} fixed_info := callgetnetworkparams; if fixed_info = nil then exit; @@ -400,7 +400,7 @@ begin {$endif} end; -{$ifdef win32} +{$ifdef mswindows} function gethostname:ansistring; var fixed_info : pfixed_info; diff --git a/lcorernd.pas b/lcorernd.pas index 3e43bb1..648c87a 100644 --- a/lcorernd.pas +++ b/lcorernd.pas @@ -132,7 +132,7 @@ implementation {$ifndef nolcorernd} uses - {$ifdef win32}windows,activex,{$endif} + {$ifdef mswindows}windows,activex,{$endif} {$ifdef unix} {$ifdef ver1_0} linux, @@ -165,7 +165,7 @@ var pool:array[0..(pooldwords+seeddwords-1)] of wordtype; reseedcountdown:integer; -{$ifdef win32} +{$ifdef mswindows} function collect_seeding(var output;const bufsize:integer):integer; var l:packed record diff --git a/lcoretest.dpr b/lcoretest.dpr index 8be5bea..bfba054 100755 --- a/lcoretest.dpr +++ b/lcoretest.dpr @@ -3,7 +3,7 @@ program lcoretest; uses lcore, lsocket, - {$ifdef win32} + {$ifdef mswindows} lcorewsaasyncselect in 'lcorewsaasyncselect.pas', {$else} lcoreselect, @@ -14,7 +14,7 @@ uses dnssync //we don't actually make any use of the units below in this app, we just //include it to check if it compiles ok ;) - {$ifndef win32} + {$ifndef mswindows} , {$ifndef nomessages} lmessages, @@ -23,7 +23,7 @@ uses unitfork {$endif} ; -{$ifdef win32} +{$ifdef mswindows} {$R *.RES} {$endif} diff --git a/lsocket.pas b/lsocket.pas index 6a1ce0b..b493ccd 100755 --- a/lsocket.pas +++ b/lsocket.pas @@ -42,7 +42,7 @@ unit lsocket; interface uses sysutils, - {$ifdef win32} + {$ifdef mswindows} windows,winsock, {$else} @@ -137,7 +137,7 @@ type {public in tlasio, and can't be private in both places, so should be public here. fixes delphi warning --beware} - {$ifdef win32} + {$ifdef mswindows} procedure myfdclose(fd : integer); override; function myfdwrite(fd: LongInt;const buf;size: LongInt):LongInt; override; function myfdread(fd: LongInt;var buf;size: LongInt):LongInt; override; @@ -174,7 +174,7 @@ end; //functions whose name clashes with them) by using sockets.* and but I can't do //that anymore since in some cases connect is now provided by unixstuff.inc //hence these wrapper functions --plugwash -{$ifndef win32} +{$ifndef mswindows} function system_Connect(Sock: LongInt;const Addr;Addrlen: LongInt):Boolean; begin result := connect(sock,addr,addrlen); @@ -236,14 +236,14 @@ begin //we want internalclose to act as if there was fdhandlein := -2; fdhandleout := -2; - tltask.create(taskcallconnectionfailedhandler,self,{$ifdef win32}wsagetlasterror{$else}socketerror{$endif},0); + tltask.create(taskcallconnectionfailedhandler,self,{$ifdef mswindows}wsagetlasterror{$else}socketerror{$endif},0); exit; end; try dup(a); bindsocket; if dgram then begin - {$ifndef win32} + {$ifndef mswindows} SetSocketOptions(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE')); {$else} SetSockOpt(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE')); @@ -255,7 +255,7 @@ begin eventcore.wmasterclr(fdhandleout); end else begin state :=wsconnecting; - {$ifdef win32} + {$ifdef mswindows} //writeln(inaddr.inaddr.port); winsock.Connect(fdhandlein,winsock.psockaddr(@inADDR)^,getaddrsize); {$else} @@ -347,7 +347,7 @@ end; procedure tlsocket.bindsocket; var inAddrtemp:TInetSockAddrV; - inAddrtempx:{$ifdef win32}winsock.TSockaddr{$else}TInetSockAddrV{$endif} absolute inaddrtemp; + inAddrtempx:{$ifdef mswindows}winsock.TSockaddr{$else}TInetSockAddrV{$endif} absolute inaddrtemp; inaddrtempsize:integer; begin try @@ -363,9 +363,9 @@ begin {$ifdef ipv6} isv6socket := (inaddrtemp.inaddr.family = AF_INET6); {$endif} - If Bind(fdhandlein,inaddrtempx,inaddrtempsize)<> {$ifdef win32}0{$else}true{$endif} Then begin + If Bind(fdhandlein,inaddrtempx,inaddrtempsize)<> {$ifdef mswindows}0{$else}true{$endif} Then begin state := wsclosed; - lasterror := {$ifdef win32}getlasterror{$else}socketerror{$endif}; + lasterror := {$ifdef mswindows}getlasterror{$else}socketerror{$endif}; raise ESocketException.create('unable to bind on address '+localaddr+'#'+localport+', error '+inttostr(lasterror)); end; state := wsbound; @@ -380,7 +380,7 @@ end; procedure tlsocket.listen; var - {$ifndef win32} + {$ifndef mswindows} yes,no:longint; {$endif} socktype:integer; @@ -424,13 +424,13 @@ begin end; {$endif} - if fdhandlein = -1 then raise ESocketException.create('unable to create socket'{$ifdef win32}+' error='+inttostr(wsagetlasterror){$endif}); + if fdhandlein = -1 then raise ESocketException.create('unable to create socket'{$ifdef mswindows}+' error='+inttostr(wsagetlasterror){$endif}); dupnowatch(fdhandlein); // sets up maxs and copies handle to fdhandleout among other things //eventcore.setfdreverse(fdhandlein,self); //already taken care of by dup state := wsclosed; // then set this back as it was an undesired side effect of dup try - {$ifndef win32} + {$ifndef mswindows} yes := $01010101; {Copied this from existing code. Value is empiric, but works. (yes=true<>0) } no := 0; @@ -460,11 +460,11 @@ begin if not udp then begin {!!! allow custom queue length? default 5} if listenqueue = 0 then listenqueue := 5; - If {$ifdef win32}winsock.listen{$else}system_listen{$endif}(fdhandlein,listenqueue)<>{$ifdef win32}0{$else}true{$endif} Then raise + If {$ifdef mswindows}winsock.listen{$else}system_listen{$endif}(fdhandlein,listenqueue)<>{$ifdef mswindows}0{$else}true{$endif} Then raise esocketexception.create('unable to listen'); state := wsListening; end else begin - {$ifndef win32} + {$ifndef mswindows} SetSocketOptions(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE')); {$else} SetSockOpt(fdhandleout, SOL_SOCKET, SO_BROADCAST, 'TRUE', Length('TRUE')); @@ -545,7 +545,7 @@ begin {$endif} FromAddrSize := Sizeof(FromAddr); - {$ifdef win32} + {$ifdef mswindows} result := winsock.accept(fdhandlein,@fromaddr,@fromaddrsize); {$else} result := system_accept(fdhandlein,fromaddr,fromaddrsize); @@ -554,7 +554,7 @@ begin eventcore.rmasterset(fdhandlein,true); if result = -1 then begin - raise esocketexception.create('error '+inttostr({$ifdef win32}getlasterror{$else}socketerror{$endif})+' while accepting'); + raise esocketexception.create('error '+inttostr({$ifdef mswindows}getlasterror{$else}socketerror{$endif})+' while accepting'); end; if result > absoloutemaxs then begin myfdclose(result); @@ -571,7 +571,7 @@ var realdest : tinetsockaddrv; biniptemp : tbinip; {$endif} - destx : {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}; + destx : {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}; begin {$ifdef secondlistener} @@ -585,15 +585,15 @@ begin biniptemp := inaddrvtobinip(dest); converttov6(biniptemp); destlen := makeinaddrv(biniptemp,inttostr(ntohs(dest.InAddr.port)),realdest); - destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@realdest) + destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@realdest) end else begin - destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest) + destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest) end; {$else} - destx := {$ifdef win32}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest); + destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest); {$endif} - result := {$ifdef win32}winsock.sendto{$else}system_sendto{$endif}(self.fdhandleout,data^,len,0,destx^,destlen); + result := {$ifdef mswindows}winsock.sendto{$else}system_sendto{$endif}(self.fdhandleout,data^,len,0,destx^,destlen); end; @@ -601,7 +601,7 @@ function tlsocket.receivefrom(data:pointer;len:integer;var src:TInetSockAddrV;va var tempsrc:TInetSockAddrV; tempsrclen:integer; - srcx : {$ifdef win32}winsock.TSockAddr{$else}TInetSockAddrV{$endif} absolute tempsrc; + srcx : {$ifdef mswindows}winsock.TSockAddr{$else}TInetSockAddrV{$endif} absolute tempsrc; biniptemp:tbinip; begin {$ifdef secondlistener} @@ -693,7 +693,7 @@ begin //connectread := true; recvq.add(@tempbuf,numread); end else begin - connectionfailedhandler({$ifdef win32}wsagetlasterror{$else}linuxerror{$endif}); + connectionfailedhandler({$ifdef mswindows}wsagetlasterror{$else}linuxerror{$endif}); exit; end; // if things went well here we are now in the state wsconnected with data sitting in our receive buffer @@ -728,9 +728,9 @@ end; function tlsocket.getpeername(var addr:tsockaddrin;addrlen:integer):integer; var - addrx : {$ifdef win32}winsock.tsockaddr{$else}tsockaddrin{$endif} absolute addr; + addrx : {$ifdef mswindows}winsock.tsockaddr{$else}tsockaddrin{$endif} absolute addr; begin - result := {$ifdef win32}winsock.getpeername{$else}system_getpeername{$endif}(self.fdhandlein,addrx,addrlen); + result := {$ifdef mswindows}winsock.getpeername{$else}system_getpeername{$endif}(self.fdhandlein,addrx,addrlen); end; procedure tlsocket.getxaddrbin(var binip:tbinip); @@ -741,7 +741,7 @@ begin i := sizeof(addr); fillchar(addr,sizeof(addr),0); - {$ifdef win32} + {$ifdef mswindows} winsock.getsockname(self.fdhandlein,psockaddr(@addr)^,i); {$else} getsocketname(self.fdhandlein,addr,i); @@ -757,7 +757,7 @@ var begin i := sizeof(addr); fillchar(addr,sizeof(addr),0); - {$ifdef win32} + {$ifdef mswindows} winsock.getpeername(self.fdhandlein,psockaddr(@addr)^,i); {$else} system_getpeername(self.fdhandlein,addr,i); @@ -791,7 +791,7 @@ var i:integer; begin i := sizeof(addr); - {$ifdef win32} + {$ifdef mswindows} winsock.getsockname(self.fdhandlein,psockaddrin(@addr)^,i); {$else} @@ -807,7 +807,7 @@ var i:integer; begin i := sizeof(addr); - {$ifdef win32} + {$ifdef mswindows} winsock.getpeername(self.fdhandlein,psockaddrin(@addr)^,i); {$else} @@ -817,7 +817,7 @@ begin result := inttostr(htons(addr.InAddr.port)); end; -{$ifdef win32} +{$ifdef mswindows} procedure tlsocket.myfdclose(fd : integer); begin closesocket(fd); diff --git a/ltimevalstuff.pas b/ltimevalstuff.pas index 93f84bb..5e81933 100755 --- a/ltimevalstuff.pas +++ b/ltimevalstuff.pas @@ -10,7 +10,7 @@ unit ltimevalstuff; interface -{$ifdef win32} +{$ifdef mswindows} type ttimeval = record tv_sec : longint; diff --git a/testreadtxt2.dpr b/testreadtxt2.dpr index 3e7d0df..2feeff9 100644 --- a/testreadtxt2.dpr +++ b/testreadtxt2.dpr @@ -61,7 +61,7 @@ begin t.destroy; - {$ifdef win32} + {$ifdef mswindows} //make things a little easier to test in the delphi GUI readln; {$endif} diff --git a/unitwindowobject.pas b/unitwindowobject.pas index cc7f1e1..1c0d32d 100644 --- a/unitwindowobject.pas +++ b/unitwindowobject.pas @@ -9,7 +9,7 @@ interface uses classes, - {$ifdef win32} + {$ifdef mswindows} windows,messages,wmessages, {$else} lmessages, @@ -34,7 +34,7 @@ type function killtimer(id:taddrint):boolean; procedure postmessage(msg,wparam,lparam:taddrint); procedure messageloop; - {$ifdef win32} + {$ifdef mswindows} procedure processmessages; virtual; function processmessage:boolean; {$endif}