LCOV - differential code coverage report
Current view: top level - src/backend/utils/mb/conversion_procs/latin_and_mic - latin_and_mic.c (source / functions) Coverage Total Hit CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 100.0 % 55 55 55
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 13 13 13
Baseline: lcov-20250908-010021-baseline Line coverage date bins:
Baseline Date: 2025-09-05 08:21:35 +0100 (30,360] days: 100.0 % 1 1 1
Legend: Lines:     hit not hit (360..) days: 100.0 % 54 54 54
Function coverage date bins:
(30,360] days: 100.0 % 1 1 1
(360..) days: 100.0 % 12 12 12

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  *    LATINn and MULE_INTERNAL
                                  4                 :  *
                                  5                 :  * Portions Copyright (c) 1996-2025, 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/latin_and_mic/latin_and_mic.c
                                 10                 :  *
                                 11                 :  *-------------------------------------------------------------------------
                                 12                 :  */
                                 13                 : 
                                 14                 : #include "postgres.h"
                                 15                 : #include "fmgr.h"
                                 16                 : #include "mb/pg_wchar.h"
                                 17                 : 
  166 tgl@sss.pgh.pa.us          18 CBC           3 : PG_MODULE_MAGIC_EXT(
                                 19                 :                     .name = "latin_and_mic",
                                 20                 :                     .version = PG_VERSION
                                 21                 : );
                                 22                 : 
 8353                            23               3 : PG_FUNCTION_INFO_V1(latin1_to_mic);
                                 24               3 : PG_FUNCTION_INFO_V1(mic_to_latin1);
                                 25               3 : PG_FUNCTION_INFO_V1(latin3_to_mic);
                                 26               3 : PG_FUNCTION_INFO_V1(mic_to_latin3);
                                 27               3 : PG_FUNCTION_INFO_V1(latin4_to_mic);
                                 28               3 : PG_FUNCTION_INFO_V1(mic_to_latin4);
                                 29                 : 
                                 30                 : /* ----------
                                 31                 :  * conv_proc(
                                 32                 :  *      INTEGER,    -- source encoding id
                                 33                 :  *      INTEGER,    -- destination encoding id
                                 34                 :  *      CSTRING,    -- source string (null terminated C string)
                                 35                 :  *      CSTRING,    -- destination string (null terminated C string)
                                 36                 :  *      INTEGER,    -- source string length
                                 37                 :  *      BOOL        -- if true, don't throw an error if conversion fails
                                 38                 :  * ) returns INTEGER;
                                 39                 :  *
                                 40                 :  * Returns the number of bytes successfully converted.
                                 41                 :  * ----------
                                 42                 :  */
                                 43                 : 
                                 44                 : 
                                 45                 : Datum
 8426 ishii@postgresql.org       46               3 : latin1_to_mic(PG_FUNCTION_ARGS)
                                 47                 : {
 7289 tgl@sss.pgh.pa.us          48               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                 49               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us           50               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i       51               3 :     bool        noError = PG_GETARG_BOOL(5);
                                 52                 :     int         converted;
                                 53                 : 
 6066 tgl@sss.pgh.pa.us          54               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_LATIN1, PG_MULE_INTERNAL);
                                 55                 : 
 1621 heikki.linnakangas@i       56               3 :     converted = latin2mic(src, dest, len, LC_ISO8859_1, PG_LATIN1, noError);
                                 57                 : 
                                 58               3 :     PG_RETURN_INT32(converted);
                                 59                 : }
                                 60                 : 
                                 61                 : Datum
 8426 ishii@postgresql.org       62               3 : mic_to_latin1(PG_FUNCTION_ARGS)
                                 63                 : {
 7289 tgl@sss.pgh.pa.us          64               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                 65               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us           66               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i       67               3 :     bool        noError = PG_GETARG_BOOL(5);
                                 68                 :     int         converted;
                                 69                 : 
 6066 tgl@sss.pgh.pa.us          70               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_MULE_INTERNAL, PG_LATIN1);
                                 71                 : 
 1621 heikki.linnakangas@i       72               3 :     converted = mic2latin(src, dest, len, LC_ISO8859_1, PG_LATIN1, noError);
                                 73                 : 
                                 74               3 :     PG_RETURN_INT32(converted);
                                 75                 : }
                                 76                 : 
                                 77                 : Datum
 8426 ishii@postgresql.org       78               3 : latin3_to_mic(PG_FUNCTION_ARGS)
                                 79                 : {
 7289 tgl@sss.pgh.pa.us          80               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                 81               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us           82               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i       83               3 :     bool        noError = PG_GETARG_BOOL(5);
                                 84                 :     int         converted;
                                 85                 : 
 6066 tgl@sss.pgh.pa.us          86               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_LATIN3, PG_MULE_INTERNAL);
                                 87                 : 
 1621 heikki.linnakangas@i       88               3 :     converted = latin2mic(src, dest, len, LC_ISO8859_3, PG_LATIN3, noError);
                                 89                 : 
                                 90               3 :     PG_RETURN_INT32(converted);
                                 91                 : }
                                 92                 : 
                                 93                 : Datum
 8426 ishii@postgresql.org       94               3 : mic_to_latin3(PG_FUNCTION_ARGS)
                                 95                 : {
 7289 tgl@sss.pgh.pa.us          96               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                 97               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us           98               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i       99               3 :     bool        noError = PG_GETARG_BOOL(5);
                                100                 :     int         converted;
                                101                 : 
 6066 tgl@sss.pgh.pa.us         102               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_MULE_INTERNAL, PG_LATIN3);
                                103                 : 
 1621 heikki.linnakangas@i      104               3 :     converted = mic2latin(src, dest, len, LC_ISO8859_3, PG_LATIN3, noError);
                                105                 : 
                                106               3 :     PG_RETURN_INT32(converted);
                                107                 : }
                                108                 : 
                                109                 : Datum
 8426 ishii@postgresql.org      110               3 : latin4_to_mic(PG_FUNCTION_ARGS)
                                111                 : {
 7289 tgl@sss.pgh.pa.us         112               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                113               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us          114               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i      115               3 :     bool        noError = PG_GETARG_BOOL(5);
                                116                 :     int         converted;
                                117                 : 
 6066 tgl@sss.pgh.pa.us         118               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_LATIN4, PG_MULE_INTERNAL);
                                119                 : 
 1621 heikki.linnakangas@i      120               3 :     converted = latin2mic(src, dest, len, LC_ISO8859_4, PG_LATIN4, noError);
                                121                 : 
                                122               3 :     PG_RETURN_INT32(converted);
                                123                 : }
                                124                 : 
                                125                 : Datum
 8405 bruce@momjian.us          126               3 : mic_to_latin4(PG_FUNCTION_ARGS)
                                127                 : {
 7289 tgl@sss.pgh.pa.us         128               3 :     unsigned char *src = (unsigned char *) PG_GETARG_CSTRING(2);
                                129               3 :     unsigned char *dest = (unsigned char *) PG_GETARG_CSTRING(3);
 8405 bruce@momjian.us          130               3 :     int         len = PG_GETARG_INT32(4);
 1621 heikki.linnakangas@i      131               3 :     bool        noError = PG_GETARG_BOOL(5);
                                132                 :     int         converted;
                                133                 : 
 6066 tgl@sss.pgh.pa.us         134               3 :     CHECK_ENCODING_CONVERSION_ARGS(PG_MULE_INTERNAL, PG_LATIN4);
                                135                 : 
 1621 heikki.linnakangas@i      136               3 :     converted = mic2latin(src, dest, len, LC_ISO8859_4, PG_LATIN4, noError);
                                137                 : 
                                138               3 :     PG_RETURN_INT32(converted);
                                139                 : }
        

Generated by: LCOV version 2.4-beta