From: "cron2 (Code Review)" Date: Wed, 26 Nov 2025 11:20:29 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., heiko@...515..., openvpn-devel@lists.sourceforge.net Message-ID: <381ee1bcdad6c31b3e67591ccfb5c13498a1039e-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="+woK20dfQgU="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: iservice: rename one_glyph to glyph_size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: d12fk , plaisthos Cc: openvpn-devel --+woK20dfQgU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#2) to the change originally created by= d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1398?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: iservice: rename one_glyph to glyph_size ...................................................................... iservice: rename one_glyph to glyph_size Throughout the function variables which deal with byte counts have a _size postfix. one_glyph is the number of bytes in one character. Reading the code is easier and more consistent this way. Change-Id: I69a6ab59d995fb4a511f57c8535b5ffa4048673c Signed-off-by: Heiko Hund Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1398 Message-Id: <20251124170055.16034-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 642.html Signed-off-by: Gert Doering --- M src/openvpnserv/interactive.c 1 file changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1398/2 diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 13e303a..220c042 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2156,14 +2156,14 @@ LSTATUS err =3D ERROR_FILE_NOT_FOUND; const DWORD buf_size =3D *size; - const size_t one_glyph =3D sizeof(*domains); + const size_t glyph_size =3D sizeof(*domains); PWSTR values[] =3D { L"SearchList", L"Domain", L"DhcpDomainSearchList"= , L"DhcpDomain", NULL }; for (int i =3D 0; values[i]; i++) { *size =3D buf_size; err =3D RegGetValueW(itf, NULL, values[i], RRF_RT_REG_SZ, NULL, (P= BYTE)domains, size); - if (!err && *size > one_glyph && domains[(*size / one_glyph) - 1] = =3D=3D '\0' && wcschr(domains, '.')) + if (!err && *size > glyph_size && domains[(*size / glyph_size) - 1= ] =3D=3D '\0' && wcschr(domains, '.')) { /* * Found domain(s), now convert them: @@ -2171,7 +2171,7 @@ * - convert comma separated list to MULTI_SZ */ PWCHAR pos =3D domains; - const DWORD buf_len =3D buf_size / one_glyph; + const DWORD buf_len =3D buf_size / glyph_size; while (TRUE) { /* Terminate the domain at the next comma */ @@ -2182,8 +2182,8 @@ } size_t domain_len =3D wcslen(pos); - size_t domain_size =3D domain_len * one_glyph; - size_t converted_size =3D (pos - domains) * one_glyph; + size_t domain_size =3D domain_len * glyph_size; + size_t converted_size =3D (pos - domains) * glyph_size; /* Ignore itf domains which match a pushed search domain */ if (ListContainsDomain(search_domains, pos, domain_len)) @@ -2192,7 +2192,7 @@ { /* Overwrite the ignored domain with remaining one= (s) */ memmove(pos, comma + 1, buf_size - converted_size); - *size -=3D domain_size + one_glyph; + *size -=3D domain_size + glyph_size; continue; } else @@ -2206,31 +2206,31 @@ /* Add space for the leading dot */ domain_len +=3D 1; - domain_size +=3D one_glyph; + domain_size +=3D glyph_size; /* Space for the terminating zeros */ - size_t extra_size =3D 2 * one_glyph; + size_t extra_size =3D 2 * glyph_size; /* Check for enough space to convert this domain */ if (converted_size + domain_size + extra_size > buf_size) { /* Domain doesn't fit, bad luck if it's the first one = */ *pos =3D '\0'; - *size =3D converted_size =3D=3D 0 ? 0 : converted_size= + one_glyph; + *size =3D converted_size =3D=3D 0 ? 0 : converted_size= + glyph_size; return ERROR_MORE_DATA; } /* Prefix domain at pos with the dot */ - memmove(pos + 1, pos, buf_size - converted_size - one_glyp= h); + memmove(pos + 1, pos, buf_size - converted_size - glyph_si= ze); domains[buf_len - 1] =3D '\0'; *pos =3D '.'; - *size +=3D one_glyph; + *size +=3D glyph_size; if (!comma) { /* Conversion is done */ *(pos + domain_len) =3D '\0'; - *size +=3D one_glyph; + *size +=3D glyph_size; return NO_ERROR; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1398?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I69a6ab59d995fb4a511f57c8535b5ffa4048673c Gerrit-Change-Number: 1398 Gerrit-PatchSet: 2 Gerrit-Owner: d12fk Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --+woK20dfQgU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #2 to the change originally created by d12fk.

<= p>View C= hange

The following approvals got outdated and were removed: Code-Review+2 by cron2

iservice: rename one_glyph to glyph=
_size

