~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/interfaces/ecpg/preproc/type.c

Tags: upstream-8.4.0
ImportĀ upstreamĀ versionĀ 8.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.82 2009/01/23 12:43:32 petere Exp $ */
 
1
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.83 2009/06/11 14:49:13 momjian Exp $ */
2
2
 
3
3
#include "postgres_fe.h"
4
4
 
242
242
                        switch (type->u.element->type)
243
243
                        {
244
244
                                case ECPGt_array:
245
 
                                        mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)");             /* array of array */
 
245
                                        mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)"); /* array of array */
246
246
                                        break;
247
247
                                case ECPGt_struct:
248
248
                                case ECPGt_union:
327
327
                fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name);
328
328
        else
329
329
        {
330
 
                char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
331
 
                char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3);
332
 
                char *var_name, *ptr; 
 
330
                char       *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
 
331
                char       *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3);
 
332
                char       *var_name,
 
333
                                   *ptr;
333
334
 
334
335
                switch (type)
335
336
                {
354
355
                                /* remove trailing [] is name is array element */
355
356
                                var_name = mm_strdup(name);
356
357
                                ptr = strchr(var_name, '[');
357
 
                                if (ptr) *ptr = '\0';
 
358
                                if (ptr)
 
359
                                        *ptr = '\0';
358
360
                                if (lineno)
359
361
                                        sprintf(offset, "sizeof(struct varchar_%s_%d)", var_name, lineno);
360
362
                                else