comparison libnnchat.c @ 395:74d97581dc46

Rename variable and function, internal use only.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2012 04:58:10 +0300
parents cabf2233ea39
children 07a46ca075ab
comparison
equal deleted inserted replaced
394:cabf2233ea39 395:74d97581dc46
356 356
357 void nn_conn_reset(nn_conn_t *conn) 357 void nn_conn_reset(nn_conn_t *conn)
358 { 358 {
359 if (conn != NULL) 359 if (conn != NULL)
360 { 360 {
361 conn->got_ptr = conn->buf; 361 conn->ptr = conn->in_ptr = conn->buf;
362 conn->got_bytes = conn->total_bytes = 0; 362 conn->got_bytes = conn->total_bytes = 0;
363 } 363 }
364 } 364 }
365 365
366 366
388 return -1; 388 return -1;
389 } 389 }
390 } 390 }
391 else if (FD_ISSET(conn->socket, &tmpfds)) 391 else if (FD_ISSET(conn->socket, &tmpfds))
392 { 392 {
393 conn->got_bytes = recv(conn->socket, conn->got_ptr, NN_CONNBUF_SIZE - conn->total_bytes, 0); 393 conn->got_bytes = recv(conn->socket, conn->in_ptr, NN_CONNBUF_SIZE - conn->total_bytes, 0);
394 if (conn->got_bytes < 0) 394 if (conn->got_bytes < 0)
395 { 395 {
396 conn->err = nn_get_socket_errno(); 396 conn->err = nn_get_socket_errno();
397 nn_conn_err(conn, "Error in recv: %d, %s\n", conn->err, nn_get_socket_errstr(conn->err)); 397 nn_conn_err(conn, "Error in recv: %d, %s\n", conn->err, nn_get_socket_errstr(conn->err));
398 return -2; 398 return -2;
404 return -3; 404 return -3;
405 } 405 }
406 else 406 else
407 { 407 {
408 conn->total_bytes += conn->got_bytes; 408 conn->total_bytes += conn->got_bytes;
409 conn->got_ptr += conn->got_bytes; 409 conn->in_ptr += conn->got_bytes;
410 return 0; 410 return 0;
411 } 411 }
412 } 412 }
413 413
414 return 1; 414 return 1;
489 489
490 return result; 490 return result;
491 } 491 }
492 492
493 493
494 static int getHexDigit(const int c, const int shift) 494 static int nn_get_hexdigit(const int c, const int shift)
495 { 495 {
496 int i; 496 int i;
497 497
498 if (c >= 'A' && c <= 'F') 498 if (c >= 'A' && c <= 'F')
499 i = c - 'A' + 10; 499 i = c - 'A' + 10;
544 544
545 case '%': 545 case '%':
546 s++; 546 s++;
547 if (*s == '%') 547 if (*s == '%')
548 PUSHCHAR('%'); 548 PUSHCHAR('%');
549 else if ((c = getHexDigit(*s, 4)) >= 0) 549 else if ((c = nn_get_hexdigit(*s, 4)) >= 0)
550 { 550 {
551 int i = getHexDigit(*(++s), 0); 551 int i = nn_get_hexdigit(*(++s), 0);
552 if (i >= 0) 552 if (i >= 0)
553 { 553 {
554 PUSHCHAR(c | i); 554 PUSHCHAR(c | i);
555 } 555 }
556 else 556 else