OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [java/] [net/] [protocol/] [core/] [natCoreInputStream.cc] - Blame information for rev 756

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
// natCoreInputStream.cc -- C++ side of CoreInputStream
2
 
3
/* Copyright (C) 2001  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
/* Author: Anthony Green <green@redhat.com>.  */
12
 
13
#include <config.h>
14
 
15
#include <gcj/cni.h>
16
#include <jvm.h>
17
#include <string.h>
18
 
19
#include <java/lang/NullPointerException.h>
20
#include <java/lang/ArrayIndexOutOfBoundsException.h>
21
#include <gnu/java/net/protocol/core/CoreInputStream.h>
22
 
23
jint
24
gnu::java::net::protocol::core::CoreInputStream::unsafeGetByte (jlong offset)
25
{
26
  return ((char*) ptr) [offset];
27
}
28
 
29
jint
30
gnu::java::net::protocol::core::CoreInputStream::copyIntoByteArray (jbyteArray dest,
31
                                                                    jint offset,
32
                                                                    jint numBytes)
33
{
34
  if (!dest)
35
    throw new ::java::lang::NullPointerException;
36
 
37
  jsize destSize = JvGetArrayLength (dest);
38
 
39
  if (offset < 0 || numBytes < 0 || offset + numBytes < 0
40
      || offset + numBytes > destSize
41
      || pos + numBytes > count)
42
    throw new ::java::lang::ArrayIndexOutOfBoundsException;
43
 
44
  void *pcore = (void *) &((char*) ptr) [pos];
45
  void *pdest = (void *) (elements (dest) + offset);
46
 
47
  memcpy (pdest, pcore, numBytes);
48
 
49
  return 0;
50
}
51
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.