示例#1
0
static sw_blob_result blobdata_file_create(OBJECT *file,
                                           blobdata_private_t **data)
{
  blobdata_private_t *state ;

  UNUSED_PARAM(OBJECT *, file) ;

  HQASSERT(oType(*file) == OFILE, "Blob data source is not a file") ;
  HQASSERT(data, "Nowhere for private data") ;

  if ( (state = (blobdata_private_t *)mm_alloc(mm_pool_temp,
                                              sizeof(blobdata_private_t),
                                              MM_ALLOC_CLASS_BLOB_DATA)) == NULL )
    return FAILURE(SW_BLOB_ERROR_MEMORY) ;

  state->dev = NULL ;
  state->fhandle = -1 ;
  state->isopen = FALSE ;
  state->length_ok = FALSE ;
  Hq32x2FromUint32(&state->length, 0) ;
  state->encrypted = FALSE ;
  state->hqxoffset = 0 ;
  state->hqxtail = 0 ;
  state->mode = 0 ;
  NAME_OBJECT(state, BLOBDATA_PRIVATE_NAME) ;
  *data = state ;

  return SW_BLOB_OK ;
}
示例#2
0
int32 Hq32x2CompareUint32( Hq32x2 * p32x2A, uint32 ui32 )
{
  Hq32x2        tmp;

  Hq32x2FromUint32( &tmp, ui32 );
  return Hq32x2Compare( p32x2A, &tmp );
}
示例#3
0
/*
 * Binary functions on a 64 bit value and a uint32
 */
void Hq32x2AddUint32( Hq32x2 * p32x2Result, Hq32x2 * p32x2A, uint32 ui32 )
{
  Hq32x2        tmp;

  Hq32x2FromUint32( &tmp, ui32 );
  Hq32x2Add( p32x2Result, p32x2A, &tmp );
}
示例#4
0
void Hq32x2SubtractUint32
 ( Hq32x2 * p32x2Result, Hq32x2 * p32x2A, uint32 ui32 )
{
  Hq32x2        tmp;

  Hq32x2FromUint32( &tmp, ui32 );
  Hq32x2Subtract( p32x2Result, p32x2A, &tmp );
}
示例#5
0
static void dll_u_frewind(const void *context, void *filestream)
{
  DEVICELIST *os ;
  DEVICETYPE *dev ;
  int32 *last_error = (int32 *)context ;
  DEVICE_FILEDESCRIPTOR handle = Dll_PtrToHandle(filestream) ;
  Hq32x2 where ;

  HQTRACE(!swstart_called,
          ("ICU frewind() called before SwStart()")) ;

  if ( !os_device(&os, &dev) || handle < 0 ) {
    *last_error = TRUE ;
    return ;
  }

  Hq32x2FromUint32(&where, 0) ;
  if ( (*dev->seek_file)(os, handle, &where, SW_SET) < 0 ) {
    *last_error = ((*dev->last_error)(os) != DeviceNoError) ;
    return ;
  }

  *last_error = FALSE ;
}