~ubuntu-branches/ubuntu/edgy/rxtx/edgy-201105201527

« back to all changes in this revision

Viewing changes to src/RawImp.c

  • Committer: Bazaar Package Importer
  • Author(s): Mario Joussen
  • Date: 2006-03-01 18:56:52 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060301185652-ri9941gi01goklvz
Tags: 2.1.7-2
Fixed stupid bug in clean target.
(closes: Bug#354859)

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
/*-------------------------------------------------------------------------
8
8
|   rxtx is a native interface to i2c ports in java.
9
 
|   Copyright 1997-2002 by Trent Jarvi taj@www.linux.org.uk
 
9
|   Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk
10
10
|
11
11
|   This library is free software; you can redistribute it and/or
12
12
|   modify it under the terms of the GNU Library General Public
25
25
#ifdef __STRICT_ANSI__
26
26
#undef __STRICT_ANSI__
27
27
#endif
28
 
#if defined(__MWERKS__)//dima
 
28
#if defined(__MWERKS__)/* dima */
29
29
#include "Raw.h"
30
 
#else//dima
 
30
#else /* dima */
31
31
#include "config.h"
32
32
#include "gnu_io_Raw.h"
33
 
#endif//dima
 
33
#endif /* dima */
34
34
#include <unistd.h>
35
35
#include <time.h>
36
36
#include <stdio.h>
61
61
#       include <linux/serial.h>
62
62
#       include <linux/version.h>
63
63
#endif
64
 
#ifndef __APPLE__ //dima
 
64
#ifndef __APPLE__  /* dima */
65
65
#include <sys/io.h>
66
 
#endif//dima
 
66
#endif /* dima */
67
67
 
68
68
extern int errno;
69
69
#include "I2CImp.h"
194
194
   return:      none
195
195
   exceptions:  none
196
196
----------------------------------------------------------*/
197
 
//////////////////////////////////////////////////////////
198
 
// This Function is called from Java to write to an 32 bit bus
 
197
/*  This Function is called from Java to write to a 32 bit bus */
199
198
JNIEXPORT void JNICALL Java_Bus_write32
200
199
  (JNIEnv * env, jobject poObj, jint piPort, jint piData)
201
200
{
265
264
        int cspeed = translate_speed( env, speed );
266
265
        if( !cspeed ) return;
267
266
        if( tcgetattr( fd, &ttyset ) < 0 ) goto fail;
268
 
        if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return;//dima c_flag darwin unsigned long
269
 
        if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return;//dima c_flag darwin unsigned long
270
 
        if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;//dima c_flag darwin unsigned long
 
267
        if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return; /* dima c_flag darwin unsigned long */
 
268
        if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return; /* dima c_flag darwin unsigned long */
 
269
        if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;/* dima c_flag darwin unsigned long */
271
270
#ifdef __FreeBSD__
272
271
        if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail;
273
272
#else
906
905
        int fd = get_java_var( env, jobj, "fd", "I" );
907
906
        int timeout = get_java_var( env, jobj, "timeout", "I" );
908
907
 
909
 
        if( length > SSIZE_MAX || length < 0 ) {
 
908
        if( (size_t) length > SSIZE_MAX || (size_t) length < 0 ) {
910
909
                throw_java_exception( env, ARRAY_INDEX_OUT_OF_BOUNDS,
911
910
                        "readArray", "Invalid length" );
912
911
                return -1;
1027
1026
        jboolean interrupted = 0;
1028
1027
        jclass jclazz, jthread;
1029
1028
        jclazz = (*env)->GetObjectClass( env, jobj );
1030
 
        fd = fd = get_java_var(env, jobj, "fd", "I");
 
1029
        fd = get_java_var(env, jobj, "fd", "I");
1031
1030
        method = (*env)->GetMethodID( env, jclazz, "sendEvent", "(IZ)V" );
1032
1031
        jthread = (*env)->FindClass( env, "java/lang/Thread" );
1033
1032
        interrupt = (*env)->GetStaticMethodID( env, jthread, "interrupted", "()Z" );