您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetProtocol函数代码示例

51自学网 2021-06-01 21:13:44
  C++
这篇教程C++ GetProtocol函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetProtocol函数的典型用法代码示例。如果您正苦于以下问题:C++ GetProtocol函数的具体用法?C++ GetProtocol怎么用?C++ GetProtocol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetProtocol函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AbsPath

void AbsPath(tchar_t* Abs, int AbsLen, const tchar_t* Path, const tchar_t* Base){	if (Base && GetProtocol(Base,NULL,0,NULL)!=Base && (Path[0] == '/' || Path[0] == '//') &&        (Path[1] != '/' && Path[1] != '//'))	{		tchar_t* s;		bool_t HasHost;		tcscpy_s(Abs,AbsLen,Base);		s = (tchar_t*)GetProtocol(Abs,NULL,0,&HasHost);		if (!HasHost)		{			// keep "mime://" from Base			++Path;			*s = 0;		}		else		{			// keep "mime://host" from Base			tchar_t *a,*b;			a = tcschr(s,'//');			b = tcschr(s,'/');			if (!a || (b && b<a))				a=b;			if (a)				*a=0;		}	}	else	if (Base && GetProtocol(Path,NULL,0,NULL)==Path && Path[0] != '/' && Path[0] != '//' &&		!(Path[0] && Path[1]==':' && (Path[2]=='//' || Path[2]=='/0')))	{			// doesn't have mime or drive letter or pathdelimiter at the start		const tchar_t* MimeEnd = GetProtocol(Base,NULL,0,NULL);		tcscpy_s(Abs,AbsLen,Base);#if defined(TARGET_WIN) || defined(TARGET_SYMBIAN)		if (MimeEnd==Base)			AddPathDelimiter(Abs,AbsLen);		else#endif		if (MimeEnd[0])			AddPathDelimiter(Abs,AbsLen);	}	else		Abs[0] = 0;	tcscat_s(Abs,AbsLen,Path);    AbsPathNormalize(Abs,AbsLen);}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:50,


示例2: GetStream

stream* GetStream(anynode *AnyNode, const tchar_t* URL, int Flags){	tchar_t Protocol[MAXPROTOCOL];	stream* Stream = NULL;    fourcc_t FourCC;    GetProtocol(URL,Protocol,TSIZEOF(Protocol),NULL);    FourCC = NodeEnumClassStr(AnyNode,NULL,STREAM_CLASS,NODE_PROTOCOL,Protocol);#if defined(CONFIG_STREAM_CACHE)    if ((Flags & (SFLAG_NO_CACHING|SFLAG_WRONLY|SFLAG_CREATE))==0)        Stream = (stream*)NodeCreate(AnyNode,NodeClass_Meta(NodeContext_FindClass(AnyNode,FourCC),STREAM_CACHE_CLASS,META_PARAM_CUSTOM));#endif    if (!Stream)        Stream = (stream*)NodeCreate(AnyNode,FourCC);    if (Stream && (Flags & SFLAG_NON_BLOCKING))        Stream_Blocking(Stream,0);    if (!Stream && !(Flags & SFLAG_SILENT))    {	    tcsupr(Protocol);	    NodeReportError(AnyNode,NULL,ERR_ID,ERR_PROTO_NOT_FOUND,Protocol);    }#if defined(CONFIG_DEBUGCHECKS)    if (Stream)        tcscpy_s(Stream->URL,TSIZEOF(Stream->URL),URL);#endif	return Stream;}
开发者ID:robUx4,项目名称:ResInfo,代码行数:32,


示例3: socket_network_client

// Windows implementation of this libcutils function. This function does not make any calls to// WSAStartup() or WSACleanup() so that must be handled by the caller.// TODO(dpursell): share this code with adb.static SOCKET socket_network_client(const std::string& host, int port, int type) {    // First resolve the host and port parameters into a usable network address.    addrinfo hints;    memset(&hints, 0, sizeof(hints));    hints.ai_socktype = type;    hints.ai_protocol = GetProtocol(type);    addrinfo* address = nullptr;    getaddrinfo(host.c_str(), android::base::StringPrintf("%d", port).c_str(), &hints, &address);    if (address == nullptr) {        return INVALID_SOCKET;    }    // Now create and connect the socket.    SOCKET sock = socket(address->ai_family, address->ai_socktype, address->ai_protocol);    if (sock == INVALID_SOCKET) {        freeaddrinfo(address);        return INVALID_SOCKET;    }    if (connect(sock, address->ai_addr, address->ai_addrlen) == SOCKET_ERROR) {        closesocket(sock);        freeaddrinfo(address);        return INVALID_SOCKET;    }    freeaddrinfo(address);    return sock;}
开发者ID:LedoInteractive,项目名称:platform_system_core,代码行数:32,


示例4: GetRightLocation

/** * Doku see wxFileSystemHandler */wxString wxChmFSHandler::FindFirst(const wxString& spec, int flags){    wxString right = GetRightLocation(spec);    wxString left = GetLeftLocation(spec);    wxString nativename = wxFileSystem::URLToFileName(left).GetFullPath();    if ( GetProtocol(left) != _T("file") )    {        wxLogError(_("CHM handler currently supports only local files!"));        return wxEmptyString;    }    m_chm = new wxChmTools(wxFileName(nativename));    m_pattern = right.AfterLast(_T('/'));    wxString m_found = m_chm->Find(m_pattern);    // now fake around hhp-files which are not existing in projects...    if (m_found.empty() &&        m_pattern.Contains(_T(".hhp")) &&        !m_pattern.Contains(_T(".hhp.cached")))    {        m_found.Printf(_T("%s#chm:%s.hhp"),                       left.c_str(), m_pattern.BeforeLast(_T('.')).c_str());    }    return m_found;}
开发者ID:gitrider,项目名称:wxsj2,代码行数:32,


示例5: AbsPathNormalize

void AbsPathNormalize(tchar_t* Abs,size_t AbsLen){	if (GetProtocol(Abs,NULL,0,NULL)!=Abs)    {        tchar_t *i;		for (i=Abs;*i;++i)			if (*i == '//')				*i = '/';    }    else    {#if defined(TARGET_WIN) || defined(TARGET_SYMBIAN)        tchar_t *i;		for (i=Abs;*i;++i)			if (*i == '/')				*i = '//';#if defined(TARGET_WINCE)        if (Abs[0]!='//')        {            size_t n = tcslen(Abs)+1;            if (n>=AbsLen)            {                n=AbsLen-1;                Abs[n-1]=0;            }            memmove(Abs+1,Abs,n*sizeof(tchar_t));            Abs[0]='//';        }#endif#endif    }}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:33,


示例6: SetFileExt

bool_t SetFileExt(tchar_t* URL, size_t URLLen, const tchar_t* Ext){	tchar_t *p,*q,*p2;	bool_t HasHost;	p = (tchar_t*) GetProtocol(URL,NULL,0,&HasHost);	q = p;		p = tcsrchr(q,'//');    p2 = tcsrchr(q,'/');    if (!p || (p2 && p2>p))		p=p2;	if (p)		q = p+1;	else	if (HasHost) // only hostname		return 0;		if (!q[0]) // no filename at all?		return 0;	p = tcsrchr(q,'.');	if (p)		*p = 0;	tcscat_s(URL,URLLen,T("."));	tcscat_s(URL,URLLen,Ext);	return 1;}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:29,


示例7: socket_inaddr_any_server

// Windows implementation of this libcutils function. This implementation creates a dual-stack// server socket that can accept incoming IPv4 or IPv6 packets. This function does not make any// calls to WSAStartup() or WSACleanup() so that must be handled by the caller.// TODO(dpursell): share this code with adb.static SOCKET socket_inaddr_any_server(int port, int type) {    SOCKET sock = socket(AF_INET6, type, GetProtocol(type));    if (sock == INVALID_SOCKET) {        return INVALID_SOCKET;    }    // Enforce exclusive addresses (1), and enable dual-stack so both IPv4 and IPv6 work (2).    // (1) https://msdn.microsoft.com/en-us/library/windows/desktop/ms740621(v=vs.85).aspx.    // (2) https://msdn.microsoft.com/en-us/library/windows/desktop/bb513665(v=vs.85).aspx.    int exclusive = 1;    DWORD v6_only = 0;    if (setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, reinterpret_cast<const char*>(&exclusive),                   sizeof(exclusive)) == SOCKET_ERROR ||        setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast<const char*>(&v6_only),                   sizeof(v6_only)) == SOCKET_ERROR) {        closesocket(sock);        return INVALID_SOCKET;    }    // Bind the socket to our local port.    sockaddr_in6 addr;    memset(&addr, 0, sizeof(addr));    addr.sin6_family = AF_INET6;    addr.sin6_port = htons(port);    addr.sin6_addr = in6addr_any;    if (bind(sock, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) == SOCKET_ERROR) {        closesocket(sock);        return INVALID_SOCKET;    }    return sock;}
开发者ID:LedoInteractive,项目名称:platform_system_core,代码行数:36,


示例8: GetRightLocation

wxString wxArchiveFSHandler::FindFirst(const wxString& spec, int flags){    wxString right = GetRightLocation(spec);    wxString left = GetLeftLocation(spec);    wxString protocol = GetProtocol(spec);    wxString key = left + wxT("#") + protocol + wxT(":");    if (!right.empty() && right.Last() == wxT('/')) right.RemoveLast();    if (!m_cache)        m_cache = new wxArchiveFSCache;    const wxArchiveClassFactory *factory;    factory = wxArchiveClassFactory::Find(protocol);    if (!factory)        return wxEmptyString;    m_Archive = m_cache->Get(key);    if (!m_Archive)    {        wxFSFile *leftFile = m_fs.OpenFile(left);        if (!leftFile)            return wxEmptyString;        m_Archive = m_cache->Add(key, *factory, leftFile->DetachStream());        delete leftFile;    }    m_FindEntry = NULL;    switch (flags)    {        case wxFILE:            m_AllowDirs = false, m_AllowFiles = true; break;        case wxDIR:            m_AllowDirs = true, m_AllowFiles = false; break;        default:            m_AllowDirs = m_AllowFiles = true; break;    }    m_ZipFile = key;    m_Pattern = right.AfterLast(wxT('/'));    m_BaseDir = right.BeforeLast(wxT('/'));    if (m_BaseDir.StartsWith(wxT("/")))        m_BaseDir = m_BaseDir.Mid(1);    if (m_Archive)    {        if (m_AllowDirs)        {            delete m_DirsFound;            m_DirsFound = new wxArchiveFilenameHashMap();            if (right.empty())  // allow "/" to match the archive root                return spec;        }        return DoFind();    }    return wxEmptyString;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:59,


示例9: StreamProtocolPriority

int StreamProtocolPriority(anynode *AnyNode, const tchar_t* URL){	tchar_t Protocol[MAXPROTOCOL];    GetProtocol(URL,Protocol,TSIZEOF(Protocol),NULL);    if (tcsicmp(Protocol,T("file"))==0) // override for local files        return PRI_MAXIMUM;    return NodeClass_Priority(NodeContext_FindClass(AnyNode,NodeEnumClassStr(AnyNode,NULL,STREAM_CLASS,NODE_PROTOCOL,Protocol)));}
开发者ID:robUx4,项目名称:ResInfo,代码行数:8,


示例10: WXUNUSED

wxFSFile* wxChmFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),                                   const wxString& location){    wxString right = GetRightLocation(location);    wxString left = GetLeftLocation(location);    wxInputStream *s;    int index;    if ( GetProtocol(left) != _T("file") )    {        wxLogError(_("CHM handler currently supports only local files!"));        return NULL;    }    // Work around javascript    wxString tmp = wxString(right);    if ( tmp.MakeLower().Contains(_T("javascipt")) && tmp.Contains(_T("/'")) )    {        right = right.AfterFirst(_T('/'')).BeforeLast(_T('/''));    }    // now work on the right location    if (right.Contains(_T("..")))    {        wxFileName abs(right);        abs.MakeAbsolute(_T("/"));        right = abs.GetFullPath();    }    // a workaround for absolute links to root    if ( (index=right.Index(_T("//"))) != wxNOT_FOUND )    {        right=wxString(right.Mid(index+1));        wxLogWarning(_("Link contained '//', converted to absolute link."));    }    wxFileName leftFilename = wxFileSystem::URLToFileName(left);    // Open a stream to read the content of the chm-file    s = new wxChmInputStream(leftFilename.GetFullPath(), right, true);    wxString mime = GetMimeTypeFromExt(location);    if ( s )    {        return new wxFSFile(s,                            left + _T("#chm:") + right,                            mime,                            GetAnchor(location),                            wxDateTime(wxFileModificationTime(left)));    }    delete s;    return NULL;}
开发者ID:gitrider,项目名称:wxsj2,代码行数:57,


示例11: UpperPath

bool_t UpperPath(tchar_t* Path, tchar_t* Last, size_t LastLen){	tchar_t *a,*b,*c;	bool_t HasHost;    tchar_t Mime[32];	if (!*Path)		return 0;	RemovePathDelimiter(Path);	c = (tchar_t*)GetProtocol(Path,Mime,TSIZEOF(Mime),&HasHost);		a = tcsrchr(c,'//');	b = tcsrchr(c,'/');	if (!a || (b && b>a))		a=b;#ifdef TARGET_PS2SDK    if (!a && (a = tcschr(c,':'))!=NULL)        if (a[1]==0)            a = NULL;#endif	if (!a)	{        if (tcsicmp(Mime, T("smb")) == 0) {            *c = 0;            tcscpy_s(Last, LastLen, Path);            return 1;        }        if (HasHost && tcsicmp(Mime, T("upnp"))!=0)			return 0;		a=c;		if (!a[0]) // only mime left			a=c=Path;	}	else		++a;	if (Last)		tcscpy_s(Last,LastLen,a);	if (a==c)		*a = 0;#ifdef TARGET_PS2SDK    if (a>c && a[-1]==':')        *a = 0;#endif	while (--a>=c && (*a=='//' || *a=='/'))		*a = 0;	return 1;}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:56,


示例12: Open

static err_t Open(urlpart* p, const tchar_t* URL, int Flags){    err_t Result;    const tchar_t *String, *Equal;    tchar_t Value[MAXPATHFULL];    datetime_t Date = INVALID_DATETIME_T;    String = tcsrchr(URL,URLPART_SEP_CHAR);    if (!String)        return ERR_INVALID_DATA;        Clear(p);    Node_SetData((node*)p,STREAM_URL,TYPE_STRING,URL);    Equal = GetProtocol(URL,NULL,0,NULL);    tcsncpy_s(Value,TSIZEOF(Value),Equal,String-Equal);    tcsreplace(Value,TSIZEOF(Value),URLPART_SEP_ESCAPE,URLPART_SEPARATOR);    Node_SetData((node*)p,URLPART_URL,TYPE_STRING,Value);    while (String++ && *String)    {        Equal = tcschr(String,T('='));        if (Equal)        {            tchar_t *Sep = tcschr(Equal,T('#'));            if (Sep)                tcsncpy_s(Value,TSIZEOF(Value),Equal+1,Sep-Equal-1);            else                tcscpy_s(Value,TSIZEOF(Value),Equal+1);            if (tcsncmp(String,T("ofs"),Equal-String)==0)                p->Pos = StringToInt(Value,0);            else if (tcsncmp(String,T("len"),Equal-String)==0)                p->Length = StringToInt(Value,0);            else if (tcsncmp(String,T("mime"),Equal-String)==0)                Node_SetData((node*)p,URLPART_MIME,TYPE_STRING,Value);            else if (tcsncmp(String,T("date"),Equal-String)==0)                Date = StringToInt(Value,0);        }        String = tcschr(String,'#');    }    if (Date!=INVALID_DATETIME_T && Date != FileDateTime(Node_Context(p),Node_GetDataStr((node*)p,URLPART_URL)))        return ERR_INVALID_DATA;    p->Input = GetStream(p,Node_GetDataStr((node*)p,URLPART_URL),Flags);    if (!p->Input)        return ERR_NOT_SUPPORTED;    Stream_Blocking(p->Input,p->Blocking);    Result = Stream_Open(p->Input,Node_GetDataStr((node*)p,URLPART_URL),Flags);    if (Result == ERR_NONE && p->Pos!=INVALID_FILEPOS_T) // TODO: support asynchronous stream opening    {        if (Stream_Seek(p->Input,p->Pos,SEEK_SET)!=p->Pos)            return ERR_INVALID_DATA;    }    return Result;}
开发者ID:ViFork,项目名称:ResInfo,代码行数:56,


示例13: GetProtocol

bool wxInternetFSHandler::CanOpen(const wxString& location){#if wxUSE_URL    wxString p = GetProtocol(location);    if ((p == wxT("http")) || (p == wxT("ftp")))    {        wxURL url(p + wxT(":") + StripProtocolAnchor(location));        return (url.GetError() == wxURL_NOERR);    }#endif    return false;}
开发者ID:Ailick,项目名称:rpcs3,代码行数:12,


示例14: RemovePathDelimiter

void RemovePathDelimiter(tchar_t* Path){    size_t n = tcslen(Path);	const tchar_t* s = GetProtocol(Path,NULL,0,NULL);#if defined(TARGET_WIN) || defined(TARGET_SYMBIAN)    bool_t HasProtocol = s==Path;	if (s[0] && n>0 && ((HasProtocol && Path[n-1] == '//') || (!HasProtocol && Path[n-1] == '/')))#else	if (s[0] && n>0 && Path[n-1] == '/' && n > 1)#endif		Path[n-1] = 0;}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:12,


示例15: SplitURL

void SplitURL(const tchar_t* URL, tchar_t* Protocol, int ProtocolLen, tchar_t* Host, int HostLen, int* Port, tchar_t* Path, int PathLen){	bool_t HasHost;	URL = GetProtocol(URL,Protocol,ProtocolLen,&HasHost);    if (HasHost)    {	    const tchar_t* p;	    const tchar_t* p2;	    p = tcschr(URL,'//');        p2 = tcschr(URL,'/');        if (!p || (p2 && p2>p))		    p=p2;        if (!p)            p = URL+tcslen(URL);        p2 = tcschr(URL,':'); 	    if (p2 && p2<p)	    {            if (Port)                stscanf(p2+1,T("%d"),Port);	    }        else            p2 = p;	    if (Host)		    tcsncpy_s(Host,HostLen,URL,p2-URL);        URL = p;    }    else    {        if (Host && HostLen>0)            *Host = 0;    }    if (Path)    {        if (URL[0])        {            tchar_t* p;            tcscpy_s(Path,PathLen,URL);            for (p=Path;*p;++p)                if (*p == '//')                    *p = '/';        }        else            tcscpy_s(Path,PathLen,T("/"));    }}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:51,


示例16: switch

zx_status_t PlatformBus::DdkGetProtocol(uint32_t proto_id, void* out) {    switch (proto_id) {    case ZX_PROTOCOL_PBUS: {        auto proto = static_cast<pbus_protocol_t*>(out);        proto->ctx = this;        proto->ops = &pbus_protocol_ops_;        return ZX_OK;    }    case ZX_PROTOCOL_GPIO_IMPL:        if (gpio_) {            gpio_->GetProto(static_cast<gpio_impl_protocol_t*>(out));            return ZX_OK;        }        break;    case ZX_PROTOCOL_I2C_IMPL:        if (i2c_) {            i2c_->GetProto(static_cast<i2c_impl_protocol_t*>(out));            return ZX_OK;        }        break;    case ZX_PROTOCOL_CLK:        if (clk_) {            clk_->GetProto(static_cast<clk_protocol_t*>(out));            return ZX_OK;        }        break;    case ZX_PROTOCOL_IOMMU:        if (iommu_) {            iommu_->GetProto(static_cast<iommu_protocol_t*>(out));        } else {            // return default implementation            auto proto = static_cast<iommu_protocol_t*>(out);            proto->ctx = this;            proto->ops = &iommu_protocol_ops_;            return ZX_OK;        }        break;    default: {        fbl::AutoLock lock(&proto_proxys_mutex_);        auto proto_proxy = proto_proxys_.find(proto_id);        if (!proto_proxy.IsValid()) {            return ZX_ERR_NOT_SUPPORTED;        }        proto_proxy->GetProtocol(out);        return ZX_OK;    }    }    return ZX_ERR_NOT_SUPPORTED;}
开发者ID:saltstar,项目名称:smartnix,代码行数:50,


示例17: StreamLoginInfo

void StreamLoginInfo(node* p, tchar_t* URL, bool_t Proxy){    tchar_t LoginPass[MAXPATH];    if (SplitAddr(URL,LoginPass,TSIZEOF(LoginPass),NULL,0))    {        // extract the login:pass from the URL as there seems to be one        tchar_t *s,*t;        if (!Proxy)        {            Node_SetData(p,STREAM_FULL_URL,TYPE_STRING,URL);            t = (tchar_t*)GetProtocol(URL,NULL,0,NULL);            s = tcschr(t,T('@'));            assert(s!=NULL);            ++s;            memmove(t, s, tcsbytes(s));        }        t = (tchar_t*)GetProtocol(LoginPass,NULL,0,NULL);        s=tcschr(t,T(':'));        if (s)            *s++ = 0;        if (Proxy)        {            Node_SetData(p,STREAM_PROXY_PASSWORD,TYPE_STRING,s);            Node_SetData(p,STREAM_PROXY_USERNAME,TYPE_STRING,t);        }        else        {            Node_SetData(p,STREAM_PASSWORD,TYPE_STRING,s);            Node_SetData(p,STREAM_USERNAME,TYPE_STRING,t);        }    }    else        Node_RemoveData(p,STREAM_FULL_URL,TYPE_STRING);}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:37,


示例18: SplitURLLogin

void SplitURLLogin(const tchar_t *URL, tchar_t *UserName, size_t UserNameLen, tchar_t *Password, size_t PasswordLen, tchar_t *URL2, size_t URL2Len){    tchar_t LoginPass[MAXPATH];    if (SplitAddr(URL, LoginPass, TSIZEOF(LoginPass), NULL, 0))    {        tchar_t *s,*t;        if (URL2)         {            tcscpy_s(URL2, URL2Len, URL);            t = (tchar_t*)GetProtocol(URL2,NULL,0,NULL);            s = tcschr(t,T('@'));            assert(s!=NULL);            ++s;            memmove(t, s, tcsbytes(s));        }        t = (tchar_t*)GetProtocol(LoginPass,NULL,0,NULL);        s=tcschr(t,T(':'));        if (s)        {            *s++ = 0;// missing: resolving escape sequences            if (Password)                tcscpy_s(Password, PasswordLen, s);        }          else            tcsclr_s(Password, PasswordLen);        if (UserName)            tcscpy_s(UserName, UserNameLen, t);    } else {        tcsclr_s(UserName, UserNameLen);        tcsclr_s(Password, PasswordLen);        if (URL2)            tcscpy_s(URL2, URL2Len, URL);    }}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:36,


示例19: FATAL

bool InNetLiveFLVStream::FeedData(uint8_t *pData, uint32_t dataLength,		uint32_t processedLength, uint32_t totalLength,		double pts, double dts, bool isAudio) {	if (isAudio) {		_stats.audio.packetsCount++;		_stats.audio.bytesCount += dataLength;		if ((!_audioCapabilitiesInitialized) && (processedLength == 0)) {			if (!InNetRTMPStream::InitializeAudioCapabilities(this,					_streamCapabilities, _audioCapabilitiesInitialized, pData,					dataLength)) {				FATAL("Unable to initialize audio capabilities");				return false;			}		}		_lastAudioTime = pts;	} else {		_stats.video.packetsCount++;		_stats.video.bytesCount += dataLength;		if ((!_videoCapabilitiesInitialized) && (processedLength == 0)) {			if (!InNetRTMPStream::InitializeVideoCapabilities(this,					_streamCapabilities, _videoCapabilitiesInitialized, pData,					dataLength)) {				FATAL("Unable to initialize audio capabilities");				return false;			}		}		_lastVideoPts = pts;		_lastVideoDts = dts;	}	LinkedListNode<BaseOutStream *> *pTemp = _pOutStreams;	while (pTemp != NULL) {		if (!pTemp->info->IsEnqueueForDelete()) {			if (!pTemp->info->FeedData(pData, dataLength, processedLength, totalLength,					pts, dts, isAudio)) {				FINEST("Unable to feed OS: %p", pTemp->info);				pTemp->info->EnqueueForDelete();				if (GetProtocol() == pTemp->info->GetProtocol()) {					return false;				}			}		}		pTemp = pTemp->pPrev;	}	return true;}
开发者ID:pas-jim,项目名称:crtmpserver-knife,代码行数:46,


示例20: WXUNUSED

wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),                                        const wxString& location){#if !wxUSE_URL    return NULL;#else    wxString right =        GetProtocol(location) + wxT(":") + StripProtocolAnchor(location);    wxURL url(right);    if (url.GetError() == wxURL_NOERR)    {        wxInputStream *s = url.GetInputStream();        if (s)        {            wxString tmpfile =                wxFileName::CreateTempFileName(wxT("wxhtml"));            {   // now copy streams content to temporary file:                wxFileOutputStream sout(tmpfile);                s->Read(sout);            }            delete s;            // Content-Type header, as defined by the RFC 2045, has the form of            // "type/subtype" optionally followed by (multiple) "; parameter"            // and we need just the MIME type here.            const wxString& content = url.GetProtocol().GetContentType();            wxString mimetype = content.BeforeFirst(';');            mimetype.Trim();            return new wxFSFile(new wxTemporaryFileInputStream(tmpfile),                                right,                                mimetype,                                GetAnchor(location)#if wxUSE_DATETIME                                , wxDateTime::Now()#endif // wxUSE_DATETIME                        );        }    }    return NULL; // incorrect URL#endif}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:45,


示例21: while

void SyncClientChannel::TryFireMessage() {  while (true) {    ProtocolMessage* fire_message = sequence_keeper_.Fire();    if (!fire_message) {      return;    }    if (Protocol::kEncodeSuccess != GetProtocol()->Encode(&write_buffer_, fire_message)) {      MI_LOG_WARN(logger, "SyncClientChannel::TryFireMessage encode fail");      DoSendBack(fire_message, ProtocolMessage::kStatusEncodeFail);      sequence_keeper_.Fetch();      continue;    }    OnWrite();    break;  }}
开发者ID:wolfhead,项目名称:minotaur,代码行数:18,


示例22: GetRightLocation

wxFSFile* wxFilterFSHandler::OpenFile(        wxFileSystem& fs,        const wxString& location){    wxString right = GetRightLocation(location);    if (!right.empty())        return NULL;    wxString protocol = GetProtocol(location);    const wxFilterClassFactory *factory = wxFilterClassFactory::Find(protocol);    if (!factory)        return NULL;    wxString left = GetLeftLocation(location);    wxFSFilePtr leftFile(fs.OpenFile(left));    if (!leftFile.get())        return NULL;    wxInputStreamPtr leftStream(leftFile->DetachStream());    if (!leftStream.get() || !leftStream->IsOk())        return NULL;    wxInputStreamPtr stream(factory->NewStream(leftStream.release()));    // The way compressed streams are supposed to be served is e.g.:    //  Content-type: application/postscript    //  Content-encoding: gzip    // So the mime type should be just the mime type of the lhs. However check    // whether the mime type is that of this compression format (e.g.    // application/gzip). If so pop any extension and try GetMimeTypeFromExt,    // e.g. if it were '.ps.gz' pop the '.gz' and try looking up '.ps'    wxString mime = leftFile->GetMimeType();    if (factory->CanHandle(mime, wxSTREAM_MIMETYPE))        mime = GetMimeTypeFromExt(factory->PopExtension(left));    return new wxFSFile(stream.release(),                        left + wxT("#") + protocol + wxT(":") + right,                        mime,                        GetAnchor(location)#if wxUSE_DATETIME                        , leftFile->GetModificationTime()#endif // wxUSE_DATETIME                       );}
开发者ID:Anonymous2,项目名称:project64,代码行数:44,


示例23: AddPathDelimiter

void AddPathDelimiter(tchar_t* Path,size_t PathLen){    size_t n = tcslen(Path);#if defined(TARGET_WIN) || defined(TARGET_SYMBIAN)    bool_t HasProtocol = GetProtocol(Path,NULL,0,NULL)==Path;	if (!n || (n>0 && (HasProtocol || Path[n-1] != '/') && (!HasProtocol || Path[n-1] != '//')))	{        if (HasProtocol)            tcscat_s(Path,PathLen,T("//"));        else	    	tcscat_s(Path,PathLen,T("/"));	}#elif defined(TARGET_PS2SDK)	if (!n || (n>0 && Path[n-1] != '/' && Path[n-1] != '//' && Path[n-1] != ':'))		tcscat_s(Path,PathLen,T("/"));#else	if (!n || (n>0 && Path[n-1] != '/'))		tcscat_s(Path,PathLen,T("/"));#endif}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:20,


示例24: while

bool InNetTSStream::FeedData(uint8_t *pData, uint32_t dataLength,		uint32_t processedLength, uint32_t totalLength,		double pts, double dts, bool isAudio) {	if (((_hasAudio)&&(_streamCapabilities.GetAudioCodecType() != CODEC_AUDIO_AAC))			|| ((_hasVideo)&&(_streamCapabilities.GetVideoCodecType() != CODEC_VIDEO_H264))			|| (!_enabled)) {		if (isAudio) {			_stats.audio.droppedBytesCount += dataLength;			_stats.audio.droppedPacketsCount++;		} else {			_stats.video.droppedBytesCount += dataLength;			_stats.video.droppedPacketsCount++;		}		return true;	}	if (isAudio) {		_stats.audio.packetsCount++;		_stats.audio.bytesCount += dataLength;	} else {		_stats.video.packetsCount++;		_stats.video.bytesCount += dataLength;	}	LinkedListNode<BaseOutStream *> *pIterator = _pOutStreams;	LinkedListNode<BaseOutStream *> *pCurrent = NULL;	while (pIterator != NULL) {		pCurrent = pIterator;		pIterator = pIterator->pPrev;		if (pCurrent->info->IsEnqueueForDelete())			continue;		if (!pCurrent->info->FeedData(pData, dataLength, processedLength, totalLength,				pts, dts, isAudio)) {			if ((pIterator != NULL)&&(pIterator->pNext == pCurrent)) {				pCurrent->info->EnqueueForDelete();				if (GetProtocol() == pCurrent->info->GetProtocol()) {					return false;				}			}		}	}	return true;}
开发者ID:9aa5,项目名称:crtmpserver,代码行数:41,


示例25: OnList

	bool OnList(LocalUser* user) override	{		// Don't send the cap to clients that only support cap-3.1.		if (GetProtocol(user) == Cap::CAP_LEGACY)			return false;		// Plaintext listeners have their own policy.		SSLIOHook* sslhook = SSLIOHook::IsSSL(&user->eh);		if (!sslhook)			return true;		// If no hostname has been provided for the connection, an STS persistence policy SHOULD NOT be advertised.		std::string snihost;		if (!sslhook->GetServerName(snihost))			return false;		// Before advertising an STS persistence policy over a secure connection, servers SHOULD verify whether the		// hostname provided by clients, for example, via TLS Server Name Indication (SNI), has been whitelisted by		// administrators in the server configuration.		return InspIRCd::Match(snihost, host, ascii_case_insensitive_map);	}
开发者ID:Adam-,项目名称:inspircd,代码行数:21,


示例26: DumpPacket

/*--------------------------------------------------------------------*/void DumpPacket(char *buffer, int len){	struct ip_packet *ip=(void*)buffer;	printf("-------------------------------------------------/n");	dump(buffer, len);	PrintAddr("Destination EtherID=", ip->hw_header.dst_eth, eETH_ADDR);	PrintAddr(", Source EtherID=", ip->hw_header.src_eth, eETH_ADDR);	printf("/nIPv%d: header-len=%d, type=%d, packet-size=%d, ID=%d/n",		ip->version, ip->header_len*4, ip->serve_type,		ntohs(ip->packet_len), ntohs(ip->ID));	printf("frag=%c, more=%c, offset=%d, TTL=%d, protocol=%s/n",		(ip->dont_frag? 'N': 'Y'),		(ip->more_frags? 'N': 'Y'),		ip->frag_offset,		ip->time_to_live, GetProtocol(ip->protocol));	printf("checksum=%d, ", ntohs(ip->hdr_chksum));	PrintAddr("source=", ip->IPv4_src, eIP_ADDR);	PrintAddr(", destination=", ip->IPv4_dst, eIP_ADDR);	printf("/n");	fflush(stdout);}
开发者ID:yanjunbill,项目名称:LinuxShell,代码行数:22,


示例27: WXUNUSED

wxFSFile* wxInternetFSHandler::OpenFile(wxFileSystem& WXUNUSED(fs),                                        const wxString& location){#if !wxUSE_URL    return NULL;#else    wxString right =        GetProtocol(location) + wxT(":") + StripProtocolAnchor(location);    wxURL url(right);    if (url.GetError() == wxURL_NOERR)    {        wxInputStream *s = url.GetInputStream();        wxString content = url.GetProtocol().GetContentType();        if (content == wxEmptyString) content = GetMimeTypeFromExt(location);        if (s)        {            wxString tmpfile =                wxFileName::CreateTempFileName(wxT("wxhtml"));            {   // now copy streams content to temporary file:                wxFileOutputStream sout(tmpfile);                s->Read(sout);            }            delete s;            return new wxFSFile(new wxTemporaryFileInputStream(tmpfile),                                right,                                content,                                GetAnchor(location)#if wxUSE_DATETIME                                , wxDateTime::Now()#endif // wxUSE_DATETIME                        );        }    }    return (wxFSFile*) NULL; // incorrect URL#endif}
开发者ID:Ailick,项目名称:rpcs3,代码行数:40,


示例28: GetProtocol

const tchar_t* GetProtocol(const tchar_t* URL, tchar_t* Proto, int ProtoLen, bool_t* HasHost){	const tchar_t* s = tcschr(URL,':');	if (s && s[1] == '/' && s[2] == '/')	{        while (URL<s && IsSpace(*URL)) ++URL;		if (Proto)			tcsncpy_s(Proto,ProtoLen,URL,s-URL);		if (HasHost)        {            if (tcsnicmp(URL,T("urlpart"),7)==0)                // skip this protocol for the Host checking                GetProtocol(URL+10,NULL,0,HasHost);            else			*HasHost = tcsnicmp(URL,T("file"),4)!=0 &&			           tcsnicmp(URL,T("conf"),3)!=0 &&			           tcsnicmp(URL,T("res"),3)!=0 &&			           tcsnicmp(URL,T("root"),4)!=0 &&			           tcsnicmp(URL,T("mem"),3)!=0 &&			           tcsnicmp(URL,T("pose"),4)!=0 &&			           tcsnicmp(URL,T("vol"),3)!=0 &&			           tcsnicmp(URL,T("slot"),4)!=0 &&					   tcsnicmp(URL,T("simu"),4)!=0 &&					   tcsnicmp(URL,T("local"),5)!=0 &&					   tcsnicmp(URL,T("sdcard"),6)!=0;        }		s += 3;	}	else	{		if (HasHost)			*HasHost = 0;		if (Proto)			tcscpy_s(Proto,ProtoLen,T("file"));		s = URL;	}	return s;}
开发者ID:CDavantzis,项目名称:foundation-source,代码行数:38,



注:本文中的GetProtocol函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetProxy函数代码示例
C++ GetPropertyData函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。