Merge change 9661

* changes:
  wifi: Strip trailing spaces before parsing RSSI results.
This commit is contained in:
Android (Google) Code Review
2009-08-04 09:33:44 -07:00

View File

@@ -324,6 +324,13 @@ static jint android_net_wifi_getRssiHelper(const char *cmd)
// number we're interested in. if we're associating, it returns "OK".
// beware - <SSID> can contain spaces.
if (strcmp(reply, "OK") != 0) {
// beware of trailing spaces
char* end = reply + strlen(reply);
while (end > reply && end[-1] == ' ') {
end--;
}
*end = 0;
char* lastSpace = strrchr(reply, ' ');
// lastSpace should be preceded by "rssi" and followed by the value
if (lastSpace && !strncmp(lastSpace - 4, "rssi", 4)) {