|
From: <ai...@us...> - 2009-07-28 18:52:09
|
Revision: 10185
http://plplot.svn.sourceforge.net/plplot/?rev=10185&view=rev
Author: airwin
Date: 2009-07-28 18:51:57 +0000 (Tue, 28 Jul 2009)
Log Message:
-----------
Use default colour palette files if the filename is an empty string.
Modified Paths:
--------------
trunk/src/plctrl.c
Modified: trunk/src/plctrl.c
===================================================================
--- trunk/src/plctrl.c 2009-07-28 16:44:08 UTC (rev 10184)
+++ trunk/src/plctrl.c 2009-07-28 18:51:57 UTC (rev 10185)
@@ -1225,12 +1225,21 @@
char color_info[30];
FILE *fp;
char msgbuf[1024];
-
- fp = plLibOpen(filename);
- if (fp == NULL) {
- snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n",filename);
- plwarn(msgbuf);
- return;
+
+ if(strlen(filename) == 0) {
+ fp = plLibOpen("cmap0_default.pal");
+ if (fp == NULL) {
+ snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n","cmap0_default.pal");
+ plwarn(msgbuf);
+ return;
+ }
+ } else {
+ fp = plLibOpen(filename);
+ if (fp == NULL) {
+ snprintf(msgbuf,1024,"Unable to open cmap0 file %s\n",filename);
+ plwarn(msgbuf);
+ return;
+ }
}
if (fscanf(fp, "%d\n", &number_colors) != 1 || number_colors < 1) {
snprintf(msgbuf,1024,"Unrecognized cmap0 header\n");
@@ -1306,13 +1315,21 @@
rgb = TRUE;
err = 0;
format_version = 0;
- fp = plLibOpen(filename);
- if (fp == NULL) {
- snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n",filename);
- plwarn(msgbuf);
- return;
+ if(strlen(filename) == 0) {
+ fp = plLibOpen("cmap1_default.pal");
+ if (fp == NULL) {
+ snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n","cmap1_default.pal");
+ plwarn(msgbuf);
+ return;
+ }
+ } else {
+ fp = plLibOpen(filename);
+ if (fp == NULL) {
+ snprintf(msgbuf,1024,"Unable to open cmap1 .pal file %s\n",filename);
+ plwarn(msgbuf);
+ return;
+ }
}
-
/* Check for new file format */
fgets(color_info, 160, fp);
if (strncmp(color_info,"v2 ",2) == 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|