void _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Delete_Request *e; INF("window delete request"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); }
bool _camera_supported_preview_resolution_callback(int preview_width, int preview_height, void *user_data) { int result; main_view *main_view_data = user_data; INF("Preview resolution %d x %d", preview_width, preview_height); if(width == preview_width && height == preview_height) { INF("Supported preview resolution and screen resolution match"); /* * Set Camera Preview Resolution * Surprisingly while setting and resolution width and height * parameters are swapped. */ result = camera_set_preview_resolution(main_view_data->camera, preview_width , preview_height); if(result != CAMERA_ERROR_NONE) { INF("camera_set_preview_resolution result FAIL"); if(result == CAMERA_ERROR_INVALID_PARAMETER) INF("camera_set_preview_resolution result CAMERA_ERROR_INVALID_PARAMETER"); } return false; } return true; }
static Evas_Object * _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { Evas_Object *otb; INF("PROD_LOG_CONFIG:%d\n", _productivity_log); otb = e_widget_toolbook_add(evas, 24, 24); e_mod_config_schedule_new_v2(otb, evas, cfdata); e_mod_config_worktools_new(otb, evas, cfdata); e_widget_toolbook_page_show(otb, 0); return otb; }
void _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Create *e; INF("window create notify"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); e->time = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); }
EAPI void ephysics_constraint_del(EPhysics_Constraint *constraint) { if (!constraint) { ERR("Can't delete constraint, it wasn't provided."); return; } // technically at this point locking and unlocking is pointless because // if another thread is accessing this constraint, after this point it // will be broken locks or not. this removes a segv in locking something // we freed in _ephysics_constraint_del() by not locking. _ephysics_constraint_del(constraint); INF("Constraint deleted."); }
/*----------------------------------------------------------------------------* * Document go to request * *----------------------------------------------------------------------------*/ static void _efl_egueb_document_go_to_completion_cb(Efl_Egueb_IO_Request *r, Enesim_Stream *s) { Efl_Egueb_Document *thiz = r->data; Egueb_Dom_Node *doc = NULL; egueb_dom_parser_parse(enesim_stream_ref(s), &doc); if (doc) { INF("Swapping documents"); efl_egueb_document_cleanup(thiz); efl_egueb_document_setup(thiz, doc); } /* swap the current doc with the new doc */ efl_egueb_io_request_free(r); }
// ------------------------------------------------------------------------------------------------ void processJsonString(const std::string& json, std::vector<Post>* posts) { rapidjson::Document document; document.Parse(json.c_str()); if (document.IsArray()) { // json could also be an Object int size = document.Size(); INF("Found an Array of size: %i", size); for (int i = 0; i < size; ++i) { const rapidjson::Value& raw_post = document[i]; Post post = processRawPost(raw_post); posts->push_back(post); } } else { ERR("Invalid json: not an array"); } }
void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Hide *e; INF("window unmap notify"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->timestamp = _ecore_win32_event_last_time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); }
/** * @brief Get the current focused window. * * @return The window that has focus. * * This function returns the window that has focus. If the calling * thread's message queue does not have an associated window with the * keyboard focus, the return value is @c NULL. * * @note Even if the returned value is @c NULL, another thread's queue * may be associated with a window that has the keyboard focus. * * @note The returned value is of type HWND. */ EAPI void * ecore_wince_window_focus_get(void) { HWND focused; INF("getting focused window"); focused = GetFocus(); if (!focused) { ERR("GetFocus() failed"); return NULL; } return focused; }
void decode_ipopts(const uint8_t *data, size_t len) { /* (last updated 2001-06-29) The Internet Protocol (IP) has provision for optional header fields identified by an option type field. Options 0 and 1 are exactly one octet which is their type field. All other options have their one octet type field, followed by a one octet length field, followed by length-2 octets of option data. The option type field is sub-divided into a one bit copied flag, a two bit class field, and a five bit option number. These taken together form an eight bit value for the option type field. IP options are commonly refered to by this value. Copy Class Number Value Name Reference ---- ----- ------ ----- ------------------------------- --------- 0 0 0 0 EOOL - End of Options List [RFC791,JBP] 0 0 1 1 NOP - No Operation [RFC791,JBP] 1 0 2 130 SEC - Security [RFC1108] 1 0 3 131 LSR - Loose Source Route [RFC791,JBP] 0 2 4 68 TS - Time Stamp [RFC791,JBP] 1 0 5 133 E-SEC - Extended Security [RFC1108] 1 0 6 134 CIPSO - Commercial Security [???] 0 0 7 7 RR - Record Route [RFC791,JBP] 1 0 8 136 SID - Stream ID [RFC791,JBP] 1 0 9 137 SSR - Strict Source Route [RFC791,JBP] 0 0 10 10 ZSU - Experimental Measurement [ZSu] 0 0 11 11 MTUP - MTU Probe [RFC1191]* 0 0 12 12 MTUR - MTU Reply [RFC1191]* 1 2 13 205 FINN - Experimental Flow Control [Finn] 1 0 14 142 VISA - Expermental Access Control [Estrin] 0 0 15 15 ENCODE - ??? [VerSteeg] 1 0 16 144 IMITD - IMI Traffic Descriptor [Lee] 1 0 17 145 EIP - Extended Internet Protocol[RFC1385] 0 2 18 82 TR - Traceroute [RFC1393] 1 0 19 147 ADDEXT - Address Extension [Ullmann IPv7] 1 0 20 148 RTRALT - Router Alert [RFC2113] 1 0 21 149 SDB - Selective Directed Broadcast[Graff] 1 0 22 150 NSAPA - NSAP Addresses [Carpenter] 1 0 23 151 DPS - Dynamic Packet State [Malis] 1 0 24 152 UMP - Upstream Multicast Pkt. [Farinacci] */ if (ISDBG(M_PKT) || GET_SNIFF()) { INF("IPOP: dumping ipoptions"); hexdump(data, len); } }
void LibFritzInit::run() { emit ready(false); bool locationSettingsDetected; std::string countryCode = KSettings::countryCode().toStdString(); std::string areaCode = KSettings::areaCode().toStdString(); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->isSet("log-personal-info")) { INF("Warning: Logging personal information requested!") } // start libfritz++ fritz::Config::Setup(KSettings::hostname().toStdString(), username.toStdString(), password.toStdString(), args->isSet("log-personal-info")); fritz::Config::SetupConfigDir(KStandardDirs::locateLocal("data", KGlobal::mainComponent().aboutData()->appName()+'/').toStdString()); std::vector<std::string> vFonbook; QStringList phonebookList = KSettings::phonebookList(); while (phonebookList.count()) vFonbook.push_back(phonebookList.takeFirst().toStdString()); fritz::FonbookManager::CreateFonbookManager(vFonbook, "", false); bool validPassword = fritz::Config::Init(&locationSettingsDetected, &countryCode, &areaCode); if (!validPassword) { emit invalidPassword(); return; } if (locationSettingsDetected) { KSettings::setCountryCode(QString(countryCode.c_str())); KSettings::setAreaCode(QString(areaCode.c_str())); KSettings::self()->writeConfig(); } std::vector<std::string> vMsn; QStringList msnList = KSettings::mSNFilter(); while (msnList.count()) vMsn.push_back(msnList.takeFirst().toStdString()); fritz::Config::SetupMsnFilter(vMsn); fritz::Listener::CreateListener(eventHandler); fritz::CallList::CreateCallList(); emit ready(true); }
void Checkbox::pressed() { INF ( "Widget <" << getName() << "> has been pressed." ); if(selected) { selected = false; checked->setVisibility(selected); if(callbackDeselected) callCallBack ( getName(), callbackDeselected->c_str() ); } else { selected = true; checked->setVisibility(selected); if(callbackSelected) callCallBack ( getName(), callbackSelected->c_str() ); } if(animationName) callAnimate ( this, animationName->c_str() ); }
int main(int argc, char** argv) { DBG("[Lesson 1]: Sortings: Insertion sort bug"); //printf("sizeof(int)=%d\n", sizeof(int) ); //printf("sizeof(long)=%d\n", sizeof(long) ); int array[10] = {5, 8, 1, 12, -4, -7, 3, 5, 9, 0}; print(array, 10); INF("After sorting"); sort::insertion(array, 10); print(array, 10); DBG("[Lesson 1]: Sortings: Insertion sort bug [END]"); return 0; }
static Eina_Bool _eeze_mount_lock_mtab(void) { // DBG("Locking mlock: %s", mnt_lock_get_linkfile(_eeze_mtab_lock)); if (EINA_LIKELY(access("/etc/mtab", W_OK))) { INF("Insufficient privs for mtab lock, continuing without lock"); return EINA_TRUE; } if (mnt_lock_file(_eeze_mtab_lock)) { ERR("Couldn't lock mtab!"); return EINA_FALSE; } _mtab_locked = EINA_TRUE; return EINA_TRUE; }
void _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Focus_Out *e; INF("focus out"); e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->timestamp = _ecore_win32_event_last_time; _ecore_win32_event_last_time = e->timestamp; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); }
void _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Destroy *e; INF("window destroy notify"); e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->timestamp = _ecore_win32_event_last_time; if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); }
/* * sets cpu to specific OPP */ static void setcpufreq(char *target_freq) { int fd; char freq[FREQ_MAX_LEN] = {0}; INF("setting cpu speeds: max=%s\n", target_freq); /* set max freq */ fd = open(CPU_MAX_NODE, O_WRONLY); if (fd < 0) { ERR("unable to open %s\n", CPU_MAX_NODE); return; } if (write(fd, target_freq, strlen(target_freq) + 1) == -1) { ERR("failed to write to cpufreq max node\n"); } close(fd); }
int main(int argc, char** argv) { DBG("[Lesson 4]: Algorithms 14"); std::string lorem = "Lorem"; // TODO[Quiz]: put to lower case std::string ipsum = "ipsum"; bool result = std::lexicographical_compare(lorem.begin(), lorem.end(), ipsum.begin(), ipsum.end()); if (result) { INF("%s < %s", lorem.c_str(), ipsum.c_str()); } else { WRN("%s >= %s", lorem.c_str(), ipsum.c_str()); } DBG("[Lesson 4]: Algorithms 14 END"); return 0; }
void _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) { Ecore_Win32_Event_Window_Focus_In *e; INF("focus in"); e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In)); if (!e) return; e->window = (void *)GetWindowLongPtr(msg->window, GWL_USERDATA); e->time = _ecore_win32_event_last_time; _ecore_win32_event_last_time = e->time; ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); }
/** * @brief Hide the given window. * * @param window The window to show. * * This function hides @p window. If @p window is @c NULL, or on * error, this function does nothing. */ EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window) { if (!window) return; INF("hiding window"); if (!ShowWindow(window->window, SW_HIDE)) { ERR("ShowWindow() failed"); return; } if (!SendMessage(window->window, WM_SHOWWINDOW, 0, 0)) { ERR("SendMessage() failed"); } }
void theme_init(void) { int i = 0; Widget_Data *wd = NULL; if (widget_list) return; // TODO : create only necessary widget data. do not create all wd for unused widgets. while (widgets[i].type < ETV_ID_LAST) { wd = (Widget_Data *)calloc(1, sizeof(Widget_Data)); wd->type = widgets[i].type; widget_list = eina_list_append(widget_list, wd); i++; } INF("Theme Init Done"); }
static size_t _ecore_con_url_read_cb(void *ptr, size_t size, size_t nitems, void *stream) { size_t retcode = fread(ptr, size, nitems, stream); if (ferror((FILE*)stream)) { fclose(stream); return CURL_READFUNC_ABORT; } else if ((retcode == 0) || (retcode < nitems)) { fclose((FILE*)stream); return 0; } INF("*** We read %zu bytes from file", retcode); return retcode; }
void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) { Ecore_Event_Mouse_Move *e; INF("mouse moved"); e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); if (!e) return; e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); e->event_window = e->window; e->x = GET_X_LPARAM(msg->data_param); e->y = GET_Y_LPARAM(msg->data_param); e->timestamp = msg->timestamp; ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); }
void action_stopbatterycharge(void) { char disable_all_charge[] = "0\n"; int fd; INF("disabling battery charging...\n"); fd = open(BATTERY_CHARGE_CONTROL, O_WRONLY); if (fd < 0) { ERR("unable to open %s\n", BATTERY_CHARGE_CONTROL); return; } if (write(fd, disable_all_charge, strlen(disable_all_charge) + 1) == -1) { ERR("failed to write to battery controller\n"); } close(fd); }
/** * @brief Move and resize the given window to a given position and size. * * @param window The window to move and resize. * @param x The x coordinate of the destination position. * @param y The x coordinate of the destination position. * @param width The new width. * @param height The new height. * * This function resize @p window to the new position of coordinates @p x * and @p y and the new @p width and @p height. If @p window is @c NULL, * or if it is fullscreen, or on error, this function does nothing. */ EAPI void ecore_wince_window_move_resize(Ecore_WinCE_Window *window, int x, int y, int width, int height) { RECT rect; DWORD style; DWORD exstyle; if (!window || window->fullscreen) return; INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); rect.left = 0; rect.top = 0; rect.right = width; rect.bottom = height; if (!(style = GetWindowLong(window->window, GWL_STYLE))) { ERR("GetWindowLong() failed"); return; } if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE))) { ERR("GetWindowLong() failed"); return; } if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) { ERR("AdjustWindowRectEx() failed"); return; } if (!MoveWindow(window->window, x, y, rect.right - rect.left, rect.bottom - rect.top, TRUE)) { ERR("MoveWindow() failed"); } }
Eina_Bool email_pop3_stat_read(Email *e, const unsigned char *recv, size_t size) { Email_Stat_Cb cb; int num; size_t len; cb = eina_list_data_get(e->cbs); if ((!email_op_ok((const unsigned char *)recv, size)) || (sscanf((char*)recv, "+OK %u %zu", &num, &len) != 2)) { ERR("Error with STAT"); if (cb) cb(e, 0, 0); return EINA_TRUE; } INF("STAT returned %u messages (%zu octets)", num, len); if (cb) cb(e, num, len); return EINA_TRUE; }
static void _wkb_ibus_query_address(void) { unsigned int flags = ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_READ_LINE_BUFFERED; Ecore_Exe *ibus_exe = NULL; if (wkb_ibus->address_pending) return; INF("Querying IBus address with '%s' command", IBUS_ADDRESS_CMD); if (!(ibus_exe = ecore_exe_pipe_run(IBUS_ADDRESS_CMD, flags, NULL))) { ERR("Error spawning '%s' command", IBUS_ADDRESS_CMD); return; } wkb_ibus->address_pending = EINA_TRUE; }
int main(int argc, char** argv) { DBG("[Lesson 3]: Class 6.3"); int array_one[10] = {5, 7, -3, 4, 15, 2, 0, -8, 9, 1}; int array_two[5] = {5, -1, 4, 2, 11}; Vector first(10, array_one); std::cout << "First: " << first << std::endl; Vector second(5, array_two); std::cout << "Second: " << second << std::endl; INF("After assignment"); second = first; // assignment std::cout << "Second: " << second << std::endl; DBG("[Lesson 3]: Class 6.3 [END]"); return 0; }
static void event_send(const char *device, Eeze_Scanner_Event_Type type, Eina_Bool volume) { Eeze_Scanner_Event ev; const Eina_List *l; Ecore_Con_Client *cl; ev.device = device; ev.type = type; ev.volume = volume; EINA_LIST_FOREACH(ecore_con_server_clients_get(svr), l, cl) { Eet_Connection *ec; ec = eina_hash_find(clients, cl); if (!ec) continue; INF("Serializing event..."); eet_connection_send(ec, es_edd, &ev, NULL); }
EAPI Eina_List* efreet_trash_ls(void) { char *infofile; char buf[PATH_MAX]; Eina_List *files, *l; // NOTE THIS FUNCTION NOW IS NOT COMPLETE AS I DON'T NEED IT // TODO read the name from the infofile instead of the filename snprintf(buf, sizeof(buf), "%s/files", efreet_trash_dir_get(NULL)); files = ecore_file_ls(buf); if (eina_log_domain_level_check(_efreet_trash_log_dom, EINA_LOG_LEVEL_INFO)) EINA_LIST_FOREACH(files, l, infofile) INF("FILE: %s\n", infofile); return files; }