Skip to content
Snippets Groups Projects
Commit 6a9a2376 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better handling of NULL input strings
parent d270ce05
No related branches found
No related tags found
No related merge requests found
% $Id: gl2ps.tex,v 1.173 2004-07-11 22:30:25 geuzaine Exp $ % $Id: gl2ps.tex,v 1.174 2004-07-13 15:59:49 geuzaine Exp $
% %
% GL2PS, an OpenGL to PostScript Printing Library % GL2PS, an OpenGL to PostScript Printing Library
% Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> % Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org>
...@@ -572,7 +572,7 @@ while( state == GL2PS_OVERFLOW ){ ...@@ -572,7 +572,7 @@ while( state == GL2PS_OVERFLOW ){
GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING | GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING |
GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT, GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT,
GL_RGBA, 0, NULL, 0, 0, 0, buffsize, GL_RGBA, 0, NULL, 0, 0, 0, buffsize,
fp, NULL ); fp, "MyFileName" );
draw(); draw();
state = gl2psEndPage(); state = gl2psEndPage();
} }
......
/* $Id: gl2ps.c,v 1.176 2004-07-12 17:49:56 geuzaine Exp $ */ /* $Id: gl2ps.c,v 1.177 2004-07-13 15:59:49 geuzaine Exp $ */
/* /*
* GL2PS, an OpenGL to PostScript Printing Library * GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org> * Copyright (C) 1999-2004 Christophe Geuzaine <geuz@geuz.org>
...@@ -4372,19 +4372,32 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer, ...@@ -4372,19 +4372,32 @@ GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
rewind(gl2ps->stream); rewind(gl2ps->stream);
} }
if(!title) if(!title){
title = ""; gl2ps->title = (char*)gl2psMalloc(sizeof(char));
if(!producer) gl2ps->title[0] = '\0';
producer = ""; }
if(!filename) else{
filename = "";
gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char)); gl2ps->title = (char*)gl2psMalloc((strlen(title)+1)*sizeof(char));
strcpy(gl2ps->title, title); strcpy(gl2ps->title, title);
}
if(!producer){
gl2ps->producer = (char*)gl2psMalloc(sizeof(char));
gl2ps->producer[0] = '\0';
}
else{
gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char)); gl2ps->producer = (char*)gl2psMalloc((strlen(producer)+1)*sizeof(char));
strcpy(gl2ps->producer, producer); strcpy(gl2ps->producer, producer);
}
if(!filename){
gl2ps->filename = (char*)gl2psMalloc(sizeof(char));
gl2ps->filename[0] = '\0';
}
else{
gl2ps->filename = (char*)gl2psMalloc((strlen(filename)+1)*sizeof(char)); gl2ps->filename = (char*)gl2psMalloc((strlen(filename)+1)*sizeof(char));
strcpy(gl2ps->filename, filename); strcpy(gl2ps->filename, filename);
}
switch(gl2ps->format){ switch(gl2ps->format){
case GL2PS_TEX : case GL2PS_TEX :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment