Skip to content

Commit 6d4eda9

Browse files
committed
compilation
1 parent d5cf52d commit 6d4eda9

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

trip/iwave/base/lib/parser.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -908,23 +908,23 @@ int ps_set(PARARRAY * par, int last, const char * type, const char * key, const
908908
else {
909909
if (!err && !strcmp(type,"char")) {
910910
memset(l,'\0',MAX_STR_LEN);
911-
err=sprintf(l,"%c",*((char *)val));
911+
err=snprintf(l, MAX_STR_LEN, "%c",*((char *)val));
912912
if (0==err || MAX_STR_LEN==err) {
913913
err=E_PARSECONVERT;
914914
}
915915
else err=0;
916916
}
917917
else if (!err && !strcmp(type,"long")) {
918918
memset(l,'\0',MAX_STR_LEN);
919-
err=sprintf(l,"%ld",*((long *)val));
919+
err=snprintf(l, MAX_STR_LEN, "%ld",*((long *)val));
920920
if (0==err || MAX_STR_LEN==err) {
921921
err=E_PARSECONVERT;
922922
}
923923
else err=0;
924924
}
925925
else if (!err && !strcmp(type,"ulong")) {
926926
memset(l,'\0',MAX_STR_LEN);
927-
err=sprintf(l,"%lu",*((unsigned long *)val));
927+
err=snprintf(l, MAX_STR_LEN, "%lu",*((unsigned long *)val));
928928
if (0==err || MAX_STR_LEN==err) {
929929
err=E_PARSECONVERT;
930930
}
@@ -933,7 +933,7 @@ int ps_set(PARARRAY * par, int last, const char * type, const char * key, const
933933
else if (!err && !strcmp(type,"int")) {
934934
/* fprintf(stderr,"in ps_set - int\n"); */
935935
memset(l,'\0',MAX_STR_LEN);
936-
err=sprintf(l,"%d",*((int *)val));
936+
err=snprintf(l, MAX_STR_LEN, "%d",*((int *)val));
937937
/* fprintf(stderr,"output = %s err=%d\n",l,err); */
938938
if (0==err || MAX_STR_LEN==err) {
939939
err=E_PARSECONVERT;
@@ -942,39 +942,39 @@ int ps_set(PARARRAY * par, int last, const char * type, const char * key, const
942942
}
943943
else if (!err && !strcmp(type,"uint")) {
944944
memset(l,'\0',MAX_STR_LEN);
945-
err=sprintf(l,"%u",*((unsigned int *)val));
945+
err=snprintf(l, MAX_STR_LEN, "%u",*((unsigned int *)val));
946946
if (0==err || MAX_STR_LEN==err) {
947947
err=E_PARSECONVERT;
948948
}
949949
else err=0;
950950
}
951951
else if (!err && !strcmp(type,"short")) {
952952
memset(l,'\0',MAX_STR_LEN);
953-
err=sprintf(l,"%hd",*((short *)val));
953+
err=snprintf(l, MAX_STR_LEN, "%hd",*((short *)val));
954954
if (0==err || MAX_STR_LEN==err) {
955955
err=E_PARSECONVERT;
956956
}
957957
else err=0;
958958
}
959959
else if (!err && !strcmp(type,"ushort")) {
960960
memset(l,'\0',MAX_STR_LEN);
961-
err=sprintf(l,"%hu",*((unsigned short *)val));
961+
err=snprintf(l, MAX_STR_LEN, "%hu",*((unsigned short *)val));
962962
if (0==err || MAX_STR_LEN==err) {
963963
err=E_PARSECONVERT;
964964
}
965965
else err=0;
966966
}
967967
else if (!err && !strcmp(type,"float")) {
968968
memset(l,'\0',MAX_STR_LEN);
969-
err=sprintf(l,"%g",*((float *)val));
969+
err=snprintf(l, MAX_STR_LEN, "%g",*((float *)val));
970970
if (0==err || MAX_STR_LEN==err) {
971971
err=E_PARSECONVERT;
972972
}
973973
else err=0;
974974
}
975975
else if (!err && !strcmp(type,"double")) {
976976
memset(l,'\0',MAX_STR_LEN);
977-
err=sprintf(l,"%g",*((double *)val));
977+
err=snprintf(l, MAX_STR_LEN, "%g",*((double *)val));
978978
if (0==err || MAX_STR_LEN==err) {
979979
err=E_PARSECONVERT;
980980
}
@@ -983,9 +983,9 @@ int ps_set(PARARRAY * par, int last, const char * type, const char * key, const
983983
else if (!err && !strcmp(type,"ireal")) {
984984
memset(l,'\0',MAX_STR_LEN);
985985
#if DT_REAL == DT_DOUBLE
986-
err=sprintf(l,"%g",*((double *)val));
986+
err=snprintf(l, MAX_STR_LEN, "%g",*((double *)val));
987987
#else
988-
err=sprintf(l,"%g",*((float *)val));
988+
err=snprintf(l, MAX_STR_LEN, "%g",*((float *)val));
989989
#endif
990990
if (0==err || MAX_STR_LEN==err) {
991991
err=E_PARSECONVERT;

trip/rvl/rvl/include/except.hh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,37 +63,37 @@ namespace RVL {
6363
}
6464
RVLException & operator<< ( int i ) {
6565
char buf[ BUFLEN ];
66-
sprintf( buf, "%d", i );
66+
snprintf( buf, BUFLEN, "%d", i );
6767
msg += buf;
6868
return *this;
6969
}
7070
RVLException & operator<< ( unsigned int i ) {
7171
char buf[ BUFLEN ];
72-
sprintf( buf, "%u", i );
72+
snprintf( buf, BUFLEN, "%u", i );
7373
msg += buf;
7474
return *this;
7575
}
7676
RVLException & operator<< ( long i ) {
7777
char buf[ BUFLEN ];
78-
sprintf( buf, "%ld", i );
78+
snprintf( buf, BUFLEN, "%ld", i );
7979
msg += buf;
8080
return *this;
8181
}
8282
RVLException & operator<< ( unsigned long i ) {
8383
char buf[ BUFLEN ];
84-
sprintf( buf, "%lu", i );
84+
snprintf( buf, BUFLEN, "%lu", i );
8585
msg += buf;
8686
return *this;
8787
}
8888
RVLException & operator<< ( short i ) {
8989
char buf[ BUFLEN ];
90-
sprintf( buf, "%d", i );
90+
snprintf( buf, BUFLEN, "%d", i );
9191
msg += buf;
9292
return *this;
9393
}
9494
RVLException & operator<< ( unsigned short i ) {
9595
char buf[ BUFLEN ];
96-
sprintf( buf, "%d", i );
96+
snprintf( buf, BUFLEN, "%d", i );
9797
msg += buf;
9898
return *this;
9999
}
@@ -107,20 +107,20 @@ namespace RVL {
107107
*/
108108
RVLException & operator<< ( double d ) {
109109
char buf[ BUFLEN ];
110-
sprintf( buf, "%g", d );
110+
snprintf( buf, BUFLEN, "%g", d );
111111
msg += buf;
112112
return *this;
113113
}
114114
RVLException & operator<< ( float d ) {
115115
char buf[ BUFLEN ];
116-
sprintf( buf, "%g", d );
116+
snprintf( buf, BUFLEN, "%g", d );
117117
msg += buf;
118118
return *this;
119119
}
120120
template<class T>
121121
RVLException & operator<< ( complex<T> d ) {
122122
char buf[ BUFLEN ];
123-
sprintf( buf, "(%g,%g)", d.real(),d.imag() );
123+
snprintf( buf, BUFLEN, "(%g,%g)", d.real(),d.imag() );
124124
msg += buf;
125125
return *this;
126126
}

0 commit comments

Comments
 (0)