コード例 #1
0
/* initialize */
void Init()
{
    GetChar();
    SkipWhite();
    InitTable();
    ClearParams();
}
コード例 #2
0
ファイル: vwebp.c プロジェクト: appunite/libwebp
static void HandleKey(unsigned char key, int pos_x, int pos_y) {
  (void)pos_x;
  (void)pos_y;
  if (key == 'q' || key == 'Q' || key == 27 /* Esc */) {
#ifdef FREEGLUT
    glutLeaveMainLoop();
#else
    ClearParams();
    exit(0);
#endif
  } else if (key == 'c') {
    if (kParams.has_color_profile && !kParams.decoding_error) {
      kParams.use_color_profile = 1 - kParams.use_color_profile;

      if (kParams.has_animation) {
        // Restart the completed animation to pickup the color profile change.
        if (kParams.done && kParams.loop_count == 0) {
          kParams.loop_count =
              (int)WebPDemuxGetI(kParams.dmux, WEBP_FF_LOOP_COUNT) + 1;
          kParams.done = 0;
          // Start the decode loop immediately.
          glutTimerFunc(0, decode_callback, 0);
        }
      } else {
        Decode();
        glutPostRedisplay();
      }
    }
  } else if (key == 'i') {
    kParams.print_info = 1 - kParams.print_info;
    glutPostRedisplay();
  }
}
コード例 #3
0
ファイル: ItemList.cpp プロジェクト: NeoAnomaly/xray
void __fastcall TItemList::FormClose(TObject *Sender,
      TCloseAction &Action)
{

    if (!OnCloseEvent.empty()) 	OnCloseEvent();
	ClearParams					();
}
コード例 #4
0
// ---------------------------------------------------------------------------
// Inform the request observer that request has been completed.
// ---------------------------------------------------------------------------
//
void CPsetCallBarring::RequestCompleted( const TInt& aError )
    {
    if ( aError != KErrNone )
        {
        SetRequestStatus( static_cast <TPSetBarringRequest> (aError) );
        }    
    ClearParams();

    if ( iReqObserver )
        {
        iReqObserver->RequestComplete(); 
        }
    }
コード例 #5
0
ファイル: Statement.cpp プロジェクト: openlink/WebDB_ODBC
StatementObject::~StatementObject()
{
  ClearParams();

  if (m_hstmt != NULL)
    SQLFreeHandle (SQL_HANDLE_STMT, m_hstmt);

  if (m_conn) {
    NPN_ReleaseObject(m_conn);
    m_conn = NULL;
  }

}
コード例 #6
0
ファイル: vwebp.c プロジェクト: brow1726/webp
static void HandleKey(unsigned char key, int pos_x, int pos_y) {
  // Note: rescaling the window or toggling some features during an animation
  // generates visual artifacts. This is not fixed because refreshing the frame
  // may require rendering the whole animation from start till current frame.
  (void)pos_x;
  (void)pos_y;
  if (key == 'q' || key == 'Q' || key == 27 /* Esc */) {
#ifdef FREEGLUT
    glutLeaveMainLoop();
#else
    ClearParams();
    exit(0);
#endif
  } else if (key == 'c') {
    if (kParams.has_color_profile && !kParams.decoding_error) {
      kParams.use_color_profile = 1 - kParams.use_color_profile;

      if (kParams.has_animation) {
        // Restart the completed animation to pickup the color profile change.
        if (kParams.done && kParams.loop_count == 0) {
          kParams.loop_count =
              (int)WebPDemuxGetI(kParams.dmux, WEBP_FF_LOOP_COUNT) + 1;
          kParams.done = 0;
          // Start the decode loop immediately.
          glutTimerFunc(0, decode_callback, 0);
        }
      } else {
        Decode();
        glutPostRedisplay();
      }
    }
  } else if (key == 'b') {
    kParams.draw_anim_background_color = 1 - kParams.draw_anim_background_color;
    if (!kParams.has_animation) ClearPreviousFrame();
    glutPostRedisplay();
  } else if (key == 'i') {
    kParams.print_info = 1 - kParams.print_info;
    if (!kParams.has_animation) ClearPreviousFrame();
    glutPostRedisplay();
  } else if (key == 'd') {
    kParams.only_deltas = 1 - kParams.only_deltas;
    glutPostRedisplay();
  }
}
コード例 #7
0
// ---------------------------------------------------------------------------
// 
// Cancels pending request.
// 
// ---------------------------------------------------------------------------
//
void CPsetCallBarring::DoCancel()
    {    
    switch ( iCurrentReq )
        {
        case EPSetRequestChangeBarring:
            iPhone.CancelAsyncRequest( 
                EMobilePhoneSetCallBarringStatus );
            break;
        case EPSetRequestGetStatus:
            iCbStatusInterrogator->Cancel();
            delete iCbStatusInterrogator;
            iCbStatusInterrogator = NULL;
            break;
        case EPSetRequestChangeBarringPwd:
        case EPSetRequestChangeCommonPwd:
            iPhone.CancelAsyncRequest( EMobilePhoneSetSSPassword );
            break;
        default:
            break;
        }
    ClearParams();    
    }
