Skip to content

Commit da5803e

Browse files
authored
Ensure g_warning messages use consistent i18n policy (#4369)
Where the policy in this case, for warnings, is none
1 parent 917d6f0 commit da5803e

23 files changed

+53
-197
lines changed

libvips/colour/icc_transform.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ vips_icc_load_profile_blob(VipsIcc *icc, VipsBlob *blob,
616616

617617
data = vips_blob_get(blob, &size);
618618
if (!(profile = cmsOpenProfileFromMem(data, size))) {
619-
g_warning("%s", _("corrupt profile"));
619+
g_warning("corrupt profile");
620620
return NULL;
621621
}
622622

@@ -640,14 +640,14 @@ vips_icc_load_profile_blob(VipsIcc *icc, VipsBlob *blob,
640640

641641
if (!(info = vips_icc_info(cmsGetColorSpace(profile)))) {
642642
VIPS_FREEF(cmsCloseProfile, profile);
643-
g_warning("%s", _("unsupported profile"));
643+
g_warning("unsupported profile");
644644
return NULL;
645645
}
646646

647647
if (image &&
648648
!vips_image_is_profile_compatible(image, info->bands)) {
649649
VIPS_FREEF(cmsCloseProfile, profile);
650-
g_warning("%s", _("profile incompatible with image"));
650+
g_warning("profile incompatible with image");
651651
return NULL;
652652
}
653653

libvips/conversion/copy.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ vips_copy_build(VipsObject *object)
178178
return -1;
179179

180180
if (copy->swap)
181-
g_warning("%s",
182-
_("copy swap is deprecated, use byteswap instead"));
181+
g_warning("copy swap is deprecated, use byteswap instead");
183182

184183
if (vips_image_pipelinev(conversion->out,
185184
VIPS_DEMAND_STYLE_THINSTRIP, copy->in, NULL))

libvips/create/text.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ vips_text_build(VipsObject *object)
440440
}
441441
#else /*!HAVE_FONTCONFIG*/
442442
if (text->fontfile)
443-
g_warning("%s",
444-
_("ignoring fontfile (no fontconfig support)"));
443+
g_warning("ignoring fontfile (no fontconfig support)");
445444
#endif /*HAVE_FONTCONFIG*/
446445

447446
/* If our caller set height and not dpi, we adjust dpi until

libvips/foreign/cgifsave.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ vips_foreign_save_cgif_write_frame(VipsForeignSaveCgif *cgif)
683683
#ifdef HAVE_CGIF_FRAME_ATTR_INTERLACED
684684
frame_config.attrFlags |= CGIF_FRAME_ATTR_INTERLACED;
685685
#else /*!HAVE_CGIF_FRAME_ATTR_INTERLACED*/
686-
g_warning("%s: cgif >= v0.3.0 required for interlaced GIF write",
687-
class->nickname);
686+
g_warning("cgif >= v0.3.0 required for interlaced GIF write");
688687
#endif /*HAVE_CGIF_FRAME_ATTR_INTERLACED*/
689688
}
690689

libvips/foreign/exif.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ vips_image_resolution_from_exif(VipsImage *image, ExifData *ed)
491491
break;
492492

493493
default:
494-
g_warning("%s", _("unknown EXIF resolution unit"));
494+
g_warning("unknown EXIF resolution unit");
495495
return -1;
496496
}
497497

@@ -1066,7 +1066,7 @@ vips_exif_resolution_from_image(ExifData *ed, VipsImage *image)
10661066
break;
10671067

10681068
default:
1069-
g_warning("%s", _("unknown EXIF resolution unit"));
1069+
g_warning("unknown EXIF resolution unit");
10701070
return 0;
10711071
}
10721072

libvips/foreign/foreign.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -1093,9 +1093,8 @@ vips_foreign_load_build(VipsObject *object)
10931093

10941094
if ((flags & VIPS_FOREIGN_PARTIAL) &&
10951095
(flags & VIPS_FOREIGN_SEQUENTIAL)) {
1096-
g_warning("%s",
1097-
_("VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL "
1098-
"both set -- using SEQUENTIAL"));
1096+
g_warning("VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL "
1097+
"both set -- using SEQUENTIAL");
10991098
flags ^= VIPS_FOREIGN_PARTIAL;
11001099
}
11011100

@@ -1121,9 +1120,8 @@ vips_foreign_load_build(VipsObject *object)
11211120
return -1;
11221121

