void SkXMLWriter::addAttributeLen(const char name[], const char value[], size_t length) { SkString valueStr; if (fDoEscapeMarkup) { size_t extra = escape_markup(nullptr, value, length); if (extra) { valueStr.resize(length + extra); (void)escape_markup(valueStr.writable_str(), value, length); value = valueStr.c_str(); length += extra; } } this->onAddAttributeLen(name, value, length); }
/* Mark up a top/sub pair for a dialog box. */ static void box_vmarkup( char *out, const char *top, const char *sub, va_list ap ) { char buf1[MAX_DIALOG_TEXT]; char buf2[MAX_DIALOG_TEXT]; char buf3[MAX_DIALOG_TEXT]; escape_markup( top, buf1, MAX_DIALOG_TEXT ); (void) im_vsnprintf( buf2, MAX_DIALOG_TEXT, sub, ap ); escape_markup( buf2, buf3, MAX_DIALOG_TEXT ); (void) im_snprintf( out, MAX_DIALOG_TEXT, "<b><big>%s</big></b>", buf1 ); if( strcmp( buf3, "" ) != 0 ) { int len = strlen( out ); (void) im_snprintf( out + len, MAX_DIALOG_TEXT - len, "\n\n%s", buf3 ); } }
/* Make the insides of an about box. */ static void about_build( iDialog *idlg, GtkWidget *work ) { /* Translators: translate this to a credit for you, and it'll appear in * the About box. */ char *translator_credits = _( "translator_credits" ); GtkWidget *hb; GtkWidget *lab; char txt[MAX_DIALOG_TEXT]; char txt2[MAX_DIALOG_TEXT]; VipsBuf buf = VIPS_BUF_STATIC( txt ); GtkWidget *image; im_snprintf( txt2, MAX_DIALOG_TEXT, _( "About %s." ), PACKAGE ); vips_buf_appendf( &buf, "<b><big>%s</big></b>\n\n", txt2 ); im_snprintf( txt2, MAX_DIALOG_TEXT, _( "%s is an image processing package." ), PACKAGE ); vips_buf_appendf( &buf, "%s\n\n", txt2 ); im_snprintf( txt2, MAX_DIALOG_TEXT, _( "%s comes with ABSOLUTELY NO WARRANTY. This is " "free software and you are welcome to redistribute " "it under certain conditions, see http://www.gnu.org." ), PACKAGE ); vips_buf_appendf( &buf, "%s\n\n", txt2 ); im_snprintf( txt2, MAX_DIALOG_TEXT, _( NIP_COPYRIGHT ), PACKAGE ); vips_buf_appendf( &buf, "%s\n\n", txt2 ); { char buf1[FILENAME_MAX]; char buf2[FILENAME_MAX]; im_snprintf( buf1, FILENAME_MAX, "%s" G_DIR_SEPARATOR_S "start", get_savedir() ); expand_variables( buf1, buf2 ); nativeize_path( buf2 ); escape_markup( buf2, buf1, FILENAME_MAX ); vips_buf_appendf( &buf, "<b>%s:</b> %s\n", _( "Personal start folder" ), buf1 ); } vips_buf_appendf( &buf, "<b>%s:</b> %s\n", _( "Homepage" ), VIPS_HOMEPAGE ); escape_markup( im_version_string(), txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>%s:</b> %s\n", _( "Linked to VIPS" ), txt2 ); escape_markup( IM_VERSION_STRING, txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>%s:</b> %s\n", _( "Built against VIPS" ), txt2 ); escape_markup( PACKAGE, txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>$PACKAGE:</b> %s\n", txt2 ); escape_markup( VERSION, txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>$VERSION:</b> %s\n", txt2 ); escape_markup( NN( g_getenv( "VIPSHOME" ) ), txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>$VIPSHOME:</b> %s\n", txt2 ); escape_markup( NN( g_getenv( "HOME" ) ), txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>$HOME:</b> %s\n", txt2 ); escape_markup( NN( g_getenv( "SAVEDIR" ) ), txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>$SAVEDIR:</b> %s\n", txt2 ); escape_markup( PATH_TMP, txt2, MAX_DIALOG_TEXT ); vips_buf_appendf( &buf, "<b>%s:</b> %s\n", _( "Temp files in" ), txt2 ); if( strcmp( translator_credits, "translator_credits" ) != 0 ) { vips_buf_appendf( &buf, "\n" ); vips_buf_appends( &buf, translator_credits ); } vips_buf_appendf( &buf, "\n" ); mainw_find_disc( &buf ); /* Expands to (eg.) "14GB free in /pics/tmp" */ vips_buf_appendf( &buf, _( " in \"%s\"" ), PATH_TMP ); vips_buf_appends( &buf, "\n" ); vips_buf_appendf( &buf, _( "%d cells in heap, %d cells free, %d cells maximum" ), reduce_context->heap->ncells, reduce_context->heap->nfree, reduce_context->heap->max_fn( reduce_context->heap ) ); vips_buf_appends( &buf, "\n" ); vips_buf_appendf( &buf, _( "%d vips calls cached by nip2" ), cache_history_size ); vips_buf_appends( &buf, "\n" ); vips_buf_appendf( &buf, _( "%d vips operations cached by libvips" ), vips_cache_get_size() ); vips_buf_appends( &buf, "\n" ); vips_buf_appendf( &buf, _( "using %d threads" ), im_concurrency_get() ); vips_buf_appends( &buf, "\n" ); vips_buf_appendf( &buf, _( "%d pixel buffers in vips" ), vips_tracked_get_allocs() ); vips_buf_appends( &buf, "\n" ); vips_buf_append_size( &buf, vips_tracked_get_mem() ); vips_buf_appendf( &buf, _( " of ram in pixel buffers" ) ); vips_buf_appends( &buf, "\n" ); vips_buf_append_size( &buf, vips_tracked_get_mem_highwater() ); vips_buf_appendf( &buf, _( " of ram highwater mark" ) ); vips_buf_appends( &buf, "\n" ); hb = gtk_hbox_new( FALSE, 0 ); gtk_container_border_width( GTK_CONTAINER( hb ), 10 ); gtk_container_add( GTK_CONTAINER( work ), hb ); gtk_widget_show( hb ); image = image_new_from_file( "$VIPSHOME/share/$PACKAGE/data/vips-128.png" ); gtk_box_pack_start( GTK_BOX( hb ), image, FALSE, FALSE, 2 ); gtk_widget_show( image ); lab = gtk_label_new( "" ); gtk_label_set_markup( GTK_LABEL( lab ), vips_buf_all( &buf ) ); gtk_label_set_justify( GTK_LABEL( lab ), GTK_JUSTIFY_LEFT ); gtk_label_set_selectable( GTK_LABEL( lab ), TRUE ); gtk_label_set_line_wrap( GTK_LABEL( lab ), TRUE ); gtk_box_pack_start( GTK_BOX( hb ), lab, FALSE, FALSE, 2 ); gtk_widget_show( lab ); }