void ProfileManager::deinit() { for (auto &profile : s_profiles) { save_profile(profile.second.get()); } }
void save_player(D_MOBILE *dMob) { if (!dMob) return; save_pfile(dMob); /* saves the actual player data */ save_profile(dMob); /* saves the players profile */ }
static void context_destroy(struct osc_plugin *plugin, const char *ini_fn) { save_profile(NULL, ini_fn); if (dac_tx_manager) { dac_data_manager_free(dac_tx_manager); dac_tx_manager = NULL; } osc_destroy_context(ctx); }
static void context_destroy(const char *ini_fn) { save_profile(ini_fn); if (dac_tx_manager) { dac_data_manager_free(dac_tx_manager); dac_tx_manager = NULL; } osc_destroy_context(ctx); }
static void context_destroy(const char *ini_fn) { g_source_remove_by_user_data(ctx); if (ini_fn) save_profile(ini_fn); if (dac_tx_manager) { dac_data_manager_free(dac_tx_manager); dac_tx_manager = NULL; } iio_context_destroy(ctx); }
void train_button_toggled(void) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(train_button))) { cell_widget_train(); gtk_widget_hide(clear_button); gtk_widget_hide(keys_button); gtk_widget_hide(insert_button); gtk_widget_hide(buffer_button); gtk_widget_show(blocks_combo); gtk_widget_show(train_label_frame); } else { cell_widget_clear(); gtk_widget_hide(blocks_combo); gtk_widget_hide(train_label_frame); gtk_widget_show(clear_button); gtk_widget_show(keys_button); gtk_widget_show(insert_button); gtk_widget_show(buffer_button); /* Take the opportunity to save training data. TODO: Only save if there is new training data. */ save_profile(); } }
static void context_destroy(const char *ini_fn) { save_profile(ini_fn); iio_context_destroy(ctx); }
static void close_dialog(void) { save_profile(); gtk_widget_hide(options_dialog); }
static void test_color_contexts(void) { HRESULT hr; IWICBitmapDecoder *decoder; IWICBitmapFrameDecode *frame; IWICColorContext *context; WICColorContextType type; UINT count, colorspace, size; WCHAR *tmpfile; BYTE *buffer; BOOL ret; decoder = create_decoder(png_no_color_profile, sizeof(png_no_color_profile)); ok(decoder != 0, "Failed to load PNG image data\n"); if (!decoder) return; /* global color context */ hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, NULL); ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr); count = 0xdeadbeef; hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, &count); ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr); ok(count == 0xdeadbeef, "unexpected count %u\n", count); /* frame color context */ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ok(hr == S_OK, "GetFrame error %#x\n", hr); hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); count = 0xdeadbeef; hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, &count); ok(hr == S_OK, "GetColorContexts error %#x\n", hr); ok(!count, "unexpected count %u\n", count); IWICBitmapFrameDecode_Release(frame); IWICBitmapDecoder_Release(decoder); decoder = create_decoder(png_color_profile, sizeof(png_color_profile)); ok(decoder != 0, "Failed to load PNG image data\n"); if (!decoder) return; /* global color context */ count = 0xdeadbeef; hr = IWICBitmapDecoder_GetColorContexts(decoder, 0, NULL, &count); ok(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION, "GetColorContexts error %#x\n", hr); ok(count == 0xdeadbeef, "unexpected count %u\n", count); /* frame color context */ hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ok(hr == S_OK, "GetFrame error %#x\n", hr); count = 0xdeadbeef; hr = IWICBitmapFrameDecode_GetColorContexts(frame, 0, NULL, &count); ok(hr == S_OK, "GetColorContexts error %#x\n", hr); ok(count == 1, "unexpected count %u\n", count); hr = IWICImagingFactory_CreateColorContext(factory, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); hr = IWICImagingFactory_CreateColorContext(factory, &context); ok(hr == S_OK, "CreateColorContext error %#x\n", hr); hr = IWICColorContext_GetType(context, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); type = 0xdeadbeef; hr = IWICColorContext_GetType(context, &type); ok(hr == S_OK, "GetType error %#x\n", hr); ok(type == WICColorContextUninitialized, "unexpected type %u\n", type); hr = IWICColorContext_GetProfileBytes(context, 0, NULL, NULL); ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr); size = 0; hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size); ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr); ok(!size, "unexpected size %u\n", size); hr = IWICColorContext_GetExifColorSpace(context, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); colorspace = 0xdeadbeef; hr = IWICColorContext_GetExifColorSpace(context, &colorspace); ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr); ok(colorspace == 0xffffffff, "unexpected color space %u\n", colorspace); hr = IWICColorContext_InitializeFromExifColorSpace(context, 0); ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr); hr = IWICColorContext_InitializeFromExifColorSpace(context, 1); ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr); hr = IWICColorContext_InitializeFromExifColorSpace(context, 2); ok(hr == S_OK, "InitializeFromExifColorSpace error %#x\n", hr); colorspace = 0xdeadbeef; hr = IWICColorContext_GetExifColorSpace(context, &colorspace); ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr); ok(colorspace == 2, "unexpected color space %u\n", colorspace); size = 0; hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size); ok(hr == WINCODEC_ERR_NOTINITIALIZED, "GetProfileBytes error %#x\n", hr); ok(!size, "unexpected size %u\n", size); type = 0xdeadbeef; hr = IWICColorContext_GetType(context, &type); ok(hr == S_OK, "GetType error %#x\n", hr); ok(type == WICColorContextExifColorSpace, "unexpected type %u\n", type); hr = IWICBitmapFrameDecode_GetColorContexts(frame, count, &context, &count); ok(hr == WINCODEC_ERR_WRONGSTATE, "GetColorContexts error %#x\n", hr); IWICColorContext_Release(context); IWICBitmapFrameDecode_Release(frame); hr = IWICBitmapDecoder_GetFrame(decoder, 0, &frame); ok(hr == S_OK, "GetFrame error %#x\n", hr); hr = IWICImagingFactory_CreateColorContext(factory, &context); ok(hr == S_OK, "CreateColorContext error %#x\n", hr); count = 1; hr = IWICBitmapFrameDecode_GetColorContexts(frame, count, &context, &count); ok(hr == S_OK, "GetColorContexts error %#x\n", hr); hr = IWICColorContext_GetProfileBytes(context, 0, NULL, NULL); ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); size = 0; hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size); ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); ok(size, "unexpected size %u\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size); ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); tmpfile = save_profile( buffer, size ); HeapFree(GetProcessHeap(), 0, buffer); type = 0xdeadbeef; hr = IWICColorContext_GetType(context, &type); ok(hr == S_OK, "GetType error %#x\n", hr); ok(type == WICColorContextProfile, "unexpected type %u\n", type); colorspace = 0xdeadbeef; hr = IWICColorContext_GetExifColorSpace(context, &colorspace); ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr); ok(colorspace == 0xffffffff, "unexpected color space %u\n", colorspace); hr = IWICColorContext_InitializeFromExifColorSpace(context, 1); ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#x\n", hr); if (tmpfile) { hr = IWICColorContext_InitializeFromFilename(context, NULL); ok(hr == E_INVALIDARG, "InitializeFromFilename error %#x\n", hr); hr = IWICColorContext_InitializeFromFilename(context, tmpfile); ok(hr == S_OK, "InitializeFromFilename error %#x\n", hr); ret = DeleteFileW(tmpfile); ok(ret, "DeleteFileW failed %u\n", GetLastError()); type = 0xdeadbeef; hr = IWICColorContext_GetType(context, &type); ok(hr == S_OK, "GetType error %#x\n", hr); ok(type == WICColorContextProfile, "unexpected type %u\n", type); colorspace = 0xdeadbeef; hr = IWICColorContext_GetExifColorSpace(context, &colorspace); ok(hr == S_OK, "GetExifColorSpace error %#x\n", hr); ok(colorspace == 0xffffffff, "unexpected color space %u\n", colorspace); hr = IWICColorContext_InitializeFromExifColorSpace(context, 1); ok(hr == WINCODEC_ERR_WRONGSTATE, "InitializeFromExifColorSpace error %#x\n", hr); size = 0; hr = IWICColorContext_GetProfileBytes(context, 0, NULL, &size); ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); ok(size, "unexpected size %u\n", size); buffer = HeapAlloc(GetProcessHeap(), 0, size); hr = IWICColorContext_GetProfileBytes(context, size, buffer, &size); ok(hr == S_OK, "GetProfileBytes error %#x\n", hr); HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, tmpfile); } IWICColorContext_Release(context); IWICBitmapFrameDecode_Release(frame); IWICBitmapDecoder_Release(decoder); }