51 #if defined(HAVE_STDARG_H)
55 #include <plugin_utils.h>
59 #include <X11/Intrinsic.h>
60 #include <X11/StringDefs.h>
61 #include <X11/Xatom.h>
72 #define PLUGIN_NAME "FreeWRL X3D/VRML"
74 #define BOOL_STR(b) (b ? "TRUE" : "FALSE")
76 #define RECORD_FILE_NAME_IF_NULL \
77 if (me->fName == NULL) { \
79 me->fName = (char *) NPN_MemAlloc((strlen(stream->url) +1) *sizeof(char *)); \
80 strcpy(me->fName,stream->url); \
81 PRINT("Can record filename now, name is %s\n", me->fName); \
85 int gotRequestFromFreeWRL = FALSE;
88 static void *seqNo = 0;
90 static int PluginVerbose = 1;
101 uint32 width, height;
107 int interfacePipe[2];
109 int cacheFileNameLen;
114 typedef void (* Sigfunc) (int);
116 static int np_fileDescriptor;
122 #define PIPE_PLUGINSIDE 0
123 #define PIPE_FREEWRLSIDE 1
126 static void signalHandler (
int);
128 void freewrlReceive(
int fileDescriptor);
135 #define MALLOC NPN_MemAlloc
137 #define FREE NPN_MemFree
139 struct timeval mytime;
150 char *logfilename, *hostname, *username;
151 static const char log_file_pat[] =
"/tmp/npfreewrl_%s-%s.log";
153 hostname = MALLOC(4096);
154 if (gethostname(hostname, 4096) < 0) {
156 fprintf(stderr,
"system error: %s\n", strerror(err));
157 sprintf(hostname,
"unknown-host");
159 username = getenv(
"LOGNAME");
161 username = getlogin();
165 fprintf(stderr,
"system error: %s\n", strerror(err));
166 username =
"unknown-user";
171 logfilename = MALLOC(strlen(log_file_pat)
172 + strlen(hostname) + strlen(username) -4 +1 +4 );
173 sprintf(logfilename, log_file_pat, hostname, username);
178 tty = fopen(logfilename,
"a");
181 fprintf (stderr,
"FreeWRL plugin ERROR: plugin could not open log file: %s. Will output to stderr.\n", logfilename);
188 me->logFileName = logfilename;
199 va_start(ap, format);
204 if (!PluginVerbose)
return;
207 gettimeofday (&mytime,&tz);
208 TickTime = (double) mytime.tv_sec + (
double)mytime.tv_usec/1000000.0;
215 fprintf(tty,
"%f: FreeWRL plugin: ", TickTime);
216 vfprintf(tty, format, ap);
222 #define PRINT(_formargs...) print(me, ##_formargs)
224 #define PRINT_PERROR(_msg) print(me, "system error: %s failed: %s (%d)\n", \
225 _msg, strerror(errno), errno)
229 Sigfunc signal(
int signo, Sigfunc func)
231 struct sigaction action, old_action;
233 action.sa_handler = func;
238 sigemptyset(&action.sa_mask);
243 action.sa_flags |= SA_NOCLDSTOP;
245 action.sa_flags |= SA_NOCLDWAIT;
248 if (sigaction(signo, &action, &old_action) < 0) {
253 return(old_action.sa_handler);
258 void signalHandler(
int signo) {
262 if (signo == SIGIO) {
263 freewrlReceive(np_fileDescriptor);
271 void freewrlReceive(
int fileDescriptor)
274 sigset_t newmask, oldmask;
277 size_t request_size = 0;
280 sprintf(debs,
"Call to freewrlReceive fileDescriptor %d.", fileDescriptor);
283 bzero(request.url, FILENAME_MAX);
284 request.instance = 0;
285 request.notifyCode = 0;
287 request_size =
sizeof(request);
296 if (sigemptyset(&newmask) < 0) {
297 print_here(
"Call to sigemptyset with arg newmask failed");
301 if (sigemptyset(&oldmask) < 0) {
302 print_here(
"Call to sigemptyset with arg oldmask failed");
306 if (sigaddset(&newmask, SIGIO) < 0) {
307 print_here(
"Call to sigaddset failed");
312 if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) {
313 print_here(
"Call to sigprocmask failed");
318 if (read(fileDescriptor, (
urlRequest *) &request, request_size) < 0) {
319 if (errno != EINTR && errno != EAGAIN) {
320 print_here(
"Call to read failed");
323 print_here (
"freewrlReceive, quick return; either this is us writing or freewrl croaked");
326 sprintf (debs,
"notifyCode = %d url = %s", request.notifyCode, request.url);
330 gotRequestFromFreeWRL = TRUE;
333 if (request.notifyCode == 0) {
339 if ((rv = NPN_GetURLNotify(request.instance,
341 (
void *)(seqNo))) != NPERR_NO_ERROR) {
342 sprintf(debs,
"Call to NPN_GetURLNotify failed with error %d.", rv);
347 sprintf (debs,
"step 2a, NPN_GetURLNotify with request.url %s",request.url);
350 }
else if (request.notifyCode == -99) {
352 sprintf (debs,
"notifyCode = -99, we have timed out for %s",request.url);
354 if (currentStream != NULL) {
355 NPN_DestroyStream(request.instance, currentStream, NPRES_USER_BREAK);
356 sprintf (debs,
"FreeWRL can not find: %s",request.url);
358 NPN_Status (request.instance, debs);
359 currentStream = NULL;
364 sprintf (debs,
"NPN_GetStream...");
368 NPError err = NPERR_NO_ERROR;
369 char* myData =
"<HTML><B>This is a message from my plug-in!</b></html>";
370 int32 myLength = strlen(myData) + 1;
371 err = NPN_NewStream(request.instance,
373 "_AnchorFailsinFreeWRL",
375 print_here (
"NewStream made");
377 err = NPN_Write(request.instance,
381 print_here (
"NPN_Write made");
385 sprintf (debs,
"FreeWRL loading: %s",request.url);
387 NPN_Status (request.instance, debs);
391 if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) {
392 print_here(
"Call to sigprocmask failed");
396 print_here(
"returning from freewrl_receive");
401 static int init_socket(
FW_PluginInstance *me,
int fileDescriptor, Boolean nonblock)
405 if (fcntl(fileDescriptor, F_SETOWN, getpid()) < 0) {
406 PRINT(
"Call to fcntl with command F_SETOWN failed\n");
407 return(NPERR_GENERIC_ERROR);
410 if ( (io_flags = fcntl(fileDescriptor, F_GETFL, 0)) < 0 ) {
411 PRINT(
"Call to fcntl with command F_GETFL failed\n");
412 return(NPERR_GENERIC_ERROR);
423 if (nonblock) { io_flags |= O_NONBLOCK; }
425 if ( (io_flags = fcntl(fileDescriptor, F_SETFL, io_flags)) < 0 ) {
426 PRINT(
"Call to fcntl with command F_SETFL failed\n");
427 return(NPERR_GENERIC_ERROR);
429 return(NPERR_NO_ERROR);
433 int Run (
NPP instance)
439 char instanceStr[25];
442 XWindowAttributes mywin;
443 Window child_window = 0;
449 #define clean_pipe { close(secpipe[0]); close(secpipe[1]); }
455 PRINT(
"Run starts... Checking if can run; disp %u win %u fname %s\n",
456 me->mozwindow, me->display, me->fName);
459 if (me->mozwindow == 0)
return FALSE;
461 if (me->fName == NULL)
return FALSE;
463 if (me->display == 0)
return FALSE;
465 PRINT(
"Run ... ok\n");
468 if (me->freewrl_running) {
469 PRINT(
"Run ... FreeWRL already running, returning.\n");
473 if (pipe(secpipe) < 0) {
474 PRINT_PERROR(
"pipe");
478 if (fcntl(secpipe[1], F_SETFD, fcntl(secpipe[1], F_GETFD) | FD_CLOEXEC)) {
479 PRINT_PERROR(
"fcntl");
484 switch ((child = fork())) {
486 PRINT_PERROR(
"fork");
491 if (setpgid(mine, mine) < 0) {
492 PRINT_PERROR(
"setpgid");
496 sprintf(pipetome,
"pipe:%d",
497 me->interfacePipe[PIPE_FREEWRLSIDE]);
500 sprintf(childFd,
"%d", me->interfaceFile[SOCKET_2]);
503 sprintf(instanceStr,
"%lu",
504 (
unsigned long int) (uintptr_t) instance);
507 paramline[carg++] =
"nice";
508 paramline[carg++] =
"freewrl";
509 paramline[carg++] =
"--logfile";
511 if (me->logFileName) {
512 paramline[carg++] = me->logFileName;
514 paramline[carg++] =
"-";
523 paramline[carg++] = me->fName;
527 paramline[carg++] =
"--plugin";
528 paramline[carg++] = pipetome;
531 paramline [carg++] =
"--eai";
535 paramline[carg++] =
"--fd";
536 paramline[carg++] = childFd;
537 paramline[carg++] =
"--instance";
538 paramline[carg++] = instanceStr;
539 paramline[carg] = NULL;
542 PRINT(
"exec param line is %s %s %s %s %s %s %s %s %s %s %s\n",
543 paramline[0],paramline[1],paramline[2],paramline[3],
544 paramline[4],paramline[5],paramline[6],paramline[7],
545 paramline[8],paramline[9],paramline[10]);
548 execvp(paramline[0], paramline);
549 write(secpipe[1], &errno,
sizeof(
int));
555 while ((count = read(secpipe[0], &err,
sizeof(errno))) == -1)
556 if (errno != EAGAIN && errno != EINTR)
break;
559 PRINT_PERROR(
"execvp");
566 PRINT(
"waiting for child...\n");
567 while (waitpid(child, &err, 0) == -1)
568 if (errno != EINTR) {
569 PRINT_PERROR(
"waitpid");
574 PRINT(
"child exited with %d\n", WEXITSTATUS(err));
576 else if (WIFSIGNALED(err))
577 PRINT(
"child killed by %d\n", WTERMSIG(err));
581 me->childPID = child;
582 PRINT(
"CHILD %d\n", me->childPID);
584 PRINT(
"after FW_Plugin->freewrl_running call - waiting on pipe\n");
588 nbytes = read(me->interfacePipe[PIPE_PLUGINSIDE], &child_window,
sizeof(Window));
589 if ((nbytes < 0) || (nbytes == 0)) {
592 PRINT(
"ERROR: child %d FreeWRL program died (%d), waiting...\n",
593 me->childPID, nbytes);
595 switch (waitpid(me->childPID, &status, WNOHANG)) {
596 case 0: PRINT(
"child is gone (nothing to wait), exit code: %d\n", status);
598 case -1: PRINT_PERROR(
"waitpid");
600 default: PRINT(
"child passed away, exit code: %d\n", status);
608 PRINT(
"After exec, and after read from pipe, FW window is %u\n",
611 me->fwwindow = child_window;
613 PRINT(
"disp mozwindow height width %u %u %u %u\n",
614 me->display, me->mozwindow, me->width, me->height);
618 XGetWindowAttributes(me->display,me->fwwindow, &mywin);
620 PRINT(
"Plugin: mapped_state %d, IsUnmapped %d, isUnviewable %d isViewable %d\n"
621 "x %d y %d wid %d height %d\n",
622 mywin.map_state, IsUnmapped, IsUnviewable, IsViewable,
623 mywin.x,mywin.y,mywin.width,mywin.height);
631 PRINT(
"Going to resize FreeWRL: %d x %d -> %d x %d\n",
632 mywin.width, mywin.height, me->width, me->height);
639 XSizeHints size_hints;
640 memset(&size_hints, 0,
sizeof(size_hints));
641 size_hints.min_width = size_hints.max_width = me->width;
642 size_hints.min_height = size_hints.max_height = me->height;
643 XSetWMNormalHints(me->display, me->fwwindow, &size_hints);
645 XResizeWindow(me->display, me->fwwindow, me->width, me->height);
647 PRINT(
"Going to reparent\n");
648 XReparentWindow(me->display, me->fwwindow, me->mozwindow, 0,0);
650 PRINT(
"Going to remap\n");
651 XMapWindow(me->display,me->fwwindow);
653 XGetWindowAttributes(me->display,me->fwwindow, &mywin);
655 PRINT(
"Plugin, after reparenting, mapped_state %d, "
656 "IsUnmapped %d, isUnviewable %d isViewable %d\n"
657 "x %d y %d wid %d height %d\n",
658 mywin.map_state, IsUnmapped, IsUnviewable, IsViewable,
659 mywin.x,mywin.y,mywin.width,mywin.height);
661 me->freewrl_running = TRUE;
663 PRINT(
"Run function finished\n");
675 NPP_GetMIMEDescription(
void)
677 static const char mime_types[] =
678 "x-world/x-vrml:wrl:FreeWRL VRML Browser;"
679 "model/vrml:wrl:FreeWRL VRML Browser;"
680 "model/x3d:x3d:FreeWRL X3D Browser;"
681 "model/x3d+xml:x3d:FreeWRL X3D Browser;"
682 "model/x3d+vrml:x3dv:FreeWRL X3D Browser;"
683 "model/x3d+binary:x3db:FreeWRL X3D Browser"
686 print (NULL,
"NPP_GetMIMEDescription: %s\n", mime_types);
687 return (
char *) mime_types;
691 NPP_GetValue(
NPP instance, NPPVariable variable,
void *value)
693 #define VERSION_DESCRIPTION_SIZE 1024
694 static char version_description[VERSION_DESCRIPTION_SIZE];
696 NPError err = NPERR_NO_ERROR;
698 if (!value)
return NPERR_GENERIC_ERROR;
703 PRINT(
"NPP_GetValue %u\n", variable);
706 case NPPVpluginNameString:
707 *((
char **)value) = PLUGIN_NAME;
710 case NPPVpluginNeedsXEmbed:
711 *((PRBool *)value) = PR_TRUE;
714 case NPPVpluginDescriptionString:
715 snprintf(version_description, VERSION_DESCRIPTION_SIZE,
716 "<b>FreeWRL is a VRML/X3D plugin.</b><br>"
717 "Visit us at <a href=\"http://freewrl.sourceforge.net/\">"
718 "http://freewrl.sourceforge.net/</a>.<br>"
719 "Plugin version: <b>%s</b>.<br>"
720 "Build timestamp: <b>%s</b>.<br>",
721 freewrl_plugin_get_version(),
723 *((
char **)value) = version_description;
727 err = NPERR_INVALID_PARAM;
740 NPError NPP_Initialize(
void) {
742 return NPERR_NO_ERROR;
746 jref NPP_GetJavaClass(
void )
758 void NPP_Shutdown(
void) {
767 NPP_New(NPMIMEType pluginType,
779 if( instance == NULL ) {
780 return NPERR_INVALID_INSTANCE_ERROR;
786 return NPERR_OUT_OF_MEMORY_ERROR;
788 instance->pdata = tmp;
794 PRINT(
"FreeWRL plugin log restarted. Version: %s. Build: %s\n",
795 freewrl_plugin_get_version(), BUILD_TIMESTAMP);
797 PRINT(
"NPP_New, argc %d argn %s argv %s\n", argc, argn[0], argv[0]);
801 case NP_EMBED: PRINT(
"NPP_New, mode NP_EMBED\n");
break;
802 case NP_FULL: PRINT(
"NPP_New, mode NP_FULL\n");
break;
803 default: PRINT(
"NPP_New, mode UNKNOWN MODE\n");
break;
807 gotRequestFromFreeWRL = FALSE;
809 if (pipe(me->interfacePipe) < 0) {
810 PRINT(
"Pipe connection to FW_Plugin->interfacePipe failed: %d,%s [%s:%d]\n",
811 errno, strerror(errno), __FILE__,__LINE__);
814 PRINT(
"Pipe created, PIPE_FREEWRLSIDE %d PIPE_PLUGINSIDE %d\n",
815 me->interfacePipe[PIPE_FREEWRLSIDE], me->interfacePipe[PIPE_PLUGINSIDE]);
820 if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, me->interfaceFile) < 0) {
821 PRINT(
"Call to socketpair failed\n");
822 return (NPERR_GENERIC_ERROR);
824 PRINT(
"file pair created, SOCKET_1 %d SOCKET_2 %d\n",
825 me->interfaceFile[SOCKET_1], me->interfaceFile[SOCKET_2]);
827 np_fileDescriptor = me->interfaceFile[SOCKET_1];
830 if (signal(SIGIO, signalHandler) == SIG_ERR)
return (NPERR_GENERIC_ERROR);
831 if (signal(SIGBUS, signalHandler) == SIG_ERR)
return (NPERR_GENERIC_ERROR);
835 if ((err=init_socket(me, me->interfaceFile[SOCKET_2], FALSE))!=NPERR_NO_ERROR)
837 if ((err=init_socket(me, me->interfaceFile[SOCKET_1], TRUE))!=NPERR_NO_ERROR)
839 PRINT(
"NPP_New returning %d\n", err);
851 PRINT(
"NPP_Destroy begin\n");
853 if (instance == NULL)
854 return NPERR_INVALID_INSTANCE_ERROR;
858 if (me->fName != NULL) {
859 NPN_MemFree(me->fName);
862 if (me->childPID >0) {
864 PRINT(
"killing command kill %d\n", me->childPID);
866 kill(me->childPID, SIGTERM);
867 waitpid(me->childPID, &status, 0);
870 if (me->cacheFileName != NULL) {
871 NPN_MemFree(me->cacheFileName);
874 if (me->interfacePipe[PIPE_FREEWRLSIDE] != 0) {
875 close (me->interfacePipe[PIPE_FREEWRLSIDE]);
876 close (me->interfacePipe[PIPE_PLUGINSIDE]);
879 NPN_MemFree(instance->pdata);
880 instance->pdata = NULL;
882 me->freewrl_running = FALSE;
883 gotRequestFromFreeWRL = FALSE;
885 PRINT(
"NPP_Destroy end\n");
886 return NPERR_NO_ERROR;
890 NPP_URLNotify (
NPP instance,
const char *url, NPReason reason,
void* notifyData)
893 #define returnBadURL
"this file is not to be found on the internet"
896 PRINT(
"NPP_URLNotify, url %s reason %d notifyData %p\n",
897 url, reason, notifyData);
899 if (seqNo != notifyData) {
900 PRINT(
"NPP_URLNotify, expected seq %p, got %p for %s\n",
901 seqNo, notifyData, url);
905 if (reason == NPRES_DONE) {
906 PRINT(
"NPP_UrlNotify - NPRES_DONE\n");
907 bytes = (strlen(me->cacheFileName)+1)*
sizeof(
const char *);
908 if (write(me->interfaceFile[SOCKET_1], me->cacheFileName, bytes) < 0) {
909 PRINT(
"Call to write failed\n");
913 NPN_Status(instance,
"FreeWRL: Done");
916 }
else if (reason == NPRES_USER_BREAK) {
917 PRINT(
"NPP_UrlNotify - NPRES_USER_BREAK\n");
918 }
else if (reason == NPRES_NETWORK_ERR) {
919 PRINT(
"NPP_UrlNotify - NPRES_NETWORK_ERR\n");
921 PRINT(
"NPP_UrlNotify - unknown\n");
924 PRINT(
"NPP_UrlNotify - writing %s (%u bytes) to socket %d\n",
925 returnBadURL, strlen(returnBadURL), me->interfaceFile[SOCKET_1]);
927 NPN_Status(instance,
"FreeWRL: NPP_URLNotify failed");
934 if (gotRequestFromFreeWRL) {
935 PRINT(
"NPP_UrlNotify, gotRequestFromFreeWRL - writing data\n");
936 if (write(me->interfaceFile[SOCKET_1], returnBadURL,
937 strlen(returnBadURL)) < 0) {
938 PRINT(
"Call to write failed\n");
941 PRINT(
"call to write (for returnBadURL) skipped, because gotRequestFromFreeWRL = FALSE\n");
947 NPP_SetWindow(
NPP instance,
NPWindow *browser_window)
950 NPError result = NPERR_NO_ERROR;
952 PRINT(
"start of NPP_SetWindow\n");
954 if (instance == NULL)
955 return NPERR_INVALID_INSTANCE_ERROR;
958 PRINT(
"file name in SetWindow is %s\n", me->fName);
962 if ((NPSetWindowCallbackStruct *)(browser_window->ws_info) != NULL) {
963 me->display = ((NPSetWindowCallbackStruct *)
964 browser_window->ws_info)->display;
966 PRINT(
"NPP_SetWindow, plugin display now is %u\n", me->display);
971 if ((NPSetWindowCallbackStruct *)(browser_window->ws_info) != NULL) {
972 if ((me->display) != ((NPSetWindowCallbackStruct *)
973 browser_window->ws_info)->display) {
975 PRINT(
"HMMM - display has changed\n");
976 me->display = ((NPSetWindowCallbackStruct *)
977 browser_window->ws_info)->display;
981 PRINT(
"NPP_SetWindow, moz window is %u childPID is %u\n",
982 browser_window->window, me->childPID);
984 me->width = browser_window->width;
985 me->height = browser_window->height;
988 if (me->mozwindow != (Window) browser_window->window) {
989 me->mozwindow = (Window) browser_window->window;
992 if (!me->freewrl_running) {
994 PRINT(
"NPP_SetWindow, running FreeWRL here!\n");
996 if (!Run(instance)) {
997 PRINT(
"NPP_SetWindow, FreeWRL program failed!\n");
998 return NPERR_MODULE_LOAD_FAILED_ERROR;
1001 PRINT(
"NPP_SetWindow, returned from Run!\n");
1007 PRINT(
"xresize x %d y %d wid %d hei %d\n",
1008 me->x, me->y, me->width, me->height);
1010 XResizeWindow(me->display, me->fwwindow,
1011 me->width, me->height);
1013 XSync (me->display,FALSE);
1015 PRINT(
"exiting NPP_SetWindow\n");
1020 NPP_NewStream(
NPP instance,
1028 if (instance == NULL)
return NPERR_INVALID_INSTANCE_ERROR;
1030 if (stream->url == NULL)
return(NPERR_NO_DATA);
1032 if (currentStream == NULL) {
1033 currentStream = stream;
1035 PRINT(
"NPP_NewStream, currentstream NOT NULL\n");
1038 PRINT(
"NPP_NewStream, filename %s instance %p, type %s, "
1039 "stream %p, seekable %s stype %d\n",
1040 me->fName, instance, type,
1041 stream, BOOL_STR(seekable), (stype ? (*stype) : 0));
1043 RECORD_FILE_NAME_IF_NULL;
1046 if (!me->freewrl_running) {
1048 PRINT(
"NPP_NewStream, running FreeWRL here!\n");
1050 if (!Run(instance)) {
1051 PRINT(
"NPP_NewStream, FreeWRL program failed!\n");
1052 return NPERR_MODULE_LOAD_FAILED_ERROR;
1057 *stype = NP_ASFILEONLY;
1060 PRINT(
"NPP_NewStream returning noerror\n");
1061 return NPERR_NO_ERROR;
1076 int32 STREAMBUFSIZE = 0X0FFFFFFF;
1084 PRINT(
"NPP_WriteReady\n");
1086 return STREAMBUFSIZE;
1090 int32 NPP_Write(
NPP instance,
NPStream *stream, int32 offset, int32 len,
void *buffer)
1093 PRINT(
"NPP_Write\n");
1100 NPP_DestroyStream(
NPP instance,
NPStream *stream, NPError reason)
1104 PRINT(
"NPP_DestroyStream, instance %p stream %p\n",
1107 if (reason == NPRES_DONE) PRINT(
"reason: NPRES_DONE\n");
1108 if (reason == NPRES_USER_BREAK) PRINT(
"reason: NPRES_USER_BREAK\n");
1109 if (reason == NPRES_NETWORK_ERR) PRINT(
"reason: NPRES_NETWORK_ERR\n");
1111 if (stream == currentStream) {
1112 currentStream = NULL;
1114 PRINT(
"NPP_DestroyStream, STREAMS DO NOT MATCH!\n");
1117 if (instance == NULL)
1118 return NPERR_INVALID_INSTANCE_ERROR;
1119 return NPERR_NO_ERROR;
1124 NPP_StreamAsFile(
NPP instance,
NPStream *stream,
const char* fname)
1129 PRINT(
"NPP_StreamAsFile, start with fname %s\n", fname);
1131 if (instance != NULL) {
1134 RECORD_FILE_NAME_IF_NULL;
1136 if (!me->freewrl_running) {
1138 if (!Run(instance)) {
1139 PRINT(
"NPP_StreamAsFile, FreeWRL program failed!\n");
1145 if (fname == NULL) {
1146 PRINT(
"NPP_StreamAsFile has a NULL file\n");
1149 if (write(me->interfaceFile[SOCKET_1],
"", 1) < 0) {
1150 PRINT(
"Call to write failed\n");
1162 if (gotRequestFromFreeWRL) {
1163 bytes = (strlen(fname)+1)*
sizeof(
const char *);
1164 if (bytes > (me->cacheFileNameLen -10)) {
1165 if (me->cacheFileName != NULL) {
1166 NPN_MemFree(me->cacheFileName);
1169 me->cacheFileNameLen = bytes+20;
1170 me->cacheFileName = NPN_MemAlloc(me->cacheFileNameLen);
1173 memcpy (me->cacheFileName, fname, bytes);
1174 PRINT(
"NPP_StreamAsFile: saving name to cachename\n");
1176 PRINT(
"NPP_StreamAsFile: skipping file write, as gotRequestFromFreeWRL = FALSE\n");
1187 if(printInfo == NULL)
1190 if (instance != NULL) {
1192 if (printInfo->mode == NP_FULL) {
1216 printInfo->print.fullPrint.pluginPrinted = FALSE;