comms/scmxx: fix build with -fno-common

This commit is contained in:
tb 2021-02-26 16:51:40 +00:00
parent dc74a5a440
commit 39ed7eaa31
5 changed files with 77 additions and 8 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.16 2019/07/12 20:43:48 sthen Exp $
# $OpenBSD: Makefile,v 1.17 2021/02/26 16:51:40 tb Exp $
COMMENT= data exchange utility for Siemens mobile phones
DISTNAME= scmxx-0.8.0
REVISION= 4
REVISION= 5
CATEGORIES= comms
HOMEPAGE= http://www.hendrik-sattler.de/scmxx/

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_common_h,v 1.1 2021/02/26 16:51:40 tb Exp $
Fix build with -fno-common
Index: src/common.h
--- src/common.h.orig
+++ src/common.h
@@ -17,7 +17,7 @@
#include <stdlib.h>
-int VERBOSE_LEVEL;
+extern int VERBOSE_LEVEL;
#define VERBOSE_LEVEL_ERROR 0
#define VERBOSE_LEVEL_WARNING 1
#define VERBOSE_LEVEL_NOTICE 2

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_scmxx_c,v 1.1 2021/02/26 16:51:40 tb Exp $
Fix build with -fno-common
Index: src/scmxx.c
--- src/scmxx.c.orig
+++ src/scmxx.c
@@ -20,6 +20,8 @@
#include <string.h>
#include <stdlib.h>
+int VERBOSE_LEVEL;
+
int main (int argc, char** argv) {
char* supported_phones[] = {
"S25",

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-src_smspdu_smspdu_enc_c,v 1.1 2021/02/26 16:51:40 tb Exp $
Index: src/smspdu/smspdu_enc.c
--- src/smspdu/smspdu_enc.c.orig
+++ src/smspdu/smspdu_enc.c
@@ -84,7 +84,7 @@ char* sms_pdu_create_submit_frame (char* number,
sms_number_set(&da,numtype(number),number);
temp = sms_number_get(&da);
if (temp == NULL || strcmp(temp,number) != 0) {
- fprintf(stderr,_("%s: sms number cannot have more than %d digits.\n"),_("Error"),sizeof(da.digits)-1);
+ fprintf(stderr,_("%s: sms number cannot have more than %zd digits.\n"),_("Error"),sizeof(da.digits)-1);
return NULL;
}
mem_realloc(temp,0);

View File

@ -1,15 +1,38 @@
$OpenBSD: patch-src_smspdu_smsud_enc_c,v 1.1 2005/07/26 17:00:51 fgsch Exp $
--- src/smspdu/smsud_enc.c.orig Tue Jul 26 01:43:04 2005
+++ src/smspdu/smsud_enc.c Tue Jul 26 01:43:28 2005
@@ -21,6 +21,11 @@
$OpenBSD: patch-src_smspdu_smsud_enc_c,v 1.2 2021/02/26 16:51:40 tb Exp $
Index: src/smspdu/smsud_enc.c
--- src/smspdu/smsud_enc.c.orig
+++ src/smspdu/smsud_enc.c
@@ -21,7 +21,12 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
+
+#ifndef UINT16_MAX
+#define UINT16_MAX USHRT_MAX
+#endif
+
static
uint16_t sms_new_sequence_id () {
/* this does not have to be good random (linear would be ok)
@@ -150,7 +155,7 @@ char* sms_data_ucs2_encode (struct sms_pdu_ud_header**
if (headersize) sms_data_insert_header(header,retval+2);
memcpy(retval+2+strlen(retval+2),tmp,strlen(tmp));
mem_realloc(tmp,3);
- sprintf(tmp,"%02X",strlen(retval+2)/2);
+ sprintf(tmp,"%02zX",strlen(retval+2)/2);
memcpy(retval,tmp,2);
mem_realloc(tmp,0);
@@ -215,8 +220,8 @@ char** sms_data_encode (enum sms_encoding charset,
}
fprintf(stderr,"%s: ",_("Notice"));
fprintf(stderr,
- ngettext("This message has %d character",
- "This message has %d characters",
+ ngettext("This message has %zd character",
+ "This message has %zd characters",
ucs4len(input)),
ucs4len(input));
fprintf(stderr,"%s"," ");