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

Side by Side Diff: base/debug/stack_trace_posix.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « base/debug/profiler.cc ('k') | base/debug/task_annotator.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/debug/stack_trace.h" 5 #include "base/debug/stack_trace.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 buf[0] = '\000'; 781 buf[0] = '\000';
782 return NULL; 782 return NULL;
783 } 783 }
784 784
785 char *start = buf; 785 char *start = buf;
786 786
787 uintptr_t j = i; 787 uintptr_t j = i;
788 788
789 // Handle negative numbers (only for base 10). 789 // Handle negative numbers (only for base 10).
790 if (i < 0 && base == 10) { 790 if (i < 0 && base == 10) {
791 j = -i; 791 // This does "j = -i" while avoiding integer overflow.
792 j = static_cast<uintptr_t>(-(i + 1)) + 1;
792 793
793 // Make sure we can write the '-' character. 794 // Make sure we can write the '-' character.
794 if (++n > sz) { 795 if (++n > sz) {
795 buf[0] = '\000'; 796 buf[0] = '\000';
796 return NULL; 797 return NULL;
797 } 798 }
798 *start++ = '-'; 799 *start++ = '-';
799 } 800 }
800 801
801 // Loop until we have converted the entire number. Output at least one 802 // Loop until we have converted the entire number. Output at least one
(...skipping 26 matching lines...) Expand all
828 *ptr = *start; 829 *ptr = *start;
829 *start++ = ch; 830 *start++ = ch;
830 } 831 }
831 return buf; 832 return buf;
832 } 833 }
833 834
834 } // namespace internal 835 } // namespace internal
835 836
836 } // namespace debug 837 } // namespace debug
837 } // namespace base 838 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/profiler.cc ('k') | base/debug/task_annotator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698