Throughout the function variables which deal with byte counts = have a
_size postfix. one_glyph is the number of bytes in one character.=
Reading the code is easier and more consistent this way.

Change-= Id: I69a6ab59d995fb4a511f57c8535b5ffa4048673c
Signed-off-by: Heiko Hund = <heiko@...2662...>
Acked-by: Gert Doering <gert@...1296...><= br>Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1398
Message-Id: &= lt;20251124170055.16034-1-gert@...1296...>
URL: https://www.mail-arch= ive.com/openvpn-devel@lists.sourceforge.net/msg34642.html
Signed-off-by:= Gert Doering <gert@...1296...>
---
M src/openvpnserv/interacti= ve.c
1 file changed, 12 insertions(+), 12 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1= 398/2
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/=
interactive.c
index 13e303a..220c042 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/= interactive.c
@@ -2156,14 +2156,14 @@

LSTATUS err =3D ERROR_FILE_NOT_FOUND;
= const DWORD buf_size =3D *size;
- const size_t one_glyph =3D sizeof(*domains);
+ const size_t glyph_size =3D si= zeof(*domains);

PWSTR values[] =3D { L"SearchList= ", L"Domain", L"DhcpDomainSearchList", L"Dhcp= Domain", NULL };

for (int i =3D= 0; values[i]; i++)
{
*size = =3D buf_size;
err =3D RegGetValueW(itf, NULL, valu= es[i], RRF_RT_REG_SZ, NULL, (PBYTE)domains, size);
- if (!err && *size > one_gly= ph && domains[(*size / one_glyph) - 1] =3D=3D '\0' &&am= p; wcschr(domains, '.'))
+ if (!err && *size > glyph_size && d= omains[(*size / glyph_size) - 1] =3D=3D '\0' && wcschr(doma= ins, '.'))
{
= /*
* Found domain(s), now convert them:

@@ -2171,7 +2171,7 @@
* - conver= t comma separated list to MULTI_SZ
*/<= br> PWCHAR pos =3D domains;
- const DWORD buf_len =3D buf_size / one_= glyph;
+ c= onst DWORD buf_len =3D buf_size / glyph_size;
= while (TRUE)
{
= /* Terminate the domain at the next comma */
@@ -2182,8 += 2182,8 @@
}

size_t domain_len =3D wcslen(pos);
- size_t domain_size =3D do= main_len * one_glyph;
-= size_t converted_size =3D (pos - domains) * one_glyph;
+ size_t d= omain_size =3D domain_len * glyph_size;
+ size_t converted_size =3D (pos - domain= s) * glyph_size;

/* Igno= re itf domains which match a pushed search domain */
= if (ListContainsDomain(search_domains, pos, domain_len))<= br>@@ -2192,7 +2192,7 @@
{
/* Overwrite the ignored domain with re= maining one(s) */
memmove(pos, com= ma + 1, buf_size - converted_size);
- *size -=3D domain_size + one_glyph;
+ = *size -=3D domain_size + glyph_size;
= continue;
}
= else
@@ -2206,31 +2206,31 @@

/* Add space for the leading dot */
domain_len +=3D 1;
- domain_size +=3D one_glyph;

+ domain= _size +=3D glyph_size;

/= * Space for the terminating zeros */
- size_t extra_size =3D 2 * one_glyph;<= br>+ size_t extr= a_size =3D 2 * glyph_size;

= /* Check for enough space to convert this domain */
= if (converted_size + domain_size + extra_size > buf_size)
{
/* D= omain doesn't fit, bad luck if it's the first one */
*pos =3D '\0';

- *size =3D converted_size =3D=3D= 0 ? 0 : converted_size + one_glyph;
+ *size =3D converted_size =3D=3D 0 ? 0 = : converted_size + glyph_size;
return = ERROR_MORE_DATA;
}

/* Prefix domain at pos with the dot */<= br>- memmove(pos += 1, pos, buf_size - converted_size - one_glyph);
+ memmove(pos + 1, pos, buf_size= - converted_size - glyph_size);
domains[b= uf_len - 1] =3D '\0';
*pos =3D = 9;.';
- = *size +=3D one_glyph;
+ *size +=3D glyph_size;

if (!comma)

{<= br> /* Conversion is done */
= *(pos + domain_len) =3D '\0';
- *size +=3D one_glyph;<= /span>
+ = *size +=3D glyph_size;
return NO_ERROR= ;
}


To view, visit change 1398. To unsubscribe, or for help writing= mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I69a6ab59d995fb4a511f57c8535= b5ffa4048673c
Gerrit-Change-Number: 1398
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --+woK20dfQgU=--