Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEsYv-0006Fm-PP for pgadmin-hackers@arkaria.postgresql.org; Wed, 24 Feb 2021 11:42:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEsYu-0005Yo-LB for pgadmin-hackers@arkaria.postgresql.org; Wed, 24 Feb 2021 11:42:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEsYu-0005Yh-EA for pgadmin-hackers@lists.postgresql.org; Wed, 24 Feb 2021 11:42:36 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lEsYo-00077m-9l for pgadmin-hackers@postgresql.org; Wed, 24 Feb 2021 11:42:36 +0000 Received: by mail-lj1-x22a.google.com with SMTP id r23so2043313ljh.1 for ; Wed, 24 Feb 2021 03:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=9Sjn7X2IsdYKdfLun0dIJ4CQBAXh2tiPqj1z+pW7MyA=; b=fFkS1Gp4SkzjKZd2VIRP19B3oXOi0rmUrTQ3UNiabkYknPDWu5HW3nUM0sqxZHQSKa rpP3H6fGJ1R3tZ1wvmdgTCbGl/hQxl1YLxeEonnSeGyTOzpN4P//ovQl1CJqQMpPO3t7 R0vMXMOGMABR4c2vV23XXTlb4x5onmmTtmW8ubhSwSyP4+0PiENLXlAmYsZcvRP3BpMX XVTc8rxrBxVJaCF39KTFJX1PndKA7+LE0pIuNnxMQSDpXq/Y8cfOo28TjQ/qDAbAHEjz GsBKkWhYiisoBHk011oe510lkHj8iUtn0sKoSTMWdbSxLe4ALGmjgOlP/gGpIhQGbtJv 0XzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9Sjn7X2IsdYKdfLun0dIJ4CQBAXh2tiPqj1z+pW7MyA=; b=gV6av3G3cDm0X7wx4guu68FSISsmIiB3wx+ghaUAhPQxVLekQwmd3RhiFF7NsyCsaT eZNoJ9RCJbFZ5j8rGJGxNI+65PzHlmGCUgkd9IDUL5bizPhTvtiM5c/tYDaAXffwAf6w yBlHhAX9rfYAej9n+mzvIBpqQ9Mxm3l10x3CLsnxHulbvKN4SwcDxcTR/V7T4B5rXQQy o0m769pNdBrB/F/o+Rmvd4wC0cBKgqQtbXtZuo8piEWmseI7CFj7UC4Pd3eGJ0z+ZtZE 6twsTxdQrrKqyQbiup7wuONzPmX9F7sAAq+5PfCsKpixeLx2QNuV6/xF0VXEjtpaMFma SUhw== X-Gm-Message-State: AOAM530jz2S9uBHUW1/l4mRes/rgg5PpfStzYJi8vfjxfhYPcq558X8H zFGI7pTdvjRfsicnKCwUsVQ= X-Google-Smtp-Source: ABdhPJxUTK02odnfHraiq3EtOzi6TYhLPNqdt3FZ+Vg7bkl/6akIo+w/foJbpujBIfDNKPhQRfC1RQ== X-Received: by 2002:a05:651c:32a:: with SMTP id b10mr19671887ljp.438.1614166949157; Wed, 24 Feb 2021 03:42:29 -0800 (PST) Received: from seb ([77.232.147.173]) by smtp.gmail.com with ESMTPSA id a1sm439486lfd.31.2021.02.24.03.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 03:42:28 -0800 (PST) From: Sergey Burladyan To: Neel Patel Cc: pgadmin-hackers , Ashesh Vashi , Dave Page Subject: Re: pgagent unicode support References: <87a6shyenl.fsf@gmail.com> <874ki1yais.fsf@gmail.com> Date: Wed, 24 Feb 2021 14:42:27 +0300 In-Reply-To: <874ki1yais.fsf@gmail.com> (Sergey Burladyan's message of "Wed, 24 Feb 2021 14:23:39 +0300") Message-ID: <87zgztwv30.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sergey Burladyan writes: > Maybe it should look something like this: > + wcstombs_s(&charsConverted, mbs, mb_len + 1, wchar_str, mb_len); Ah, and we missed check for error. Something like this, maybe: +#ifdef __WIN32__ + size_t charsConverted = 0; + if (wcstombs_s(&charsConverted, mbs, mb_len + 1, wchar_str, mb_len) != 0) { + delete [] mbs; + return NULL; + } +#else -- Sergey Burladyan