LCOV - differential code coverage report
Current view: top level - src/backend/utils/mb/conversion_procs/latin2_and_win1250 - latin2_and_win1250.c (source / functions) Coverage Total Hit CBC DCB
Current: bed3ffbf9d952be6c7d739d068cdce44c046dfb7 vs 574581b50ac9c63dd9e4abebb731a3b67e5b50f6 Lines: 100.0 % 19 19 19 36
Current Date: 2026-05-05 10:23:31 +0900 Functions: 100.0 % 5 5 5 8
Baseline: lcov-20260505-025707-baseline Line coverage date bins:
Baseline Date: 2026-05-05 10:27:06 +0900 (360..) days: 100.0 % 19 19 19
Legend: Lines:     hit not hit Function coverage date bins:
(360..) days: 100.0 % 5 5 5

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  *    LATIN2 and WIN1250
                                  4                 :  *
                                  5                 :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                  6                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  7                 :  *
                                  8                 :  * IDENTIFICATION
                                  9                 :  *    src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
                                 10                 :  *
                                 11                 :  *-------------------------------------------------------------------------
                                 12                 :  */
                                 13                 : 
                                 14                 : #include "postgres.h"
                                 15                 : #include "fmgr.h"
                                 16                 : #include "mb/pg_wchar.h"
                                 17                 : 
  405 tgl@sss.pgh.pa.us          18 CBC           4 : PG_MODULE_MAGIC_EXT(
                                 19                 :                     .name = "latin2_and_win1250",
                                 20                 :                     .version = PG_VERSION
                                 21                 : );
                                 22                 : 
 8592                            23               4 : PG_FUNCTION_INFO_V1(latin2_to_win1250);
                                 24               4 : PG_FUNCTION_INFO_V1(win1250_to_latin2);
                                 25                 : 
                                 26                 : /* ----------
                                 27                 :  * conv_proc(
                                 28                 :  *      INTEGER,    -- source encoding id
                                 29                 :  *      INTEGER,    -- destination encoding id
                                 30                 :  *      CSTRING,    -- source string (null terminated C string)
                                 31                 :  *      CSTRING,    -- destination string (null terminated C string)
                                 32                 :  *      INTEGER,    -- source string length
                                 33                 :  *      BOOL        -- if true, don't throw an error if conversion fails
                                 34                 :  * ) returns INTEGER;
                                 35                 :  *
                                 36                 :  * Returns the number of bytes successfully converted.
                                 37                 :  * ----------
                                 38                 :  */
                                 39                 : 
                                 40                 : /* WIN1250 to ISO-8859-2 */
                                 41                 : static const unsigned char win1250_2_iso88592[] = {
                                 42                 :     0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
                                 43                 :     0x88, 0x89, 0xA9, 0x8B, 0xA6, 0xAB, 0xAE, 0xAC,
                                 44                 :     0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
                                 45                 :     0x98, 0x99, 0xB9, 0x9B, 0xB6, 0xBB, 0xBE, 0xBC,
                                 46                 :     0xA0, 0xB7, 0xA2, 0xA3, 0xA4, 0xA1, 0x00, 0xA7,
                                 47                 :     0xA8, 0x00, 0xAA, 0x00, 0x00, 0xAD, 0x00, 0xAF,
                                 48                 :     0xB0, 0x00, 0xB2, 0xB3, 0xB4, 0x00, 0x00, 0x00,
                                 49                 :     0xB8, 0xB1, 0xBA, 0x00, 0xA5, 0xBD, 0xB5, 0xBF,
                                 50                 :     0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
                                 51                 :     0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
                                 52                 :     0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
                                 53                 :     0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
                                 54                 :     0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
                                 55                 :     0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
                                 56                 :     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
                                 57                 :     0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
                                 58                 : };
                                 59                 : 
                                 60                 : /* ISO-8859-2 to WIN1250 */
                                 61                 : static const unsigned char iso88592_2_win1250[] = {
                                 62                 :     0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
                                 63                 :     0x88, 0x89, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00,
                                 64                 :     0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
                                 65                 :     0x98, 0x99, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00,
                                 66                 :     0xA0, 0xA5, 0xA2, 0xA3, 0xA4, 0xBC, 0x8C, 0xA7,
                                 67                 :     0xA8, 0x8A, 0xAA, 0x8D, 0x8F, 0xAD, 0x8E, 0xAF,
                                 68                 :     0xB0, 0xB9, 0xB2, 0xB3, 0xB4, 0xBE, 0x9C, 0xA1,
                                 69                 :     0xB8, 0x9A, 0xBA, 0x9D, 0x9F, 0xBD, 0x9E, 0xBF,
                                 70                 :     0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
                                 71                 :     0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
                                 72                 :     0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
                                 73                 :     0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
                                 74                 :     0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
                                 75                 :     0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
                                 76                 :     0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
                                 77                 :     0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
                                 78                 : };
                                 79                 : 
                                 80                 : 
                                 81                 : Datum
 8665 ishii@postgresql.org       82               4 : latin2_to_win1250(PG_FUNCTION_ARGS)
                                 83                 : {
 7528 tgl@sss.pgh.pa.us          84               4 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                 85               4 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8644 bruce@momjian.us           86               4 :     int         len = PG_GETARG_INT32(4);
 1860 heikki.linnakangas@i       87               4 :     bool        noError = PG_GETARG_BOOL(5);
                                 88                 :     int         converted;
                                 89                 : 
 6305 tgl@sss.pgh.pa.us          90               4 :     CHECK_ENCODING_CONVERSION_ARGS(PG_LATIN2, PG_WIN1250);
                                 91                 : 
 1860 heikki.linnakangas@i       92               4 :     converted = local2local(src, dest, len, PG_LATIN2, PG_WIN1250,
                                 93                 :                             iso88592_2_win1250, noError);
                                 94                 : 
                                 95               4 :     PG_RETURN_INT32(converted);
                                 96                 : }
                                 97                 : 
                                 98                 : Datum
 8665 ishii@postgresql.org       99               4 : win1250_to_latin2(PG_FUNCTION_ARGS)
                                100                 : {
 7528 tgl@sss.pgh.pa.us         101               4 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                102               4 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8644 bruce@momjian.us          103               4 :     int         len = PG_GETARG_INT32(4);
 1860 heikki.linnakangas@i      104               4 :     bool        noError = PG_GETARG_BOOL(5);
                                105                 :     int         converted;
                                106                 : 
 6305 tgl@sss.pgh.pa.us         107               4 :     CHECK_ENCODING_CONVERSION_ARGS(PG_WIN1250, PG_LATIN2);
                                108                 : 
 1860 heikki.linnakangas@i      109               4 :     converted = local2local(src, dest, len, PG_WIN1250, PG_LATIN2,
                                110                 :                             win1250_2_iso88592, noError);
                                111                 : 
                                112               4 :     PG_RETURN_INT32(converted);
                                113                 : }
        

Generated by: LCOV version 2.5.0-beta