const char * correctness fixes (in C code)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13939 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c7df90e675
commit
dac89e16d4
7 changed files with 10 additions and 10 deletions
|
|
@ -254,7 +254,7 @@ extern int DohDelmeta(DOH *, const DOH *);
|
||||||
|
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
|
|
||||||
extern void DohEncoding(char *name, DOH *(*fn) (DOH *s));
|
extern void DohEncoding(const char *name, DOH *(*fn) (DOH *s));
|
||||||
extern int DohPrintf(DOHFile * obj, const char *format, ...);
|
extern int DohPrintf(DOHFile * obj, const char *format, ...);
|
||||||
extern int DohvPrintf(DOHFile * obj, const char *format, va_list ap);
|
extern int DohvPrintf(DOHFile * obj, const char *format, va_list ap);
|
||||||
extern int DohPrintv(DOHFile * obj, ...);
|
extern int DohPrintv(DOHFile * obj, ...);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ typedef struct {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
typedef struct DohObjInfo {
|
typedef struct DohObjInfo {
|
||||||
char *objname; /* Object name */
|
const char *objname; /* Object name */
|
||||||
|
|
||||||
/* Basic object methods */
|
/* Basic object methods */
|
||||||
void (*doh_del) (DOH *obj); /* Delete object */
|
void (*doh_del) (DOH *obj); /* Delete object */
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ static int Writen(DOH *out, void *buffer, int len) {
|
||||||
* two file-like objects and operate as a filter.
|
* two file-like objects and operate as a filter.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void DohEncoding(char *name, DOH *(*fn) (DOH *s)) {
|
void DohEncoding(const char *name, DOH *(*fn) (DOH *s)) {
|
||||||
if (!encodings)
|
if (!encodings)
|
||||||
encodings = NewHash();
|
encodings = NewHash();
|
||||||
Setattr(encodings, (void *) name, NewVoid((void *) fn, 0));
|
Setattr(encodings, (void *) name, NewVoid((void *) fn, 0));
|
||||||
|
|
@ -102,7 +102,7 @@ static DOH *encode(char *name, DOH *s) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int DohvPrintf(DOH *so, const char *format, va_list ap) {
|
int DohvPrintf(DOH *so, const char *format, va_list ap) {
|
||||||
static char *fmt_codes = "dioxXucsSfeEgGpn";
|
static const char *fmt_codes = "dioxXucsSfeEgGpn";
|
||||||
int state = 0;
|
int state = 0;
|
||||||
const char *p = format;
|
const char *p = format;
|
||||||
char newformat[256];
|
char newformat[256];
|
||||||
|
|
|
||||||
|
|
@ -1637,7 +1637,7 @@ String *Preprocessor_parse(String *s) {
|
||||||
if (Len(sval) > 0) {
|
if (Len(sval) > 0) {
|
||||||
val = Preprocessor_expr(sval, &e);
|
val = Preprocessor_expr(sval, &e);
|
||||||
if (e) {
|
if (e) {
|
||||||
char *msg = Preprocessor_expr_error();
|
const char *msg = Preprocessor_expr_error();
|
||||||
Seek(value, 0, SEEK_SET);
|
Seek(value, 0, SEEK_SET);
|
||||||
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
|
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
|
||||||
if (msg)
|
if (msg)
|
||||||
|
|
@ -1671,7 +1671,7 @@ String *Preprocessor_parse(String *s) {
|
||||||
if (Len(sval) > 0) {
|
if (Len(sval) > 0) {
|
||||||
val = Preprocessor_expr(sval, &e);
|
val = Preprocessor_expr(sval, &e);
|
||||||
if (e) {
|
if (e) {
|
||||||
char *msg = Preprocessor_expr_error();
|
const char *msg = Preprocessor_expr_error();
|
||||||
Seek(value, 0, SEEK_SET);
|
Seek(value, 0, SEEK_SET);
|
||||||
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
|
Swig_warning(WARN_PP_EVALUATION, Getfile(value), Getline(value), "Could not evaluate expression '%s'\n", value);
|
||||||
if (msg)
|
if (msg)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ static exprval stack[256]; /* Parsing stack */
|
||||||
static int sp = 0; /* Stack pointer */
|
static int sp = 0; /* Stack pointer */
|
||||||
static int prec[256]; /* Precedence rules */
|
static int prec[256]; /* Precedence rules */
|
||||||
static int expr_init = 0; /* Initialization flag */
|
static int expr_init = 0; /* Initialization flag */
|
||||||
static char *errmsg = 0; /* Parsing error */
|
static const char *errmsg = 0; /* Parsing error */
|
||||||
|
|
||||||
/* Initialize the precedence table for various operators. Low values have higher precedence */
|
/* Initialize the precedence table for various operators. Low values have higher precedence */
|
||||||
static void init_precedence() {
|
static void init_precedence() {
|
||||||
|
|
@ -435,6 +435,6 @@ extra_rparen:
|
||||||
* Return error message set by the evaluator (if any)
|
* Return error message set by the evaluator (if any)
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *Preprocessor_expr_error() {
|
const char *Preprocessor_expr_error() {
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
extern int Preprocessor_expr(String *s, int *error);
|
extern int Preprocessor_expr(String *s, int *error);
|
||||||
extern char *Preprocessor_expr_error(void);
|
extern const char *Preprocessor_expr_error(void);
|
||||||
extern Hash *Preprocessor_define(const_String_or_char_ptr str, int swigmacro);
|
extern Hash *Preprocessor_define(const_String_or_char_ptr str, int swigmacro);
|
||||||
extern void Preprocessor_undef(const_String_or_char_ptr name);
|
extern void Preprocessor_undef(const_String_or_char_ptr name);
|
||||||
extern void Preprocessor_init(void);
|
extern void Preprocessor_init(void);
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ void Swig_print_node(Node *obj) {
|
||||||
Printf(stdout, "%-12s - %s\n", k, ParmList_str_defaultargs(Getattr(obj, k)));
|
Printf(stdout, "%-12s - %s\n", k, ParmList_str_defaultargs(Getattr(obj, k)));
|
||||||
} else {
|
} else {
|
||||||
DOH *o;
|
DOH *o;
|
||||||
char *trunc = "";
|
const char *trunc = "";
|
||||||
print_indent(2);
|
print_indent(2);
|
||||||
if (DohIsString(Getattr(obj, k))) {
|
if (DohIsString(Getattr(obj, k))) {
|
||||||
o = Str(Getattr(obj, k));
|
o = Str(Getattr(obj, k));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue