diff libcommon/number_encode.c @ 43:52ec2d3eb851

encode_phone_number_arg() now supports both encoding modes
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Feb 2021 23:36:47 +0000
parents 62cdfed70de7
children
line wrap: on
line diff
--- a/libcommon/number_encode.c	Fri Feb 12 23:02:09 2021 +0000
+++ b/libcommon/number_encode.c	Fri Feb 12 23:36:47 2021 +0000
@@ -53,7 +53,7 @@
 	}
 }
 
-encode_phone_number_arg(arg, fixp)
+encode_phone_number_arg(arg, fixp, mode)
 	char *arg;
 	u_char *fixp;
 {
@@ -83,10 +83,13 @@
 		}
 		digits[ndigits] = c;
 	}
+	if (mode)
+		fixp[0] = ndigits;
 	if (ndigits & 1)
 		digits[ndigits++] = 0xF;
 	num_digit_bytes = ndigits >> 1;
-	fixp[0] = num_digit_bytes + 1;
+	if (!mode)
+		fixp[0] = num_digit_bytes + 1;
 	pack_digit_bytes(digits, fixp + 2, num_digit_bytes);
 	if (*cp == ',') {
 		cp++;