[Mplayerxp-cvslog] SF.net SVN: mplayerxp:[534] mplayerxp
Brought to you by:
olov
From: <nic...@us...> - 2012-12-10 16:07:45
|
Revision: 534 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=534&view=rev Author: nickols_k Date: 2012-12-10 16:07:37 +0000 (Mon, 10 Dec 2012) Log Message: ----------- cleanus Modified Paths: -------------- mplayerxp/Makefile mplayerxp/configure mplayerxp/libmpstream/mrl.cpp mplayerxp/libmpstream/mrl.h mplayerxp/libmpstream/tcp.cpp mplayerxp/libmpstream/tcp.h Modified: mplayerxp/Makefile =================================================================== --- mplayerxp/Makefile 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/Makefile 2012-12-10 16:07:37 UTC (rev 534) @@ -68,7 +68,7 @@ $(DO_MAKE_ALL) $(CXX) -o $(TARGET_EXE) $(OBJS) $(LDFLAGS) $(LDXXFLAGS) $(LIBS) #-Xlinker --export-dynamic -Xlinker --gc-sections -Xlinker --sort-common -$(SRCS): version.h +$(SRCS): dep install: $(TARGET_EXE) ifeq ($(INSTALL),) @@ -103,11 +103,7 @@ -rm -f mp_config.h mp_config.mak mp_conf_lavc.h version.h -rm -f cpuinfo help_mp.h -version.h: - ./version.sh `$(CC) --version` - $(MAKE) dep - -dep: version.h +dep: $(CXX) -MM $(CXXFLAGS) $(SRCS) 1>.depend $(DO_MAKE) Modified: mplayerxp/configure =================================================================== --- mplayerxp/configure 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/configure 2012-12-10 16:07:37 UTC (rev 534) @@ -884,6 +884,8 @@ fi CXXFLAGS=$CFLAGS + +./version.sh ############################################################################# echo "Creating mp_config.mak" cat >> mp_config.mak << EOF Modified: mplayerxp/libmpstream/mrl.cpp =================================================================== --- mplayerxp/libmpstream/mrl.cpp 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/mrl.cpp 2012-12-10 16:07:37 UTC (rev 534) @@ -13,10 +13,11 @@ #include <stdio.h> #endif namespace mpxp { -const char *mrl_parse_line(const char *line,char **user,char **pass,char **ms,char **port) +const char *mrl_parse_line(const std::string& _line,char **user,char **pass,char **ms,char **port) { unsigned ssize; const char *endp,*endl; + const char* line=_line.c_str(); if(user) *user=NULL; if(pass) *pass=NULL; if(ms) *ms=NULL; @@ -82,13 +83,8 @@ return line; } -const char *mrl_parse_line(const std::string& line,char **user,char **pass,char **ms,char **port) +static void mrl_store_args(const std::string& arg,char *value, const mrl_config_t * args) { - return mrl_parse_line(line.c_str(),user,pass,ms,port); -} - -static void mrl_store_args(const char *arg,char *value, const mrl_config_t * args) -{ #ifdef TEST_MRL printf("arg='%s' value='%s'\n",arg,value); return; @@ -96,13 +92,10 @@ unsigned i; int done=0; i=0; - while(arg!=NULL) - { - if(strcmp(arg,args[i].arg)==0) - { + while(args[i].arg!=NULL) { + if(arg==args[i].arg) { done=1; - switch(args[i].type) - { + switch(args[i].type) { case MRL_TYPE_PRINT: MSG_INFO("%s", (char *)args[i].value); default: @@ -117,8 +110,7 @@ *((int *)args[i].value)=args[i].min; delete value; break; - case MRL_TYPE_INT: - { + case MRL_TYPE_INT: { int result=atoi(value); delete value; if(result < args[i].min) result=args[i].min; @@ -126,8 +118,7 @@ *((int *)args[i].value)=result; } break; - case MRL_TYPE_FLOAT: - { + case MRL_TYPE_FLOAT: { int result=atof(value); delete value; if(result < args[i].min) result=args[i].min; @@ -135,8 +126,7 @@ *((float *)args[i].value)=result; } break; - case MRL_TYPE_STRING: - { + case MRL_TYPE_STRING: { char *p=reinterpret_cast<char*>(args[i].value); p=value; break; @@ -146,22 +136,21 @@ } i++; } - if(!done) MSG_WARN(" Can't handle argument: '%s'",arg); + if(!done) MSG_WARN(" Can't handle argument: '%s'",arg.c_str()); } #define MRL_ARG_SEP ',' -const char * mrl_parse_params(const char *param, const mrl_config_t * args) +const char * mrl_parse_params(const std::string& _param, const mrl_config_t * args) { const char *sep,*endp,*endl; char *arg=NULL,*value=NULL; unsigned ssize; + const char* param=_param.c_str(); endl=param+strlen(param); - while(*param) - { + while(*param) { sep=strchr(param,'='); - if(sep) - { + if(sep) { sep++; endp=strchr(sep,MRL_ARG_SEP); if(!endp) endp=endl; @@ -185,9 +174,5 @@ if(value) delete value; return param; } -const char * mrl_parse_params(const std::string& param, const mrl_config_t * args) -{ - return mrl_parse_params(param.c_str(),args); -} } // namespace mpxp Modified: mplayerxp/libmpstream/mrl.h =================================================================== --- mplayerxp/libmpstream/mrl.h 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/mrl.h 2012-12-10 16:07:37 UTC (rev 534) @@ -23,7 +23,6 @@ * x11://~username:passwd@localhost:8081#bpp=32 * @see mrl_parse_params **/ - extern const char *mrl_parse_line(const char *line,char **user,char **pass,char **ms,char **port); extern const char *mrl_parse_line(const std::string& line,char **user,char **pass,char **ms,char **port); enum { @@ -53,7 +52,6 @@ * may want to use non-standard arguments for plugin. * @see mrl_parse_line **/ - extern const char * mrl_parse_params(const char *param,const mrl_config_t * args); extern const char * mrl_parse_params(const std::string& param,const mrl_config_t * args); } // namespace mpxp #endif Modified: mplayerxp/libmpstream/tcp.cpp =================================================================== --- mplayerxp/libmpstream/tcp.cpp 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/tcp.cpp 2012-12-10 16:07:37 UTC (rev 534) @@ -51,7 +51,7 @@ // return -2 for fatal error, like unable to resolve name, connection timeout... // return -1 is unable to connect to a particular port -void Tcp::open(const char *host, int port, tcp_af_e af) { +void Tcp::open(const std::string& host, int port, tcp_af_e af) { socklen_t err_len; int ret,count = 0; fd_set set; @@ -72,7 +72,7 @@ struct timeval to; #endif - MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host); + MSG_V("[tcp%s] Trying to resolv host '%s'\n", af2String(af), host.c_str()); _fd = ::socket(af==Tcp::IP4?AF_INET:AF_INET6, SOCK_STREAM, 0); if( _fd==-1 ) { @@ -103,26 +103,26 @@ memset(&server_address, 0, sizeof(server_address)); - MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), host); + MSG_V("[tcp%s] PreResolving Host '%s'\n",af2String(af), host.c_str()); #ifndef HAVE_WINSOCK2 #ifdef USE_ATON - if (::inet_aton(host, our_s_addr)!=1) + if (::inet_aton(host.c_str(), our_s_addr)!=1) #else - if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, host, our_s_addr)!=1) + if (::inet_pton(af==Tcp::IP4?AF_INET:AF_INET6, host.c_str(), our_s_addr)!=1) #endif #else - if (::inet_addr(host)==INADDR_NONE ) + if (::inet_addr(host.c_str())==INADDR_NONE ) #endif { - MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), host); + MSG_V("[tcp%s] Resolving Host '%s'\n",af2String(af), host.c_str()); #ifdef HAVE_GETHOSTBYNAME2 - hp=(struct hostent*)::gethostbyname2( host, af==Tcp::IP4?AF_INET:AF_INET6 ); + hp=(struct hostent*)::gethostbyname2( host.c_str(), af==Tcp::IP4?AF_INET:AF_INET6 ); #else - hp=(struct hostent*)::gethostbyname( host ); + hp=(struct hostent*)::gethostbyname( host.c_str() ); #endif if( hp==NULL ) { - MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), host); + MSG_V("[tcp%s] Can't resolv: %s\n",af2String(af), host.c_str()); _error=Tcp::Err_Fatal; return; } @@ -131,7 +131,7 @@ } #ifdef HAVE_WINSOCK2 else { - unsigned long addr = inet_addr(host); + unsigned long addr = inet_addr(host.c_str()); memcpy( our_s_addr, (any_t*)&addr, sizeof(addr) ); } #endif @@ -158,7 +158,7 @@ #else ::inet_ntop(af==Tcp::IP4?AF_INET:AF_INET6, our_s_addr, buf, 255); #endif - MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),host,buf,port); + MSG_INFO("[tcp%s] Connecting to server: %s (%s:%i)\n",af2String(af),host.c_str(),buf,port); // Turn the socket as non blocking so we can timeout on the connection #ifndef HAVE_WINSOCK2 @@ -173,7 +173,7 @@ #else if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) { #endif - MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),host); + MSG_V("[tcp%s] Can't connect to server: %s\n",af2String(af),host.c_str()); ::closesocket(_fd); _fd=-1; _error=Tcp::Err_Port; @@ -224,7 +224,7 @@ } } -Tcp::Tcp(libinput_t* _libinput,const char *host,int port,tcp_af_e af) +Tcp::Tcp(libinput_t* _libinput,const std::string& host,int port,tcp_af_e af) :_fd(-1), _error(Tcp::Err_None), libinput(_libinput) Modified: mplayerxp/libmpstream/tcp.h =================================================================== --- mplayerxp/libmpstream/tcp.h 2012-12-10 15:13:31 UTC (rev 533) +++ mplayerxp/libmpstream/tcp.h 2012-12-10 16:07:37 UTC (rev 534) @@ -20,6 +20,7 @@ */ #ifndef TCP_H_INCLUDED #define TCP_H_INCLUDED 1 +#include <string> #include <stdint.h> #include "input2/input.h" @@ -39,7 +40,7 @@ Err_None =0 /* no error */ }; Tcp(libinput_t* libinput,net_fd_t fd); - Tcp(libinput_t* libinput,const char *host,int port,tcp_af_e af=Tcp::IP4); + Tcp(libinput_t* libinput,const std::string& host,int port,tcp_af_e af=Tcp::IP4); virtual ~Tcp(); Tcp& operator=(Tcp& other); @@ -50,7 +51,7 @@ virtual tcp_error_e error() const; virtual libinput_t* get_libinput() const; - virtual void open(const char *host,int port,tcp_af_e af=Tcp::IP4); + virtual void open(const std::string& host,int port,tcp_af_e af=Tcp::IP4); virtual int read(uint8_t* buf,unsigned len,int flags=0); virtual int write(const uint8_t* buf,unsigned len,int flags=0) const; virtual void close(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |