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

Side by Side Diff: third_party/libxml/src/xmlstring.c

Issue 1886903003: Workaround for VC++ 2015 Update 2 code-gen bug (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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 | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * string.c : an XML string utilities module 2 * string.c : an XML string utilities module
3 * 3 *
4 * This module provides various utility functions for manipulating 4 * This module provides various utility functions for manipulating
5 * the xmlChar* type. All functions named xmlStr* have been moved here 5 * the xmlChar* type. All functions named xmlStr* have been moved here
6 * from the parser.c file (their original home). 6 * from the parser.c file (their original home).
7 * 7 *
8 * See Copyright for the status of this software. 8 * See Copyright for the status of this software.
9 * 9 *
10 * UTF8 string routines from: 10 * UTF8 string routines from:
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 * @utf: a sequence of UTF-8 encoded bytes 814 * @utf: a sequence of UTF-8 encoded bytes
815 * @len: the number of characters in the array 815 * @len: the number of characters in the array
816 * 816 *
817 * storage size of an UTF8 string 817 * storage size of an UTF8 string
818 * the behaviour is not garanteed if the input string is not UTF-8 818 * the behaviour is not garanteed if the input string is not UTF-8
819 * 819 *
820 * Returns the storage size of 820 * Returns the storage size of
821 * the first 'len' characters of ARRAY 821 * the first 'len' characters of ARRAY
822 */ 822 */
823 823
824 #if _MSC_FULL_VER && _MSC_FULL_VER == 190023918
825 // Workaround for a /O1 ("s") optimization bug in VS 2015 Update 2, remove once
826 // the fix is released. crbug.com/599427
827 // https://connect.microsoft.com/VisualStudio/feedback/details/2582138
828 #pragma optimize("t", on)
829 #endif
830
824 int 831 int
825 xmlUTF8Strsize(const xmlChar *utf, int len) { 832 xmlUTF8Strsize(const xmlChar *utf, int len) {
826 const xmlChar *ptr=utf; 833 const xmlChar *ptr=utf;
827 xmlChar ch; 834 xmlChar ch;
828 835
829 if (utf == NULL) 836 if (utf == NULL)
830 return(0); 837 return(0);
831 838
832 if (len <= 0) 839 if (len <= 0)
833 return(0); 840 return(0);
834 841
835 while ( len-- > 0) { 842 while ( len-- > 0) {
836 if ( !*ptr ) 843 if ( !*ptr )
837 break; 844 break;
838 if ( (ch = *ptr++) & 0x80) 845 if ( (ch = *ptr++) & 0x80)
839 while ((ch<<=1) & 0x80 ) { 846 while ((ch<<=1) & 0x80 ) {
840 ptr++; 847 ptr++;
841 if (*ptr == 0) break; 848 if (*ptr == 0) break;
842 } 849 }
843 } 850 }
844 return (ptr - utf); 851 return (ptr - utf);
845 } 852 }
846 853
854 #if _MSC_FULL_VER && _MSC_FULL_VER == 190023918
855 // Restore the original optimization settings.
856 #pragma optimize("", on)
857 #endif
847 858
848 /** 859 /**
849 * xmlUTF8Strndup: 860 * xmlUTF8Strndup:
850 * @utf: the input UTF8 * 861 * @utf: the input UTF8 *
851 * @len: the len of @utf (in chars) 862 * @len: the len of @utf (in chars)
852 * 863 *
853 * a strndup for array of UTF8's 864 * a strndup for array of UTF8's
854 * 865 *
855 * Returns a new UTF8 * or NULL 866 * Returns a new UTF8 * or NULL
856 */ 867 */
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 if ( (*utf++ & 0xc0) != 0x80 ) 986 if ( (*utf++ & 0xc0) != 0x80 )
976 return(NULL); 987 return(NULL);
977 } 988 }
978 } 989 }
979 990
980 return(xmlUTF8Strndup(utf, len)); 991 return(xmlUTF8Strndup(utf, len));
981 } 992 }
982 993
983 #define bottom_xmlstring 994 #define bottom_xmlstring
984 #include "elfgcchack.h" 995 #include "elfgcchack.h"
OLDNEW
« no previous file with comments | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698