Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/platform-freebsd.cc

Issue 27089: Fixed lint errors.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/platform.h ('k') | src/platform-linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 640
641 641
642 virtual ~FreeBSDSocket() { 642 virtual ~FreeBSDSocket() {
643 if (IsValid()) { 643 if (IsValid()) {
644 // Close socket. 644 // Close socket.
645 close(socket_); 645 close(socket_);
646 } 646 }
647 } 647 }
648 648
649 // Server initialization. 649 // Server initialization.
650 bool Bind (const int port); 650 bool Bind(const int port);
651 bool Listen(int backlog) const; 651 bool Listen(int backlog) const;
652 Socket* Accept () const; 652 Socket* Accept() const;
653 653
654 // Client initialization. 654 // Client initialization.
655 bool Connect(const char* host, const char* port); 655 bool Connect(const char* host, const char* port);
656 656
657 // Data Transimission 657 // Data Transimission
658 int Send(const char* data, int len) const; 658 int Send(const char* data, int len) const;
659 bool SendAll(const char* data, int len) const; 659 bool SendAll(const char* data, int len) const;
660 int Receive(char* data, int len) const; 660 int Receive(char* data, int len) const;
661 661
662 bool IsValid() const { return socket_ != -1; } 662 bool IsValid() const { return socket_ != -1; }
663 663
664 private: 664 private:
665 int socket_; 665 int socket_;
666 }; 666 };
667 667
668 668
669 bool FreeBSDSocket::Bind(const int port) { 669 bool FreeBSDSocket::Bind(const int port) {
670 if (!IsValid()) { 670 if (!IsValid()) {
671 return false; 671 return false;
672 } 672 }
673 673
674 sockaddr_in addr; 674 sockaddr_in addr;
675 memset(&addr, 0, sizeof(addr)); 675 memset(&addr, 0, sizeof(addr));
676 addr.sin_family = AF_INET; 676 addr.sin_family = AF_INET;
677 addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 677 addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
678 addr.sin_port = htons(port); 678 addr.sin_port = htons(port);
679 int status = bind(socket_, 679 int status = bind(socket_,
680 reinterpret_cast<struct sockaddr *>(&addr), 680 reinterpret_cast<struct sockaddr *>(&addr),
681 sizeof (addr)); 681 sizeof(addr));
682 return status == 0; 682 return status == 0;
683 } 683 }
684 684
685 685
686 bool FreeBSDSocket::Listen(int backlog) const { 686 bool FreeBSDSocket::Listen(int backlog) const {
687 if (!IsValid()) { 687 if (!IsValid()) {
688 return false; 688 return false;
689 } 689 }
690 690
691 int status = listen(socket_, backlog); 691 int status = listen(socket_, backlog);
(...skipping 24 matching lines...) Expand all
716 struct addrinfo *result = NULL; 716 struct addrinfo *result = NULL;
717 struct addrinfo hints; 717 struct addrinfo hints;
718 memset(&hints, 0, sizeof(addrinfo)); 718 memset(&hints, 0, sizeof(addrinfo));
719 hints.ai_family = AF_INET; 719 hints.ai_family = AF_INET;
720 hints.ai_socktype = SOCK_STREAM; 720 hints.ai_socktype = SOCK_STREAM;
721 hints.ai_protocol = IPPROTO_TCP; 721 hints.ai_protocol = IPPROTO_TCP;
722 int status = getaddrinfo(host, port, &hints, &result); 722 int status = getaddrinfo(host, port, &hints, &result);
723 if (status != 0) { 723 if (status != 0) {
724 return false; 724 return false;
725 } 725 }
726 726
727 // Connect. 727 // Connect.
728 status = connect(socket_, result->ai_addr, result->ai_addrlen); 728 status = connect(socket_, result->ai_addr, result->ai_addrlen);
729 return status == 0; 729 return status == 0;
730 } 730 }
731 731
732 732
733 int FreeBSDSocket::Send(const char* data, int len) const { 733 int FreeBSDSocket::Send(const char* data, int len) const {
734 int status = send(socket_, data, len, 0); 734 int status = send(socket_, data, len, 0);
735 return status; 735 return status;
736 } 736 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 } 884 }
885 885
886 // This sampler is no longer the active sampler. 886 // This sampler is no longer the active sampler.
887 active_sampler_ = NULL; 887 active_sampler_ = NULL;
888 active_ = false; 888 active_ = false;
889 } 889 }
890 890
891 #endif // ENABLE_LOGGING_AND_PROFILING 891 #endif // ENABLE_LOGGING_AND_PROFILING
892 892
893 } } // namespace v8::internal 893 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698