コード例 #8
0
ファイル: Statement.cpp プロジェクト: openlink/WebDB_ODBC
NPError
StatementObject::Execute(NPString *query)
{
  if (!m_hstmt) {
    NPN_SetException(this, "Statement isn't initialized");
    return NPERR_GENERIC_ERROR;
  }

  NPError rc = Close();
  if (rc != NPERR_NO_ERROR)
    return rc;

    /**********/
  int i = 0;
  VecODBCParams::iterator p;

  if (!m_params.empty()) {
    for(p = m_params.begin(); p < m_params.end(); p++) {
      nsODBCParam *val = *p;

      if (val == NULL) {
        return NPERR_GENERIC_ERROR;
      }

      i++;
      switch(val->mType) {
        case nsODBCParam::VTYPE_BOOL :
        {
          val->mInd = 0;
          rc = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
             SQL_C_BIT, SQL_BIT, sizeof(bool), 0, &(val->mVal.mBoolValue), 
             0, (SQLLEN *)&(val->mInd)));
    	  if (rc != NPERR_NO_ERROR)
    	    return rc;
    	  break;
        }

        case nsODBCParam::VTYPE_INT32 :
        {
          val->mInd = 0;
          rc = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
             SQL_C_SLONG, SQL_INTEGER, sizeof(int), 0, &(val->mVal.mInt32Value), 
             0, (SQLLEN *)&(val->mInd)));
    	  if (rc != NPERR_NO_ERROR)
    	    return rc;
    	  break;
        }

        case nsODBCParam::VTYPE_DOUBLE :
        {
          val->mInd = 0;
          rc = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
             SQL_C_DOUBLE, SQL_DOUBLE, sizeof(double), 0, &(val->mVal.mDoubleValue),
             0, (SQLLEN *)&(val->mInd)));
    	  if (rc != NPERR_NO_ERROR)
    	    return rc;
    	  break;
        }

        case nsODBCParam::VTYPE_STRING :
        {
          nsWString *v_str = val->mVal.mStringValue;
          val->mInd = SQL_NTS;
    	  rc = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
    	     SQL_C_WCHAR, (val->mIsLong?SQL_WLONGVARCHAR:SQL_WVARCHAR), 
    	     v_str->Length(), 0, v_str->Data(), 0, (SQLLEN *)&(val->mInd)));
    	  if (rc != NPERR_NO_ERROR)
    	    return rc;
    	  break;
        }

#if 0
      case nsIDataType::VTYPE_ARRAY :
      {
          nsBinary *v_bin = val->mVal.mBinValue;
          val->mInd = v_bin->Length();
          rv = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
             SQL_C_BINARY, (val->mIsLong?SQL_LONGVARBINARY:SQL_VARBINARY), 
             v_bin->Length(), 0, v_bin->Data(), 0, (SQLINTEGER *)&(val->mInd)));
    	  if (rv != NS_OK)
    	    return rv;
    	  break;
      }
