LCOV - code coverage report
Current view: top level - gutils - giothread.c (source / functions) Hit Total Coverage
Test: FontForge coverage report 2017-08-04 01:21:11+02:00 (commit d35f7e4107a9e1db65cce47c468fcc914cecb8fd) Lines: 0 35 0.0 %
Date: 2017-08-04 Functions: 0 6 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2000-2012 by George Williams */
       2             : /*
       3             :  * Redistribution and use in source and binary forms, with or without
       4             :  * modification, are permitted provided that the following conditions are met:
       5             : 
       6             :  * Redistributions of source code must retain the above copyright notice, this
       7             :  * list of conditions and the following disclaimer.
       8             : 
       9             :  * Redistributions in binary form must reproduce the above copyright notice,
      10             :  * this list of conditions and the following disclaimer in the documentation
      11             :  * and/or other materials provided with the distribution.
      12             : 
      13             :  * The name of the author may not be used to endorse or promote products
      14             :  * derived from this software without specific prior written permission.
      15             : 
      16             :  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
      17             :  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
      18             :  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
      19             :  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
      20             :  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
      21             :  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
      22             :  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
      23             :  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      24             :  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
      25             :  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
      26             :  */
      27             : #include "giofuncP.h"
      28             : #include "gfile.h"
      29             : #include "ustring.h"
      30             : #include "gresource.h"
      31             : #include "errno.h"
      32             : 
      33             : #include <stdarg.h>
      34             : #include <stdio.h>
      35             : 
      36             : #ifndef HAVE_PTHREAD_H
      37             : void _GIO_ReportHeaders(char *format, ...) {
      38             :     va_list args;
      39             : 
      40             :     va_start(args,format);
      41             :     vfprintf( stderr, format, args);
      42             :     va_end(args);
      43             : }
      44             : 
      45             : void _GIO_PostError(GIOControl *gc) {
      46             :     gc->receiveerror(gc);
      47             : }
      48             : 
      49             : void _GIO_PostInter(GIOControl *gc) {
      50             :     gc->receiveintermediate(gc);
      51             : }
      52             : 
      53             : void _GIO_PostSuccess(GIOControl *gc) {
      54             :     gc->receivedata(gc);
      55             : }
      56             : 
      57             : static void _GIO_AuthorizationWrapper(void *d) {
      58             :     GIOControl *gc = d;
      59             : 
      60             :     (_GIO_stdfuncs.getauth)(gc);
      61             : }
      62             :     
      63             : void _GIO_RequestAuthorization(GIOControl *gc) {
      64             : 
      65             :     gc->return_code = 401;
      66             :     if ( _GIO_stdfuncs.getauth==NULL )
      67             : return;
      68             :     _GIO_AuthorizationWrapper(gc);
      69             : }
      70             : #else
      71           0 : void _GIO_ReportHeaders(char *format, ...) {
      72             :     static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
      73             :     va_list args;
      74             : 
      75           0 :     va_start(args,format);
      76           0 :     pthread_mutex_lock(&mutex);
      77           0 :     vfprintf( stderr, format, args);
      78           0 :     pthread_mutex_unlock(&mutex);
      79           0 :     va_end(args);
      80           0 : }
      81             : 
      82           0 : void _GIO_PostError(GIOControl *gc) {
      83           0 :     if ( _GIO_stdfuncs.gdraw_sync_thread!=NULL )
      84           0 :         (_GIO_stdfuncs.gdraw_sync_thread)(NULL,(void (*)(void *)) gc->receiveerror,gc);
      85           0 : }
      86             : 
      87           0 : void _GIO_PostInter(GIOControl *gc) {
      88           0 :     if ( _GIO_stdfuncs.gdraw_sync_thread!=NULL )
      89           0 :         (_GIO_stdfuncs.gdraw_sync_thread)(NULL,(void (*)(void *)) gc->receiveintermediate,gc);
      90           0 : }
      91             : 
      92           0 : void _GIO_PostSuccess(GIOControl *gc) {
      93           0 :     if ( _GIO_stdfuncs.gdraw_sync_thread!=NULL )
      94           0 :         (_GIO_stdfuncs.gdraw_sync_thread)(NULL,(void (*)(void *)) gc->receivedata,gc);
      95           0 : }
      96             : 
      97           0 : static void _GIO_AuthorizationWrapper(void *d) {
      98           0 :     GIOControl *gc = d;
      99             : 
     100           0 :     (_GIO_stdfuncs.getauth)(gc);
     101           0 :     pthread_mutex_lock(&gc->threaddata->mutex);
     102           0 :     pthread_cond_signal(&gc->threaddata->cond);
     103           0 :     pthread_mutex_unlock(&gc->threaddata->mutex);
     104           0 : }
     105             :     
     106           0 : void _GIO_RequestAuthorization(GIOControl *gc) {
     107             : 
     108           0 :     gc->return_code = 401;
     109           0 :     if ( _GIO_stdfuncs.getauth==NULL )
     110           0 : return;
     111           0 :     pthread_mutex_lock(&gc->threaddata->mutex);
     112           0 :     if ( _GIO_stdfuncs.gdraw_sync_thread!=NULL )
     113           0 :         (_GIO_stdfuncs.gdraw_sync_thread)(NULL,_GIO_AuthorizationWrapper,gc);
     114           0 :     pthread_cond_wait(&gc->threaddata->cond,&gc->threaddata->mutex);
     115           0 :     pthread_mutex_unlock(&gc->threaddata->mutex);
     116             : }
     117             : #endif

Generated by: LCOV version 1.10