11231122
if (load->sequential)
1124-
g_warning("%s",
1125-
_("ignoring deprecated \"sequential\" mode -- "
1126-
"please use \"access\" instead"));
1123+
g_warning("ignoring deprecated \"sequential\" mode -- "
1124+
"please use \"access\" instead");
11271125

11281126
g_object_set(object, "out", vips_image_new(), NULL);
11291127

libvips/foreign/jpeg2vips.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ read_jpeg_header(ReadJpeg *jpeg, VipsImage *out)
654654
break;
655655

656656
default:
657-
g_warning("%s", _("unknown JFIF resolution unit"));
657+
g_warning("unknown JFIF resolution unit");
658658
break;
659659
}
660660

libvips/foreign/jxlload.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,15 @@ vips_foreign_load_jxl_fix_exif(VipsForeignLoadJxl *jxl)
643643
return 0;
644644

645645
if (jxl->exif_size < 4) {
646-
g_warning("%s: invalid data in EXIF box", class->nickname);
646+
g_warning("invalid data in EXIF box");
647647
return -1;
648648
}
649649

650650
/* Offset is stored in big-endian
651651
*/
652652
size_t offset = GUINT32_FROM_BE(*((guint32 *) jxl->exif_data));
653653
if (offset > jxl->exif_size - 4) {
654-
g_warning("%s: invalid data in EXIF box", class->nickname);
654+
g_warning("invalid data in EXIF box");
655655
return -1;
656656
}
657657

libvips/foreign/magick.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,8 @@ magick_optimize_image_layers(Image **images, ExceptionInfo *exception)
654654

655655
return MagickTrue;
656656
#else /*!HAVE_OPTIMIZEPLUSIMAGELAYERS*/
657-
g_warning("%s", _("layer optimization is not supported by "
658-
"your version of libMagick"));
657+
g_warning("layer optimization is not supported by "
658+
"your version of libMagick");
659659

