static KineticStatus KineticClient_CreateOperation( KineticOperation** operation, KineticSessionHandle handle) { if (handle == KINETIC_HANDLE_INVALID) { LOG0("Specified session has invalid handle value"); return KINETIC_STATUS_SESSION_EMPTY; } KineticConnection* connection = KineticConnection_FromHandle(handle); if (connection == NULL) { LOG0("Specified session is not associated with a connection"); return KINETIC_STATUS_SESSION_INVALID; } LOGF1("\n" "--------------------------------------------------\n" "Building new operation on connection @ 0x%llX", connection); *operation = KineticAllocator_NewOperation(connection); if (*operation == NULL) { return KINETIC_STATUS_MEMORY_ERROR; } if ((*operation)->request == NULL) { return KINETIC_STATUS_NO_PDUS_AVAVILABLE; } return KINETIC_STATUS_SUCCESS; }
void CMLauncherAppUi::PlaylistTransferCompleteL() { LOG(ELogGeneral,1,"PlaylistTransferCompleteL: start"); iActiveViews&=~EFiletransferViewActive; if(iCurrentView==iFiletransferView) { //we need to switch to a diferent vierw, e.g. list view LOG0("Activating list view"); SwitchViewL(iListView); LOG0("List view activated"); }/* else { //no need to switch view, but we must take care of the navi menu (may need replacing with exit) ChangeExitWithNaviL(-1); };*/ Clean(ETrue);//this function performs asynchronously //update the view if(iDirection==EDirectionReceiving) UpdateView(); LOG(ELogGeneral,-1,"PlaylistTransferCompleteL: end"); };
/** @brief Log a message from the Python. * * In AQUAgpusph the Python stdout and stderr are redirected to this function, * such that: * - stdout messages will be logged with level 0 * - stderr messages will be logged with level 3 * @param self Module. * @param args Positional arguments. * @param keywds Keyword arguments. * @return Computed value, NULL if errors have been detected. */ static PyObject* logMsg(PyObject *self, PyObject *args, PyObject *keywds) { int level; const char* msg; static char *kwlist[] = {"log_level", "message", NULL}; if (!PyArg_ParseTupleAndKeywords(args, keywds, "is", kwlist, &level, &msg)){ return NULL; } switch(level) { case 0: LOG0(Aqua::L_DEBUG, msg); break; case 1: LOG0(Aqua::L_INFO, msg); break; case 2: LOG0(Aqua::L_WARNING, msg); break; case 3: LOG0(Aqua::L_ERROR, msg); break; } Py_RETURN_NONE; }
void KineticController_HandleUnexpectedResponse(void *msg, int64_t seq_id, void *bus_udata, void *socket_udata) { KineticResponse * response = msg; KineticSession* session = socket_udata; bool connetionInfoReceived = false; char const * statusTag = "[PDU RX STATUS]"; char const * unexpectedTag = "[PDU RX UNEXPECTED]"; char const * logTag = unexpectedTag; int logAtLevel, protoLogAtLevel; (void)bus_udata; // Handle unsolicited status PDUs if (response->proto->authtype == COM__SEAGATE__KINETIC__PROTO__MESSAGE__AUTH_TYPE__UNSOLICITEDSTATUS) { int64_t connectionID = KineticResponse_GetConnectionID(response); if (connectionID != 0) { // Store connectionID from unsolicited status message in the session for future requests KineticSession_SetConnectionID(session, connectionID); LOGF2("Extracted connection ID from unsolicited status PDU (id=%lld)", connectionID); connetionInfoReceived = true; logTag = statusTag; logAtLevel = 2; protoLogAtLevel = 3; } else { LOG0("WARNING: Unsolicited status received. Connection being terminated by remote!"); logTag = statusTag; logAtLevel = 0; protoLogAtLevel = 0; KineticStatus status = KineticResponse_GetStatus(response); KineticSession_SetTerminationStatus(session, status); } } else { LOG0("WARNING: Received unexpected response!"); logTag = unexpectedTag; logAtLevel = 0; protoLogAtLevel = 0; } KineticLogger_LogPrintf(logAtLevel, "%s pdu: %p, session: %p, bus: %p, " "fd: %6d, seq: %8lld, protoLen: %8u, valueLen: %8u", logTag, (void*)response, (void*)session, (void*)session->messageBus, session->socket, (long long)seq_id, KineticResponse_GetProtobufLength(response), KineticResponse_GetValueLength(response)); KineticLogger_LogProtobuf(protoLogAtLevel, response->proto); KineticAllocator_FreeKineticResponse(response); if (connetionInfoReceived) { KineticResourceWaiter_SetAvailable(&session->connectionReady); } }
KineticStatus KineticSession_Create(KineticSession * const session, KineticClient * const client) { if (session == NULL) { LOG0("Session is NULL"); return KINETIC_STATUS_SESSION_EMPTY; } if (client == NULL) { LOG0("Client is NULL"); return KINETIC_STATUS_SESSION_EMPTY; } session->connected = false; session->socket = KINETIC_SOCKET_INVALID; // initialize session send mutex if (pthread_mutex_init(&session->sendMutex, NULL) != 0) { LOG0("Failed initializing session send mutex!"); return KINETIC_STATUS_MEMORY_ERROR; } session->outstandingOperations = KineticCountingSemaphore_Create(KINETIC_MAX_OUTSTANDING_OPERATIONS_PER_SESSION); if (session->outstandingOperations == NULL) { LOG0("Failed creating session counting semaphore!"); return KINETIC_STATUS_MEMORY_ERROR; } return KINETIC_STATUS_SUCCESS; }
bool IODicom<T>::ReadMetaData(PGCore::BaseDataObject *oMetaDataObject, const IOParams &iParams) { const std::vector<std::string>& iPaths = iParams.Source(); if (iPaths.empty()) { LOG0("IO/IODicom::ReadMetaData: Invalid input filename vector."); return false; } const std::string &iFileName = iPaths[0]; if (iFileName.empty()) { LOG0("IO/IODicom::ReadMetaData: Invalid input filename."); return false; } //this is where to read the image in PGCore::MetaData<T> *oMetaData = (static_cast<PGCore::MetaData< T > *>(oMetaDataObject)); if (!oMetaData) { LOG0("IO/IOBase::ReadMetaData: Invalid output container for metadata."); return false; } return GetAttributes(*oMetaData, iFileName); }
SQLCode::SQLCode() { LOG0(SourceInfo, DebugUtil::DebugSQL,"Begin build the Hash table..."); m_pSqlFileHelper = new SQLFileHelper(); LOG0(SourceInfo, DebugUtil::DebugSQL,"End build the Hash table..."); }
KineticStatus KineticClient_DestroySession(KineticSession* const session) { if (session == NULL) { LOG0("KineticSession is NULL!"); return KINETIC_STATUS_SESSION_INVALID; } KineticStatus status = KineticSession_Disconnect(session); if (status != KINETIC_STATUS_SUCCESS) {LOG0("Disconnection failed!");} KineticSession_Destroy(session); return status; }
KineticStatus KineticSession_Connect(KineticSession * const session) { if (session == NULL) { return KINETIC_STATUS_SESSION_EMPTY; } // Establish the connection KINETIC_ASSERT(strlen(session->config.host) > 0); session->socket = KineticSocket_Connect( session->config.host, session->config.port); if (session->socket == KINETIC_SOCKET_DESCRIPTOR_INVALID) { LOG0("Session connection failed!"); session->socket = KINETIC_SOCKET_DESCRIPTOR_INVALID; session->connected = false; return KINETIC_STATUS_CONNECTION_ERROR; } session->connected = true; bus_socket_t socket_type = session->config.useSsl ? BUS_SOCKET_SSL : BUS_SOCKET_PLAIN; session->si = calloc(1, sizeof(socket_info) + 2 * PDU_PROTO_MAX_LEN); if (session->si == NULL) { return KINETIC_STATUS_MEMORY_ERROR; } bool success = Bus_RegisterSocket(session->messageBus, socket_type, session->socket, session); if (!success) { LOG0("Failed registering connection with client!"); goto connection_error_cleanup; } // Wait for initial unsolicited status to be received in order to obtain connection ID success = KineticResourceWaiter_WaitTilAvailable(&session->connectionReady, KINETIC_CONNECTION_TIMEOUT_SECS); if (!success) { LOG0("Timed out waiting for connection ID from device!"); goto connection_error_cleanup; } LOGF1("Received connection ID %lld for session %p", (long long)KineticSession_GetConnectionID(session), (void*)session); return KINETIC_STATUS_SUCCESS; connection_error_cleanup: if (session->si != NULL) { free(session->si); session->si = NULL; } if (session->socket != KINETIC_SOCKET_DESCRIPTOR_INVALID) { KineticSocket_Close(session->socket); session->socket = KINETIC_SOCKET_DESCRIPTOR_INVALID; } session->connected = false; return KINETIC_STATUS_CONNECTION_ERROR; }
void gInitStructuredExceptionHandler() { // TODO LPP: Should we use a thread local variable to ensure we only call // _set_se_translator() once per thread? Does _set_se_translator() already do this? static bool shouldSetSeTranslator = RunParams::getInstance().isSet(RPARAM_DEBUGLOGSTACKTRACE); if (shouldSetSeTranslator) { LOG0(SourceInfo, DebugUtil::DebugDebug, "gInitStructuredExceptionHandler(): calling _set_se_translator()"); _set_se_translator( translator_func ); } else { LOG0(SourceInfo, DebugUtil::DebugDebug, "gInitStructuredExceptionHandler(): NOT calling _set_se_translator()"); } }
JERRCODE CJPEGDecoder::ProcessRestart(int thread_id) { IppStatus status; #ifdef _OPENMP status = ippiDecodeHuffmanStateInit_JPEG_8u(m_state_t[thread_id]); #else status = ippiDecodeHuffmanStateInit_JPEG_8u(m_state); #endif if(ippStsNoErr != status) { LOG0("Error: ippiDecodeHuffmanStateInit_JPEG_8u() failed"); return JPEG_ERR_INTERNAL; } for(int n = 0; n < m_jpeg_ncomp; n++) { m_ccomp[n].m_lastDC = 0; } #ifdef _OPENMP if(m_threading_mode == JT_RSTI) { for(int n = 0; n < m_jpeg_ncomp; n++) { m_lastDC[thread_id][n] = 0; } } #endif return JPEG_OK; } // CJPEGDecoder::ProcessRestart()
BOOL CAuthenticationPg::OnInitDialog() { LOG0(3, "CAuthenticationPg::OnInitDialog()"); CPropertyPage::OnInitDialog(); return TRUE; }
//--------------------------------------------------------------------------- // // セーブ // //--------------------------------------------------------------------------- int FASTCALL CRTC::Save(Fileio *fio, int ver) { size_t sz; ASSERT(this); ASSERT(fio); LOG0(Log::Normal, "セーブ"); // サイズをセーブ sz = sizeof(crtc_t); if (!fio->Write(&sz, sizeof(sz))) { return FALSE; } // 実体をセーブ if (!fio->Write(&crtc, (int)sz)) { return FALSE; } // イベントをセーブ if (!event.Save(fio, ver)) { return FALSE; } return TRUE; }
bool ErosionKernel<T, U>::Initialize_() { if (m_radius<=0.0f) { return false; } // fill up the buffer here int i=0; // fill circle /*for (i=0;i<(m_dimension);i++) { SetValue(0, i, 1); }*/ bool res = drawCircle(m_dimension/2, m_dimension/2, m_radius, m_buffer); if (!res) return false; #ifdef _DEBUG if (0) { LOG1("The filter coefficients are (radius: %d):", m_radius); for(int j=0;j<(m_dimension);j++) { LOG0("\n"); for(i=0;i<(m_dimension);i++) LOG3("Kernel[%d][%d] = %f", j, i, (double)GetValue(j, i)); } } #endif return true; }
void CPropCachingPg::UpdateControls() { LOG0(3, "CPropCachingPg::UpdateControls()"); if (m_ctlSpecificCaching.GetCheck() == BST_CHECKED) { m_ctlStoreImages.EnableWindow(); m_ctlCacheOnlineContent.EnableWindow(); } else { m_ctlStoreImages.EnableWindow(FALSE); m_ctlCacheOnlineContent.EnableWindow(FALSE); } if (m_ctlCacheEnclosures.GetCheck() == BST_CHECKED) { m_ctlEnclosureLimit.EnableWindow(); m_ctlLargerLbl.EnableWindow(); m_ctlEnclosureLimitSpin.EnableWindow(); m_ctlMB.EnableWindow(); m_ctlMBLbl.EnableWindow(); } else { m_ctlEnclosureLimit.EnableWindow(FALSE); m_ctlLargerLbl.EnableWindow(FALSE); m_ctlEnclosureLimitSpin.EnableWindow(FALSE); m_ctlMB.EnableWindow(FALSE); m_ctlMBLbl.EnableWindow(FALSE); } }
// 0: false, not in async mode // 1: true int AsyncProcess::NotifyError(const char *iMsg/*=0*/) { if (!m_pProcess) return false; if (!m_pProcess->GetAsyncEnabled()) return false; //if (!ioAsyncLoadMT) return 0; EnterCriticalSection(&m_csMT); m_threadsRemaining--; LeaveCriticalSection(&m_csMT); if (m_threadsRemaining>0) { LOG1("%d threads remaining. One of them reported error. Killing all..", m_threadsRemaining); } else { LOG0("A thread reported error. Killing all.."); } for (int i=0; i<m_numThreadsMT; i++) { //if (m_thread[i].IsAlive()) { m_thread[i].CloseThread(); LOG1("Closed thread with threadHandle [%d]", m_hThreadMT[i]); } } return 1; }
BOOL CRewriteRuleDlg::OnInitDialog() { LOG0(3, "CRewriteRuleDlg::OnInitDialog()"); CCeDialog::OnInitDialog(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
CRewriteRuleDlg::CRewriteRuleDlg(CWnd* pParent /*=NULL*/) : CCeDialog(CRewriteRuleDlg::IDD) { LOG0(5, "CRewriteRuleDlg::CRewriteRuleDlg()"); //{{AFX_DATA_INIT(CRewriteRuleDlg) //}}AFX_DATA_INIT SetMenu(IDR_DONE); }
bool ImageEdgeDetectionBase<T, U>::Execute() { if (!m_iDataObject) { LOG0("ImageEdgeDetectionBase: Error: no input"); return false; } // also check base image types here // get first image PGCore::Image<T> *inImage = (static_cast<PGCore::Image < T > *>(m_iDataObject)); if (!inImage) { LOG0("ImageEdgeDetectionBase: Error: failure to fetch input image"); return false; } long iRows=0, iColumns=0; inImage->GetDimensions(iRows, iColumns); if (iRows*iColumns <=0) { LOG0("ImageEdgeDetectionBase: Error: invalid image size"); return false; } const T* inBuf = inImage->GetBuffer(); if (!inBuf) { LOG0("ImageEdgeDetectionBase: Error: invalid image"); return false; } if (m_oImageObject == NULL) m_oImageObject = new PGCore::Image<U>(iRows, iColumns); U* outBuf = m_oImageObject->GetBuffer(); if (!outBuf) { LOG0("ImageEdgeDetectionBase: Error: invalid out image"); return false; } bool rv = detectEdges(m_sigma, m_loTh, m_hiTh, inImage, m_oImageObject); m_oDataObject = (static_cast<PGCore::BaseDataObject *>(m_oImageObject)); return rv; }
CString MakeOfflineUrl(const CString &strFileName) { LOG0(5, "MakeOfflineUrl()"); CString strOfflineUrl; strOfflineUrl.Format(_T("file://localhost%s"), strFileName); strOfflineUrl.Replace('\\', '/'); return strOfflineUrl; }
void tearDown(void) { if (FileDesc >= 0) { LOG0("Shutting down socket..."); KineticSocket_Close(FileDesc); FileDesc = 0; } KineticLogger_Close(); }
CMLauncherAppUi::~CMLauncherAppUi() { LOG(ELogGeneral,1,"CMLauncherAppUi::~CMLauncherAppUi++"); if(iIdle) { LOG0("Canceling iIdle"); iIdle->Cancel(); LOG0("Deleting iIdle"); delete iIdle; }; LOG0("iIdle is deleted. Deleting iDlg*"); delete iDlgMsg; delete iDlgNote; delete iDlgNoteString; LOG0("Deleting iDocHandler (should be NULL already)"); delete iDocHandler; LOG(ELogGeneral,-1,"CMLauncherAppUi::~CMLauncherAppUi--"); };
Image<T> &Image<T>::operator-=(const Image<T> &iImageObject) { long iRows, iColumns; iImageObject.GetDimensions(iRows, iColumns); if (iRows!=m_rows || iColumns!=m_columns) { return *this; } PGCore::PixelBase<T> tPixel; T rangeMin = tPixel.GetMaxValue(), rangeMax = tPixel.GetMinValue(); T irangeMin = tPixel.GetMaxValue(), irangeMax = tPixel.GetMinValue(); GetDataRange(&rangeMin, &rangeMax); if (!iImageObject.GetDataRange(&irangeMin, &irangeMax)) { //iImageObject.Update(); //if (!iImageObject.GetDataRange(&irangeMin, &irangeMax)) { assert(0 && "Failed to compute range"); LOG0("WARNING: Failed to compute range"); return *this; } } rangeMin = Functional<T>::Min(rangeMin, irangeMin);//rangeMin<irangeMin ? rangeMin : irangeMin; rangeMax = Functional<T>::Max(rangeMax, irangeMax);//rangeMax>irangeMax ? rangeMax : irangeMax; T rangeTotal = (T)(rangeMax - rangeMin); if (rangeTotal<=T(0)) return *this; long double rangeOrg = (double)(255.0f);//tPixel.GetMaxValue() - tPixel.GetMinValue()); T* iBuffer = (T*)iImageObject.GetBuffer(); if (!iBuffer) return *this; long iSize = 0; while (iSize< m_rows*m_columns) { T signedDiffValue = *(m_buffer+iSize) - *(iBuffer+iSize); //signedDiffValue += (double)rangeTotal; //signedDiffValue = signedDiffValue/(2.0f*rangeTotal); //signedDiffValue *= rangeOrg; //T diffValue = (T)Functional<T>::Abs(signedDiffValue); if (signedDiffValue<T(0)) signedDiffValue = -signedDiffValue; *(m_buffer+iSize) = signedDiffValue; iSize++; } //Update(); m_rangeUpToDate = false; return *this; }
KineticStatus KineticClient_Disconnect(KineticSessionHandle* const handle) { if (*handle == KINETIC_HANDLE_INVALID) { LOG0("Invalid KineticSessionHandle specified!"); return KINETIC_STATUS_SESSION_INVALID; } KineticConnection* connection = KineticConnection_FromHandle(*handle); if (connection == NULL) { LOG0("Failed getting valid connection from handle!"); return KINETIC_STATUS_CONNECTION_ERROR; } // Disconnect KineticStatus status = KineticConnection_Disconnect(connection); if (status != KINETIC_STATUS_SUCCESS) {LOG0("Disconnection failed!");} KineticConnection_FreeConnection(handle); *handle = KINETIC_HANDLE_INVALID; return status; }
/* -------------------------------------------------------------------------- */ void cutils_test_appsupport_path_Create() { LOG0("---- cutils_test_appsupport_path_Create --------------------------"); CFStringRef appSuppLocal = appsupport_path_Create(kLocalDomain); CFShow(appSuppLocal); //LOG_CF("app support folder (local)", appSuppLocal); assert(CFStringCompare(appSuppLocal, CFSTR("/Library/Application Support"), 0) == 0); }
BOOL CPropCachingPg::OnInitDialog() { LOG0(3, "CPropCachingPg::OnInitDialog()"); CPropertyPage::OnInitDialog(); m_ctlEnclosureLimitSpin.SendMessage(CCM_SETVERSION, COMCTL32_VERSION); m_ctlEnclosureLimitSpin.SetRange(0, 30000); UpdateControls(); return TRUE; }
void CGameApp::Run(int argc,char *argv[]) { LOG0("TK Game Started\n------------------\n"); int extra = 0; for(int a=1; a<argc; a++) { int b=0; char *tmp=strdup(argv[a]); strupr(tmp); if((tmp[0]=='-')||(tmp[0]=='/')) switch(tmp[1]) { case '1': extra |= SDL_HWACCEL; break; case '2': extra |= SDL_HWSURFACE; break; case 'W':iOptions->Data().iFullScreen=0; break; case 'L':b=atoi(argv[++a]); if(b>0) iDebugStartLevel=b - 1; break; default: error("Unknown commandline parameter!?!\n"); break; } free(tmp); } iGGI->SetExtraFlags( extra ); iGGI->SetMenuMode(); iEventHandler->ResetStack(); LOG0("Starting game loop\n"); Loop(); }
void CMLauncherAppUi::StopwatchDoneL() { LOG(ELogGeneral,1,"StopwatchDone: start"); iActiveViews&=~EStopwatchViewActive; if(iCurrentView==iStopwatchView) { //we need to switch to a diferent vierw, e.g. list view LOG0("Activating list view"); SwitchViewL(iListView); LOG0("List view activated"); }/* else { //no need to switch view, but we must take care of the navi menu (may need replacing with exit) ChangeExitWithNaviL(-1); };*/ //do cleaning here LOG(ELogGeneral,-1,"StopwatchDone: end"); };
void CMLauncherAppUi::CloseMusicPlayerViewL() { LOG(ELogGeneral,1,"CloseMusicPlayerViewL: start"); iActiveViews&=~EMusicPlayerViewActive; if(iMusicPlayerView) iMusicPlayerView->ClearPlaylist(); if(iCurrentView==iMusicPlayerView) { //we need to switch to a different view, e.g. list view LOG0("Activating list view"); SwitchViewL(iListView); LOG0("List view activated"); }/* else { //no need to switch view, but we must take care of the navi menu (may need replacing with exit) ChangeExitWithNaviL(-1); };*/ LOG(ELogGeneral,-1,"CloseMusicPlayerViewL: end"); };
void CMusicPlayerTelObs::RunL() { LOG0("CMusicPlayerTelObs::RunL line status=%d",iLineStatus.iStatus); if(iStatus==KErrNone) { if(iLineStatus.iStatus == CTelephony::EStatusIdle) { iMusicPlayerView.ResumePlayback(); LOG0("CMusicPlayerTelObs::RunL: playback resumed (line status: idle)"); } else if(iMusicPlayerView.iTrack) { //we have an ongoing call AND we are in playing state iMusicPlayerView.iTrack->iFlags|=CTrack::EKilledByTelephony; LOG0("CMusicPlayerTelObs::RunL: (line status changed: %d)",iLineStatus.iStatus); } } /* Request the next notification */ iTelephony->NotifyChange( iStatus,CTelephony::EVoiceLineStatusChange,iLineStatusPckg ); SetActive(); }