示例#1
0
static bool SSRVideoStreamParse(const std::string& filename, SSRVideoStream* stream) {

	// check the prefix
	std::string prefix = "video-";
	if(filename.compare(0, prefix.length(), prefix) != 0)
		return false;

	// split into parts
	size_t pos = prefix.length();
	std::array<std::string, 2> parts;
	for(size_t i = 0; i < parts.size(); ++i) {
		size_t dash = filename.find_first_of('-', pos);
		if(dash == std::string::npos)
			return false;
		parts[i] = filename.substr(pos, dash - pos);
		pos = dash + 1;
	}

	// save the parts
	stream->m_stream_name = filename.substr(prefix.length());
	if(!StringToNum(parts[0], &stream->m_creation_time))
		return false;
	if(!StringToNum(parts[1], &stream->m_process_id))
		return false;

	return true;
}
示例#2
0
void display_help(short mode,short parent)
{
	Str255 get_text;
   long get_val;
   short item_hit;
	
	store_help_mode = mode;
	cur_entry = 3;

	make_cursor_sword();

	cd_create_dialog_parent_num(997,parent);

		get_str (get_text, 25 + mode, 1);
		csit( 997,6,(char *) get_text);
		GetIndString (get_text, 25 + mode, 2);
		StringToNum(get_text,&get_val);
		num_entries = (short) get_val;
		get_str (get_text, 25 + mode, cur_entry);
		csit( 997,7,(char *) get_text);
	
	
	item_hit = cd_run_dialog();	
	cd_kill_dialog(997);

}
示例#3
0
void stringtonum(char *theString, long *theNum)
{
	char localStr[256] ="";
	strcpy(localStr,theString);
	my_c2pstr(localStr);
	StringToNum((StringPtr)localStr,theNum);
}
示例#4
0
NMBoolean
NMTeardownDialog(
    NMDialogPtr	dialog,
    NMBoolean	inUpdateConfig,
    NMConfigRef	ioConfig)
{
    DEBUG_ENTRY_EXIT("NMTeardownDialog");

    NMIPConfigPriv	*theConfig = (NMIPConfigPriv *) ioConfig;
    NMErr		status;
    InetAddress		addr;
    Str255			hostText;
    Str255			portText;

    NMSInt16		kind;
    Rect 			r;
    Handle 			h;
    NMSInt32		theVal;
    SetTempPort		port(dialog);

    op_vassert_return((theConfig != NULL),"Config ref is NULL!",true);
    op_vassert_return((dialog != NULL),"Dialog ptr is NULL!",true);

    if (inUpdateConfig)
    {
        // 	Get the host text
        GetDialogItem(dialog, gBaseItem + kHostText, &kind, &h, &r);
        GetDialogItemText(h, hostText);

        p2cstr(hostText);

        //	resolve it into a host addr
        status = OTUtils::MakeInetAddressFromString((const char *)hostText, &addr);
        op_warn(status == kNMNoError);

        if (status != kNMNoError)
            return false;

        theConfig->address = addr;

        //	Get the port text
        GetDialogItem(dialog, gBaseItem + kPortText, &kind, &h, &r);
        GetDialogItemText(h, portText);
        StringToNum(portText, &theVal);

        if (theVal != 0)
            theConfig->address.fPort = theVal;
    }

    return true;
}
long QTUtils_GetMovieTargetID (Movie theMovie, Boolean *theMovieHasID)
{
	UserData		myUserData = NULL;
	long			myID = 0;
	char 			*myString = NULL;
	StringPtr 		myPString = NULL;
	Boolean			myMovieHasID = false;
	OSErr			myErr = noErr;
	
	// make sure we've got a movie
	if (theMovie == NULL)
		goto bail;
	
	// get the movie's user data list
	myUserData = GetMovieUserData(theMovie);
	if (myUserData == NULL)
		goto bail;

	// find the "value" of the user data item of type 'plug' that begins with the string "movieid="
	myString = QTUtils_GetUserDataPrefixedValue(myUserData, FOUR_CHAR_CODE('plug'), kMovieIDPrefix);
	
	// convert the string into a number
	if (myString != NULL) {
		myPString = QTUtils_ConvertCToPascalString(myString);
		StringToNum(myPString, &myID);
		myMovieHasID = true;
	}

bail:
	free(myString);
	free(myPString);

	if (theMovieHasID != NULL)
		*theMovieHasID = myMovieHasID;
		
	return(myID);
}