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

Side by Side Diff: source/tools/toolutil/ucbuf.c

Issue 845603002: Update ICU to 54.1 step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@master
Patch Set: remove unusued directories Created 5 years, 11 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 | « source/tools/toolutil/toolutil.vcxproj ('k') | source/tools/toolutil/ucln_tu.c » ('j') | 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 ******************************************************************************* 2 *******************************************************************************
3 * 3 *
4 * Copyright (C) 1998-2011, International Business Machines 4 * Copyright (C) 1998-2014, International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * 8 *
9 * File ucbuf.c 9 * File ucbuf.c
10 * 10 *
11 * Modification History: 11 * Modification History:
12 * 12 *
13 * Date Name Description 13 * Date Name Description
14 * 05/10/01 Ram Creation. 14 * 05/10/01 Ram Creation.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 int32_t offset=0; 169 int32_t offset=0;
170 const char* sourceLimit =NULL; 170 const char* sourceLimit =NULL;
171 int32_t cbufSize=0; 171 int32_t cbufSize=0;
172 pTarget = buf->buffer; 172 pTarget = buf->buffer;
173 /* check if we arrived here without exhausting the buffer*/ 173 /* check if we arrived here without exhausting the buffer*/
174 if(buf->currentPos<buf->bufLimit){ 174 if(buf->currentPos<buf->bufLimit){
175 offset = (int32_t)(buf->bufLimit-buf->currentPos); 175 offset = (int32_t)(buf->bufLimit-buf->currentPos);
176 memmove(buf->buffer,buf->currentPos,offset* sizeof(UChar)); 176 memmove(buf->buffer,buf->currentPos,offset* sizeof(UChar));
177 } 177 }
178 178
179 #if DEBUG 179 #if UCBUF_DEBUG
180 memset(pTarget+offset,0xff,sizeof(UChar)*(MAX_IN_BUF-offset)); 180 memset(pTarget+offset,0xff,sizeof(UChar)*(MAX_IN_BUF-offset));
181 #endif 181 #endif
182 if(buf->isBuffered){ 182 if(buf->isBuffered){
183 cbufSize = MAX_IN_BUF; 183 cbufSize = MAX_IN_BUF;
184 /* read the file */ 184 /* read the file */
185 inputRead=T_FileStream_read(buf->in,cbuf,cbufSize-offset); 185 inputRead=T_FileStream_read(buf->in,cbuf,cbufSize-offset);
186 buf->remaining-=inputRead; 186 buf->remaining-=inputRead;
187 187
188 }else{ 188 }else{
189 cbufSize = T_FileStream_size(buf->in); 189 cbufSize = T_FileStream_size(buf->in);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 source = cbuf; 286 source = cbuf;
287 287
288 /* re convert */ 288 /* re convert */
289 ucnv_toUnicode(buf->conv,&target,target+(buf->bufCapacity-offset), 289 ucnv_toUnicode(buf->conv,&target,target+(buf->bufCapacity-offset),
290 &source,sourceLimit,NULL, 290 &source,sourceLimit,NULL,
291 (UBool)(buf->remaining==0),&error1); 291 (UBool)(buf->remaining==0),&error1);
292 292
293 } 293 }
294 outputWritten = (int32_t)(target - pTarget); 294 outputWritten = (int32_t)(target - pTarget);
295 295
296 296 #if UCBUF_DEBUG
297 #if DEBUG
298 { 297 {
299 int i; 298 int i;
300 target = pTarget; 299 target = pTarget;
301 for(i=0;i<numRead;i++){ 300 for(i=0;i<numRead;i++){
302 /* printf("%c", (char)(*target++));*/ 301 /* printf("%c", (char)(*target++));*/
303 } 302 }
304 } 303 }
305 #endif 304 #endif
306 305
307 }else{ 306 }else{
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 ucbuf_fillucbuf(buf,err); 731 ucbuf_fillucbuf(buf,err);
733 if(U_FAILURE(*err)){ 732 if(U_FAILURE(*err)){
734 return NULL; 733 return NULL;
735 } 734 }
736 } 735 }
737 /* 736 /*
738 * Accoding to TR 13 readLine functions must interpret 737 * Accoding to TR 13 readLine functions must interpret
739 * CR, CR+LF, LF, NEL, PS, LS or FF as line seperators 738 * CR, CR+LF, LF, NEL, PS, LS or FF as line seperators
740 */ 739 */
741 /* Windows CR LF */ 740 /* Windows CR LF */
742 if(c ==0x0d && temp+1<=buf->bufLimit && *(temp+1) == 0x0a ){ 741 if(c ==0x0d && temp <= buf->bufLimit && *temp == 0x0a ){
743 *len = (int32_t)(temp++ - buf->currentPos); 742 *len = (int32_t)(temp++ - buf->currentPos);
744 savePos = buf->currentPos; 743 savePos = buf->currentPos;
745 buf->currentPos = temp; 744 buf->currentPos = temp;
746 return savePos; 745 return savePos;
747 } 746 }
748 /* else */ 747 /* else */
749 748
750 if (temp>=buf->bufLimit|| ucbuf_isCharNewLine(c)){ /* Unipad insert s 2028 line separators! */ 749 if (temp>=buf->bufLimit|| ucbuf_isCharNewLine(c)){ /* Unipad insert s 2028 line separators! */
751 *len = (int32_t)(temp - buf->currentPos); 750 *len = (int32_t)(temp - buf->currentPos);
752 savePos = buf->currentPos; 751 savePos = buf->currentPos;
753 buf->currentPos = temp; 752 buf->currentPos = temp;
754 return savePos; 753 return savePos;
755 } 754 }
756 } 755 }
757 }else{ 756 }else{
758 /* we know that all input is read into the internal 757 /* we know that all input is read into the internal
759 * buffer so we can safely return pointers 758 * buffer so we can safely return pointers
760 */ 759 */
761 for(;;){ 760 for(;;){
762 c = *temp++; 761 c = *temp++;
763 762
764 if(buf->currentPos==buf->bufLimit){ 763 if(buf->currentPos==buf->bufLimit){
765 return NULL; /* end of file is reached return NULL */ 764 return NULL; /* end of file is reached return NULL */
766 } 765 }
767 /* Windows CR LF */ 766 /* Windows CR LF */
768 if(c ==0x0d && temp+1<=buf->bufLimit && *(temp+1) == 0x0a ){ 767 if(c ==0x0d && temp <= buf->bufLimit && *temp == 0x0a ){
769 *len = (int32_t)(temp++ - buf->currentPos); 768 *len = (int32_t)(temp++ - buf->currentPos);
770 savePos = buf->currentPos; 769 savePos = buf->currentPos;
771 buf->currentPos = temp; 770 buf->currentPos = temp;
772 return savePos; 771 return savePos;
773 } 772 }
774 /* else */ 773 /* else */
775 if (temp>=buf->bufLimit|| ucbuf_isCharNewLine(c)) { /* Unipad inser ts 2028 line separators! */ 774 if (temp>=buf->bufLimit|| ucbuf_isCharNewLine(c)) { /* Unipad inser ts 2028 line separators! */
776 *len = (int32_t)(temp - buf->currentPos); 775 *len = (int32_t)(temp - buf->currentPos);
777 savePos = buf->currentPos; 776 savePos = buf->currentPos;
778 buf->currentPos = temp; 777 buf->currentPos = temp;
779 return savePos; 778 return savePos;
780 } 779 }
781 } 780 }
782 } 781 }
783 /* not reached */ 782 /* not reached */
784 /* A compiler warning will appear if all paths don't contain a return statem ent. */ 783 /* A compiler warning will appear if all paths don't contain a return statem ent. */
785 /* return NULL;*/ 784 /* return NULL;*/
786 } 785 }
787 #endif 786 #endif
OLDNEW
« no previous file with comments | « source/tools/toolutil/toolutil.vcxproj ('k') | source/tools/toolutil/ucln_tu.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698