#endif

        default:
        {
          val->mInd = SQL_NULL_DATA;
          rc = CheckStmtRC(SQLBindParameter(m_hstmt, i, SQL_PARAM_INPUT, 
             SQL_C_CHAR, SQL_VARCHAR, 0, 0, NULL, 0, (SQLLEN *)&(val->mInd)));
    	  if (rc != NPERR_NO_ERROR)
    	    return rc;
   	  break;
        }
      }
    }
  }
    /**********/

  SQLRETURN code = SQLExecDirectW (m_hstmt, nsWString(query).Data(), SQL_NTS);
  if (!SQL_SUCCEEDED(code) && code != SQL_NO_DATA) {
    StoreError(SQL_HANDLE_STMT, m_hstmt);  
    ClearParams();
    return NPERR_GENERIC_ERROR;

  } 
  SQLFreeStmt (m_hstmt, SQL_RESET_PARAMS);
  ClearParams();

    
  SQLSMALLINT cols;
  if (SQL_SUCCEEDED(SQLNumResultCols(m_hstmt, &cols)))
    m_columnCount = cols;

  SQLLEN rcnt;
  if (SQL_SUCCEEDED(SQLRowCount(m_hstmt, &rcnt)))
    m_rowCount = rcnt;
    
  return NPERR_NO_ERROR;
}
コード例 #9
0
ファイル: ItemList.cpp プロジェクト: NeoAnomaly/xray
void __fastcall TItemList::AssignItems(ListItemsVec& items, bool full_expand, bool full_sort)
{
	// begin fill mode
	LockUpdating			();
    // clear values
//    if (tvItems->Selected) FHelper.MakeFullName(tvItems->Selected,0,last_selected_item);
    if (!m_Items.empty())	ClearParams();
    // fill values
    m_Items					= items;
	for (ListItemsIt it=m_Items.begin(); it!=m_Items.end(); it++){
    	ListItem* prop		= *it;
        if (prop->key.size()&&(prop->key[prop->key.size()-1]=='\\')){
        	prop->item		= FHelper.AppendFolder(tvItems,*prop->key,!m_Flags.is(ilSuppressIcon));
            TElTreeItem* prop_item	= (TElTreeItem*)prop->item;
            prop_item->CheckBoxEnabled 		= false;
            prop_item->UseStyles		   	= true;
            prop_item->MainStyle->TextColor		= (TColor)prop->prop_color;         
            prop_item->MainStyle->OwnerProps 	= true;
            prop_item->MainStyle->Style 		= ElhsOwnerDraw;
        }else{
            prop->item		= FHelper.AppendObject(tvItems,*prop->key,false,!m_Flags.is(ilSuppressIcon));
            if (!prop->item){
				Msg				("#!Duplicate item name found: '%s'",*prop->key);
                break;
            }
            TElTreeItem* prop_item	= (TElTreeItem*)prop->item;
            prop_item->ImageIndex	= prop->icon_index;
            prop_item->Tag	    	= (int)prop;
            prop_item->UseStyles	= true;
            prop_item->CheckBoxEnabled = prop->m_Flags.is(ListItem::flShowCB);
            prop_item->ShowCheckBox 	= prop->m_Flags.is(ListItem::flShowCB);
            prop_item->CheckBoxState 	= (TCheckBoxState)prop->m_Flags.is(ListItem::flCBChecked);

            // set flags                                        
            if (prop->m_Flags.is(ListItem::flDrawThumbnail)){
                prop_item->Height 		= 64;
                prop_item->OwnerHeight = !miDrawThumbnails->Checked;
            }
            // set style
            prop_item->MainStyle->OwnerProps 	= true;
            prop_item->MainStyle->Style 		= ElhsOwnerDraw;
        }
    }

    // end fill mode
	if (full_expand) tvItems->FullExpand();

    // folder restore
    if (m_Flags.is(ilFolderStore)&&!FolderStore.empty()){
        for (TElTreeItem* item=tvItems->Items->GetFirstNode(); item; item=item->GetNext()){
            if (item->ChildrenCount){
                AnsiString nm;
                FHelper.MakeFullName		(item,0,nm);
                FolderStorePairIt it 		= FolderStore.find(nm);
                if (it!=FolderStore.end()){
                    SFolderStore& st_item 	= it->second;
                    if (st_item.expand) 	item->Expand	(false);
                    else					item->Collapse	(false);
                }
            }
        }
    }

    // sorting
    if (full_sort){
        tvItems->ShowColumns	= false;
    	tvItems->Sort			(true);
        tvItems->ShowColumns	= true;
    }else{
        for (ListItemsIt it=m_Items.begin(); it!=m_Items.end(); it++){
            ListItem* prop		= *it;
            if (prop->m_Flags.is(ListItem::flSorted)) ((TElTreeItem*)prop->item)->Sort(true);
        }
    }

    // expand sel items
    for (RStringVecIt s_it=last_selected_items.begin(); s_it!=last_selected_items.end(); s_it++)
    	FHelper.ExpandItem	(tvItems,**s_it);

	UnlockUpdating			();

    // restore selection
    tvItems->DeselectAll	();
    for (s_it=last_selected_items.begin(); s_it!=last_selected_items.end(); s_it++)
	    FHelper.RestoreSelection(tvItems,**s_it,true);

    // check size
	tvItemsResize			(0);

    paStatus->Caption		= AnsiString(" Items count: ")+m_Items.size();
}
コード例 #10
0
ファイル: ItemList.cpp プロジェクト: NeoAnomaly/xray
//---------------------------------------------------------------------------
void __fastcall TItemList::ClearList()
{
    ClearParams			();
}
コード例 #11
0
	RedundancyMap<Id> Condense(RedundancyMap<Id> uncondensed_map){
		uncondensed_map_ = uncondensed_map;
		ClearParams();

		TRACE("Start condensing");

		TRACE("Computing of main keys");
		auto all_ids_ = uncondensed_map_.AllElements();
		map<Id, bool> is_main;
		for(auto it = all_ids_.begin(); it != all_ids_.end(); it++)
			is_main[*it] = true;

		for(auto it = uncondensed_map_.begin(); it != uncondensed_map_.end(); it++){
			for(auto it_set = it->second.begin(); it_set != it->second.end(); it_set++){
				is_main[*it_set] = false;
			}
		}

		set<Id> main_keys;
		for(auto it = is_main.begin(); it != is_main.end(); it++)
			if(it->second)
				main_keys.insert(it->first);

		TRACE("Number of all keys - " << all_ids_.size());
		TRACE("Number of main keys - " << main_keys.size());
		TRACE("Condensing starts");

		need_processed_ = all_ids_.size();
		number_processed_ = 0;

		for(auto it = all_ids_.begin(); it != all_ids_.end(); it++)
			is_processed_[*it] = false;

		for(auto main_key = main_keys.begin(); main_key != main_keys.end(); main_key++){
			condensed_map_.SetValuesByKey(*main_key, uncondensed_map_.GetValuesByKey(*main_key));
			number_processed_++;
			is_processed_[*main_key] = true;
		}

		// main processing
		ProcessCondensing();

		// processing of non visiting Ids
		while(number_processed_ < need_processed_){
			size_t max_child_setsize = 0;
			Id start_id(0);
			for(auto it = is_processed_.begin(); it != is_processed_.end(); it++){
				if(!it->second && uncondensed_map_.GetValuesByKey(it->first).size() >= max_child_setsize){
					start_id = it->first;
					max_child_setsize = uncondensed_map_.GetValuesByKey(it->first).size();
				}
			}
			auto start_set = uncondensed_map_.GetValuesByKey(start_id);
			for(auto it = start_set.begin(); it != start_set.end(); it++)
				if(!is_processed_[*it])
					condensed_map_.AddNewPair(start_id, *it);

			is_processed_[start_id] = true;
			number_processed_++;
			ProcessCondensing();
		}

		VERIFY(number_processed_ == need_processed_);
		return condensed_map_;
	}