660660
return MagickTrue;
661661
#endif /*HAVE_OPTIMIZEPLUSIMAGELAYERS*/
@@ -670,8 +670,8 @@ magick_optimize_image_transparency(const Image *images,
670670

671671
return exception->severity == UndefinedException;
672672
#else /*!HAVE_OPTIMIZEIMAGETRANSPARENCY*/
673-
g_warning("%s", _("transparency optimization is not supported by "
674-
"your version of libMagick"));
673+
g_warning("transparency optimization is not supported by "
674+
"your version of libMagick");
675675

676676
return MagickTrue;
677677
#endif /*HAVE_OPTIMIZEIMAGETRANSPARENCY*/

libvips/foreign/ppmsave.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ vips_foreign_save_ppm_build(VipsObject *object)
335335

336336
if (ppm->ascii &&
337337
image->BandFmt == VIPS_FORMAT_FLOAT) {
338-
g_warning("%s", _("float images must be binary -- disabling ascii"));
338+
g_warning("float images must be binary -- disabling ascii");
339339
ppm->ascii = FALSE;
340340
}
341341

@@ -344,9 +344,8 @@ vips_foreign_save_ppm_build(VipsObject *object)
344344
if (ppm->bitdepth &&
345345
(image->Bands != 1 ||
346346
image->BandFmt != VIPS_FORMAT_UCHAR)) {
347-
g_warning("%s",
348-
_("can only save 1 band uchar images as 1 bit -- "
349-
"disabling 1 bit save"));
347+
g_warning("can only save 1 band uchar images as 1 bit -- "
348+
"disabling 1 bit save");
350349
ppm->bitdepth = 0;
351350
}
352351

libvips/foreign/spngsave.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,7 @@ vips_foreign_save_spng_write(VipsForeignSaveSpng *spng, VipsImage *in)
431431
ihdr.color_type = SPNG_COLOR_TYPE_INDEXED;
432432
#else
433433
if (spng->palette)
434-
g_warning("%s",
435-
_("ignoring palette (no quantisation support)"));
434+
g_warning("ignoring palette (no quantisation support)");
436435
#endif /*HAVE_QUANTIZATION*/
437436

438437
ihdr.compression_method = 0;

libvips/foreign/tiff2vips.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,7 @@ rtiff_parse_palette(Rtiff *rtiff, VipsImage *out)
16211621
read->blue8[i] = read->blue16[i] >> 8;
16221622
}
16231623
else {
1624-
g_warning("%s", _("assuming 8-bit palette"));
1624+
g_warning("assuming 8-bit palette");
16251625

16261626
for (i = 0; i < len; i++) {
16271627
read->red8[i] = read->red16[i] & 0xff;
@@ -3330,7 +3330,7 @@ rtiff_header_read(Rtiff *rtiff, RtiffHeader *header)
33303330
for (i = 0; i < extra_samples_count; i++)
33313331
if (extra_samples_types[i] == EXTRASAMPLE_ASSOCALPHA) {
33323332
if (header->alpha_band != -1)
3333-
g_warning("%s", _("more than one alpha -- ignoring"));
3333+
g_warning("more than one alpha -- ignoring");
33343334

33353335
header->alpha_band = header->samples_per_pixel -
33363336
extra_samples_count + i;

libvips/foreign/vips2jpeg.c

+10-14
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ write_xmp(Write *write, VipsImage *in)
314314
* error with large chunks.
315315
*/
316316
if (data_length > 60000) {
317-
g_warning("%s", _("VipsJpeg: large XMP not saved"));
317+
g_warning("large XMP not saved");
318318
return 0;
319319
}
320320

@@ -607,7 +607,7 @@ set_cinfo(struct jpeg_compress_struct *cinfo,
607607
cinfo->optimize_coding = TRUE;
608608
}
609609
else
610-
g_warning("%s", _("trellis_quant unsupported"));
610+
g_warning("trellis_quant unsupported");
611611
}
612612

613613
/* Apply overshooting to samples with extreme values e.g. 0 & 255
@@ -619,8 +619,7 @@ set_cinfo(struct jpeg_compress_struct *cinfo,
619619
jpeg_c_set_bool_param(cinfo,
620620
JBOOLEAN_OVERSHOOT_DERINGING, TRUE);
621621
else
622-
g_warning("%s",
623-
_("overshoot_deringing unsupported"));
622+
g_warning("overshoot_deringing unsupported");
624623
}
625624

626625
/* Split the spectrum of DCT coefficients into separate scans.
@@ -634,12 +633,10 @@ set_cinfo(struct jpeg_compress_struct *cinfo,
634633
jpeg_c_set_bool_param(cinfo,
635634
JBOOLEAN_OPTIMIZE_SCANS, TRUE);
636635
else
637-
g_warning("%s",
638-
_("ignoring optimize_scans"));
636+
g_warning("ignoring optimize_scans");
639637
}
640638
else
641-
g_warning("%s",
642-
_("ignoring optimize_scans for baseline"));
639+
g_warning("ignoring optimize_scans for baseline");
643640
}
644641

645642
/* Use predefined quantization table.
@@ -650,21 +647,20 @@ set_cinfo(struct jpeg_compress_struct *cinfo,
650647
jpeg_c_set_int_param(cinfo,
651648
JINT_BASE_QUANT_TBL_IDX, quant_table);
652649
else
653-
g_warning("%s",
654-
_("setting quant_table unsupported"));
650+
g_warning("setting quant_table unsupported");
655651
}
656652
#else
657653
/* Using jpeglib.h without extension parameters, warn of ignored
658654
* options.
659655
*/
660656
if (trellis_quant)
661-
g_warning("%s", _("ignoring trellis_quant"));
657+
g_warning("ignoring trellis_quant");
662658
if (overshoot_deringing)
663-
g_warning("%s", _("ignoring overshoot_deringing"));
659+
g_warning("ignoring overshoot_deringing");
664660
if (optimize_scans)
665-
g_warning("%s", _("ignoring optimize_scans"));
661+
g_warning("ignoring optimize_scans");
666662
if (quant_table > 0)
667-
g_warning("%s", _("ignoring quant_table"));
663+
g_warning("ignoring quant_table");
668664
#endif
669665

670666
/* Set compression quality. Must be called after setting params above.

libvips/foreign/vips2tiff.c

+7-11
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ wtiff_embed_iptc(Wtiff *wtiff, TIFF *tif)
601601
* long, not byte.
602602
*/
603603
if (size & 3) {
604-
g_warning("%s", _("rounding up IPTC data length"));
604+
g_warning("rounding up IPTC data length");
605605
size /= 4;
606606
size += 1;
607607
}
@@ -1480,8 +1480,7 @@ wtiff_new(VipsImage *input, VipsTarget *target,
14801480
!(wtiff->bitdepth == 1 ||
14811481
wtiff->bitdepth == 2 ||
14821482
wtiff->bitdepth == 4)) {
1483-
g_warning("%s",
1484-
_("bitdepth 1, 2 or 4 only -- disabling bitdepth"));
1483+
g_warning("bitdepth 1, 2 or 4 only -- disabling bitdepth");
14851484
wtiff->bitdepth = 0;
14861485
}
14871486

@@ -1492,16 +1491,14 @@ wtiff_new(VipsImage *input, VipsTarget *target,
14921491
!(wtiff->ready->Coding == VIPS_CODING_NONE &&
14931492
wtiff->ready->BandFmt == VIPS_FORMAT_UCHAR &&
14941493
wtiff->ready->Bands == 1)) {
1495-
g_warning("%s",
1496-
("can only set bitdepth for 1-band uchar and "
1497-
"3-band float lab -- disabling bitdepth"));
1494+
g_warning("can only set bitdepth for 1-band uchar and "
1495+
"3-band float lab -- disabling bitdepth");
14981496
wtiff->bitdepth = 0;
14991497
}
15001498

15011499
if (wtiff->bitdepth &&
15021500
wtiff->compression == COMPRESSION_JPEG) {
1503-
g_warning("%s",
1504-
_("can't have <8 bit JPEG -- disabling JPEG"));
1501+
g_warning("can't have <8 bit JPEG -- disabling JPEG");
15051502
wtiff->compression = COMPRESSION_NONE;
15061503
}
15071504

@@ -1511,9 +1508,8 @@ wtiff_new(VipsImage *input, VipsTarget *target,
15111508
(wtiff->ready->Coding != VIPS_CODING_NONE ||
15121509
vips_band_format_iscomplex(wtiff->ready->BandFmt) ||
15131510
wtiff->ready->Bands > 2)) {
1514-
g_warning("%s",
1515-
_("can only save non-complex greyscale images "
1516-
"as miniswhite -- disabling miniswhite"));
1511+
g_warning("can only save non-complex greyscale images "
1512+
"as miniswhite -- disabling miniswhite");
15171513
wtiff->miniswhite = FALSE;
15181514
}
15191515

libvips/foreign/vipspng.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1149,8 +1149,7 @@ write_vips(Write *write,
11491149
color_type = PNG_COLOR_TYPE_PALETTE;
11501150
#else
11511151
if (palette)
1152-
g_warning("%s",
1153-
_("ignoring palette (no quantisation support)"));
1152+
g_warning("ignoring palette (no quantisation support)");
11541153
#endif /*HAVE_QUANTIZATION*/
11551154

11561155
interlace_type = interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;

libvips/iofuncs/generate.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ vips_image_pipelinev(VipsImage *image, VipsDemandStyle hint, ...)
421421
;
422422
va_end(ap);
423423
if (i == MAX_IMAGES) {
424-
g_warning("%s", _("too many images"));
424+
g_warning("too many images");
425425

426426
/* Make sure we have a sentinel there.
427427
*/

libvips/iofuncs/memory.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@ vips_tracked_free(void *s)
245245
#endif /*DEBUG_VERBOSE_MEM*/
246246

247247
if (vips_tracked_allocs <= 0)
248-
g_warning("%s", _("vips_free: too many frees"));
248+
g_warning("vips_free: too many frees");
249249
if (vips_tracked_mem < size)
250-
g_warning("%s", _("vips_free: too much free"));
250+
g_warning("vips_free: too much free");
251251

252252
vips_tracked_mem -= size;
253253
vips_tracked_allocs -= 1;
@@ -282,9 +282,9 @@ vips_tracked_aligned_free(void *s)
282282
#endif /*DEBUG_VERBOSE*/
283283

284284
if (vips_tracked_allocs <= 0)
285-
g_warning("%s", _("vips_free: too many frees"));
285+
g_warning("vips_free: too many frees");
286286
if (vips_tracked_mem < size)
287-
g_warning("%s", _("vips_free: too much free"));
287+
g_warning("vips_free: too much free");
288288

289289
vips_tracked_mem -= size;
290290
vips_tracked_allocs -= 1;

libvips/mosaicing/global_balance.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ find_image_stats(VipsImage *mem,
11031103

11041104
#ifdef DEBUG
11051105
if (count == 0)
1106-
g_warning("global_balance %s", _("empty overlap!"));
1106+
g_warning("global_balance empty overlap");
11071107
#endif /*DEBUG*/
11081108

11091109
return t[4];

0 commit comments

Comments
 (0)