am 71119048: Merge change 23949 into eclair

Merge commit '7111904802934e1fa4cf68c445f13c34c30c9cdb' into eclair-plus-aosp

* commit '7111904802934e1fa4cf68c445f13c34c30c9cdb':
  GPS: Fix race condition reporting NMEA data.
This commit is contained in:
Eddie Ho
2009-09-04 04:50:59 -07:00
committed by Android Git Automerger

View File

@@ -370,14 +370,14 @@ static jint android_location_GpsLocationProvider_read_sv_status(JNIEnv* env, job
static jint android_location_GpsLocationProvider_read_nmea(JNIEnv* env, jobject obj, jint index, jbyteArray nmeaArray, jint buffer_size)
{
// this should only be called from within a call to reportStatus, so we don't need to lock here
// this should only be called from within a call to reportNmea, so we don't need to lock here
jbyte* nmea = env->GetByteArrayElements(nmeaArray, 0);
int length = strlen(sNmeaBuffer[index].nmea);
int length = strlen(sNmeaBufferCopy[index].nmea);
if (length > buffer_size)
length = buffer_size;
memcpy(nmea, sNmeaBuffer[index].nmea, length);
memcpy(nmea, sNmeaBufferCopy[index].nmea, length);
env->ReleaseByteArrayElements(nmeaArray, nmea, 0);
return length;