Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
w16callb.c File Reference
#include "primpl.h"
#include "windowsx.h"

Go to the source code of this file.

Functions

void PR_MDRegisterCallbacks (struct PRMethodCallbackStr *f)
int PR_MD_printf (const char *fmt,...)
int PR_MD_sscanf (const char *buf, const char *fmt,...)
size_t PR_MD_strftime (char *s, size_t len, const char *fmt, const struct tm *p)
voidPR_MD_malloc (size_t size)
voidPR_MD_calloc (size_t n, size_t size)
voidPR_MD_realloc (void *old_blk, size_t size)
void PR_MD_free (void *ptr)
char * PR_MD_getenv (const char *name)
void PR_MD_perror (const char *prefix)
int PR_MD_putenv (const char *assoc)
int PR_MD_fprintf (FILE *fPtr, const char *fmt,...)

Variables

struct PRMethodCallbackStr * _pr_callback_funcs

Function Documentation

void* PR_MD_calloc ( size_t  n,
size_t  size 
)

Definition at line 147 of file w16callb.c.

{
    void *p;
    size_t sz;
    
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->calloc)( n, size );
    } else {
        sz = n * size;
        p = GlobalAllocPtr(GPTR, (DWORD)sz );
        memset( p, 0x00, sz );
        return p;
    }
} /* end calloc() */

Here is the call graph for this function:

int PR_MD_fprintf ( FILE fPtr,
const char *  fmt,
  ... 
)

Definition at line 234 of file w16callb.c.

{
    char buffer[1024];
    va_list args;

    va_start(args, fmt);
    PR_vsnprintf(buffer, sizeof(buffer), fmt, args);

    if (fPtr == NULL) 
    {
        if (_pr_callback_funcs != NULL && _pr_callback_funcs->auxOutput != NULL) 
        {
            (* _pr_callback_funcs->auxOutput)(buffer);
        } 
        else 
        {
            OutputDebugString(buffer);
        }
    } 
    else 
    {
        fwrite(buffer, 1, strlen(buffer), fPtr); /* XXX Is this a sec. hole? */
    }

    va_end(args);
    return 0;
}

Here is the call graph for this function:

void PR_MD_free ( void ptr)

Definition at line 179 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        (*_pr_callback_funcs->free)( ptr );
        return;
    } else {
        GlobalFreePtr( ptr );
        return;
    }
} /* end free() */

Here is the caller graph for this function:

char* PR_MD_getenv ( const char *  name)

Definition at line 194 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->getenv)( name );
    } else {
        return 0;
    }
} /* end getenv() */
void* PR_MD_malloc ( size_t  size)

Definition at line 134 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->malloc)( size );
    } else {
        return GlobalAllocPtr(GPTR, (DWORD)size);
    }
} /* end malloc() */

Here is the caller graph for this function:

void PR_MD_perror ( const char *  prefix)

Definition at line 211 of file w16callb.c.

{
    return;
} /* end perror() */
int PR_MD_printf ( const char *  fmt,
  ... 
)

Definition at line 77 of file w16callb.c.

{
    char buffer[1024];
    int ret = 0;
    va_list args;

    va_start(args, fmt);

#ifdef DEBUG
    PR_vsnprintf(buffer, sizeof(buffer), fmt, args);
    {   
        if (_pr_callback_funcs != NULL && _pr_callback_funcs->auxOutput != NULL) {
            (* _pr_callback_funcs->auxOutput)(buffer);
        } else {
            OutputDebugString(buffer);
        }
    }
#endif

    va_end(args);
    return ret;
}
int PR_MD_putenv ( const char *  assoc)

Definition at line 220 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->putenv)(assoc);
    } else {
        PR_ASSERT(0);
        return NULL;
    }
}
void* PR_MD_realloc ( void old_blk,
size_t  size 
)

Definition at line 166 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->realloc)( old_blk, size );
    } else {
        return GlobalReAllocPtr( old_blk, (DWORD)size, GPTR);
    }
} /* end realloc */
int PR_MD_sscanf ( const char *  buf,
const char *  fmt,
  ... 
)

Definition at line 104 of file w16callb.c.

{
       int           retval;
       va_list       arglist;

       va_start(arglist, fmt);
       retval = vsscanf((const unsigned char *)buf, (const unsigned char *)fmt, arglist);
       va_end(arglist);
       return retval;
}
size_t PR_MD_strftime ( char *  s,
size_t  len,
const char *  fmt,
const struct tm p 
)

Definition at line 119 of file w16callb.c.

{
    if( _pr_callback_funcs ) {
        return (*_pr_callback_funcs->strftime)(s, len, fmt, p);
    } else {
        PR_ASSERT(0);
        return 0;
    }
}
void PR_MDRegisterCallbacks ( struct PRMethodCallbackStr *  f)

Definition at line 64 of file w16callb.c.


Variable Documentation

struct PRMethodCallbackStr* _pr_callback_funcs

Definition at line 58 of file w16callb.c.