(StringType_get_tag): Fix omission bug: Cast `DohMalloc()'

return value to `char *'.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@431 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Thien-Thi Nguyen 2000-05-11 06:16:37 +00:00
commit 7f1079a5e0

View file

@ -1,13 +1,13 @@
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* stype.c * stype.c
* *
* This file provides general support for datatypes that are encoded in * This file provides general support for datatypes that are encoded in
* the form of simple strings. * the form of simple strings.
* *
* Author(s) : David Beazley (beazley@cs.uchicago.edu) * Author(s) : David Beazley (beazley@cs.uchicago.edu)
* *
* Copyright (C) 1999-2000. The University of Chicago * Copyright (C) 1999-2000. The University of Chicago
* See the file LICENSE for information on usage and redistribution. * See the file LICENSE for information on usage and redistribution.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#include "swig.h" #include "swig.h"
@ -24,7 +24,7 @@
* *
* <type><pointer><array size="500"><pointer><pointer>int * <type><pointer><array size="500"><pointer><pointer>int
* </pointer></pointer></array></pointer></type> * </pointer></pointer></array></pointer></type>
* *
* The purpose of this module is to provide a general purpose type system * The purpose of this module is to provide a general purpose type system
* in which types are represented as simple text strings. The goal of * in which types are represented as simple text strings. The goal of
* this representation is to make it extremely easy to specify types in * this representation is to make it extremely easy to specify types in
@ -35,7 +35,7 @@
* *
* Types are represented by a base type (e.g., "int") and a collection of * Types are represented by a base type (e.g., "int") and a collection of
* type elements applied to the base (e.g., pointers, arrays, etc...). * type elements applied to the base (e.g., pointers, arrays, etc...).
* *
* Encoding: * Encoding:
* *
* Types are encoded as strings of type constructors separated by '.' delimeters. * Types are encoded as strings of type constructors separated by '.' delimeters.
@ -45,7 +45,7 @@
* *.*.i-32 int ** * *.*.i-32 int **
* [300].[400].i-32 int [300][400] * [300].[400].i-32 int [300][400]
* *.+const.c-8 char const * * *.+const.c-8 char const *
* *
* '*' = Pointer * '*' = Pointer
* '&' = Reference * '&' = Reference
* '[...]' = Array * '[...]' = Array
@ -53,7 +53,7 @@
* '{s/tag/..,..}' = Structure (/tag/ optional) * '{s/tag/..,..}' = Structure (/tag/ optional)
* '{u/tag/..,..}' = Union (/tag/ optional) * '{u/tag/..,..}' = Union (/tag/ optional)
* '{c/tag/..,..}' = Class (/tag/ optional) * '{c/tag/..,..}' = Class (/tag/ optional)
* '</t/n=v,n=,..>' = Enum (/tag/ optional, n = name, * '</t/n=v,n=,..>' = Enum (/tag/ optional, n = name,
* v = value (optional)) * v = value (optional))
* '+str' = Qualifier * '+str' = Qualifier
* 'i-w' = w-bit signed integer * 'i-w' = w-bit signed integer
@ -68,7 +68,7 @@
* pointer to 32-bit integer and * pointer to 32-bit integer and
* returning 8-bit character * returning 8-bit character
* '{s/Foo/i-32,*.c-8}' structure, tagged 'Foo', containing a * '{s/Foo/i-32,*.c-8}' structure, tagged 'Foo', containing a
* 32-bit integer and a pointer to * 32-bit integer and a pointer to
* 8-bit character * 8-bit character
* '{si-32,*.c-8}' same structure, without tag * '{si-32,*.c-8}' same structure, without tag
* '{ui-32,*.c-8}' union with same members, without tag * '{ui-32,*.c-8}' union with same members, without tag
@ -78,7 +78,7 @@
* '&</Nums/\>' same enum, without its body * '&</Nums/\>' same enum, without its body
* *
* The encoding follows the order that you might describe a type in words. * The encoding follows the order that you might describe a type in words.
* For example "*.[200].int" is "A pointer to array of int's" and * For example "*.[200].int" is "A pointer to array of int's" and
* "*.+const.char" is "a pointer to a const char". * "*.+const.char" is "a pointer to a const char".
* *
* This representation is particularly convenient because string operations * This representation is particularly convenient because string operations
@ -92,7 +92,7 @@
* *
* Replace(t,"+const.","",DOH_REPLACE_ANY) * Replace(t,"+const.","",DOH_REPLACE_ANY)
* *
* The string representation of types also provides a convenient way to * The string representation of types also provides a convenient way to
* build typemaps and other pattern matching rules against type information. * build typemaps and other pattern matching rules against type information.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
@ -102,7 +102,7 @@
* Adds a pointer constructor to a type * Adds a pointer constructor to a type
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void void
StringType_add_pointer(DOHString *t) { StringType_add_pointer(DOHString *t) {
assert(DohIsString(t)); assert(DohIsString(t));
Insert(t,0,"*."); Insert(t,0,"*.");
@ -114,7 +114,7 @@ StringType_add_pointer(DOHString *t) {
* Adds an array constructor to a type * Adds an array constructor to a type
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void void
StringType_add_array(DOHString *t, DOHString *size) { StringType_add_array(DOHString *t, DOHString *size) {
assert(DohIsString(t)); assert(DohIsString(t));
Insert(t,0,"]."); Insert(t,0,"].");
@ -128,7 +128,7 @@ StringType_add_array(DOHString *t, DOHString *size) {
* Adds a reference constructor to a type. * Adds a reference constructor to a type.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void void
StringType_add_reference(DOHString *t) { StringType_add_reference(DOHString *t) {
assert(DohIsString(t)); assert(DohIsString(t));
Insert(t,0,"&."); Insert(t,0,"&.");
@ -140,7 +140,7 @@ StringType_add_reference(DOHString *t) {
* Adds a qualifier to a type * Adds a qualifier to a type
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void void
StringType_add_qualifier(DOHString *t, DOHString *qual) { StringType_add_qualifier(DOHString *t, DOHString *qual) {
assert(DohIsString(t)); assert(DohIsString(t));
Insert(t,0,"."); Insert(t,0,".");
@ -155,7 +155,7 @@ StringType_add_qualifier(DOHString *t, DOHString *qual) {
* These abstract types should be passed as a list of type-strings. * These abstract types should be passed as a list of type-strings.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
void void
StringType_add_function(DOHString *t, DOHList *parms) { StringType_add_function(DOHString *t, DOHList *parms) {
DOHString *pstr; DOHString *pstr;
int i,l; int i,l;
@ -345,7 +345,7 @@ DOHList *StringType_split_parms(DOHString *p) {
} else { } else {
Putc(*c,item); Putc(*c,item);
} }
if (*c) if (*c)
c++; c++;
} }
Append(list,item); Append(list,item);
@ -375,7 +375,7 @@ DOHString *StringType_get_tag(DOHString *s) {
c++; c++;
p = strchr(c, (int)'/'); p = strchr(c, (int)'/');
if (!p) return NULL; if (!p) return NULL;
rv = DohMalloc(p - c + 1); rv = (char *) DohMalloc (p - c + 1);
memmove(rv, c, p - c); memmove(rv, c, p - c);
rv[p - c] = 0; rv[p - c] = 0;
return rv; return rv;
@ -486,7 +486,7 @@ DOHList *StringType_split_struct(DOHString *p) {
} else { } else {
Putc(*c,item); Putc(*c,item);
} }
if (*c) if (*c)
c++; c++;
} }
Append(list,item); Append(list,item);
@ -561,7 +561,7 @@ int StringType_isqualifier(DOHString *t) {
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* StringType_base() * StringType_base()
* *
* Returns the base of a datatype. * Returns the base of a datatype.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */