Hello,
On Tue, Jan 22, 2013 at 11:00 AM, Enlightenment SVN < [email protected]> wrote: > Log: > efl: deprecate eina_unicode_utf8_get_next, add eina_unicode_utf8_next_get. > I am just curious why you did not change eina_unicode_utf8_get_prev as well? Daniel Juyung Seo (SeoZ) > > > Author: cedric > Date: 2013-01-21 18:00:55 -0800 (Mon, 21 Jan 2013) > New Revision: 83048 > Trac: http://trac.enlightenment.org/e/changeset/83048 > > Modified: > trunk/efl/src/lib/eina/eina_abi.c > trunk/efl/src/lib/eina/eina_inline_unicode.x > trunk/efl/src/lib/eina/eina_unicode.c trunk/efl/src/lib/eina/eina_unicode.h > trunk/elementary/src/lib/elm_entry.c trunk/terminology/src/bin/termpty.c > > Modified: trunk/efl/src/lib/eina/eina_abi.c > =================================================================== > --- trunk/efl/src/lib/eina/eina_abi.c 2013-01-21 22:51:26 UTC (rev 83047) > +++ trunk/efl/src/lib/eina/eina_abi.c 2013-01-22 02:00:55 UTC (rev 83048) > @@ -22,6 +22,7 @@ > > #include "eina_config.h" > #include "eina_private.h" > +#include "eina_unicode.h" > #include "eina_safety_checks.h" > > #if EINA_SIZEOF_WCHAR_T >= 4 > @@ -32,55 +33,12 @@ > typedef uint32_t Eina_Unicode; > #endif > > -EAPI Eina_Unicode > -_eina_unicode_utf8_get_next(int ind, > - unsigned char d, > - const char *buf, > - int *iindex); > - > #define ERROR_REPLACEMENT_BASE 0xDC80 > #define EINA_IS_INVALID_BYTE(x) ((x == 192) || (x == 193) || (x >= > 245)) > #define EINA_IS_CONTINUATION_BYTE(x) ((x & 0xC0) == 0x80) > > EAPI Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int *iindex) > { > - int ind; > - Eina_Unicode r; > - unsigned char d; > - > - EINA_SAFETY_ON_NULL_RETURN_VAL(buf, 0); > - EINA_SAFETY_ON_NULL_RETURN_VAL(iindex, 0); > - > - ind = *iindex; > - > - /* if this char is the null terminator, exit */ > - if ((d = buf[ind++]) == 0) return 0; > - > - if ((d & 0x80) == 0) > - { // 1 byte (7bit) - 0xxxxxxx > - *iindex = ind; > - return d; > - } > - > - if ((d & 0xe0) == 0xc0) > - { // 2 byte (11bit) - 110xxxxx 10xxxxxx > - r = (d & 0x1f) << 6; > - if (((d = buf[ind++]) == 0) || EINA_IS_INVALID_BYTE(d) || > - !EINA_IS_CONTINUATION_BYTE(d)) goto error; > - r |= (d & 0x3f); > - if (r <= 0x7F) goto error; > - *iindex = ind; > - return r; > - } > - > - return _eina_unicode_utf8_get_next(ind, d, buf, iindex); > - > -/* Gets here where there was an error and we want to replace the char > - * we just use the invalid unicode codepoints 8 lower bits represent > - * the original char */ > -error: > - d = buf[*iindex]; > - (*iindex)++; > - return ERROR_REPLACEMENT_BASE | d; > + return eina_unicode_utf8_next_get(buf, iindex); > } > > > Modified: trunk/efl/src/lib/eina/eina_inline_unicode.x > =================================================================== > --- trunk/efl/src/lib/eina/eina_inline_unicode.x 2013-01-21 > 22:51:26 UTC (rev 83047) > +++ trunk/efl/src/lib/eina/eina_inline_unicode.x 2013-01-22 > 02:00:55 UTC (rev 83048) > @@ -21,7 +21,7 @@ > > #include "eina_safety_checks.h" > > -EAPI Eina_Unicode _eina_unicode_utf8_get_next(int ind, > +EAPI Eina_Unicode _eina_unicode_utf8_next_get(int ind, > unsigned char d, > const char *buf, > int *iindex); > @@ -31,7 +31,7 @@ > #define EINA_IS_CONTINUATION_BYTE(x) ((x & 0xC0) == 0x80) > > static inline Eina_Unicode > -eina_unicode_utf8_get_next(const char *buf, int *iindex) > +eina_unicode_utf8_next_get(const char *buf, int *iindex) > { > int ind; > Eina_Unicode r; > @@ -62,7 +62,7 @@ > return r; > } > > - return _eina_unicode_utf8_get_next(ind, d, buf, iindex); > + return _eina_unicode_utf8_next_get(ind, d, buf, iindex); > > /* Gets here where there was an error and we want to replace the char > * we just use the invalid unicode codepoints 8 lower bits represent > > Modified: trunk/efl/src/lib/eina/eina_unicode.c > =================================================================== > --- trunk/efl/src/lib/eina/eina_unicode.c 2013-01-21 22:51:26 UTC > (rev 83047) > +++ trunk/efl/src/lib/eina/eina_unicode.c 2013-01-22 02:00:55 UTC > (rev 83048) > @@ -188,7 +188,7 @@ > #define ERROR_REPLACEMENT_END 0xDCFF > > EAPI Eina_Unicode > -_eina_unicode_utf8_get_next(int ind, > +_eina_unicode_utf8_next_get(int ind, > unsigned char d, > const char *buf, > int *iindex) > > Modified: trunk/efl/src/lib/eina/eina_unicode.h > =================================================================== > --- trunk/efl/src/lib/eina/eina_unicode.h 2013-01-21 22:51:26 UTC > (rev 83047) > +++ trunk/efl/src/lib/eina/eina_unicode.h 2013-01-22 02:00:55 UTC > (rev 83048) > @@ -122,9 +122,24 @@ > * @param buf the string > * @param iindex the index to look at and return by. > * @return the codepoint found, 0 if @p buf or @p iindex are NULL > + * @since 1.8.0 > + */ > +static inline Eina_Unicode eina_unicode_utf8_next_get(const char *buf, > int *iindex) EINA_ARG_NONNULL(1, 2); > + > +/** > + * Reads UTF8 bytes from @p buf, starting at @p iindex and returns > + * the decoded code point at @p iindex offset, and advances @p iindex > + * to the next code point after this. @p iindex is always advanced, > + * unless if the advancement is after the @c NULL. > + * On error: return a codepoint between DC80 to DCFF where the low 8 bits > + * are the byte's value. > + * > + * @param buf the string > + * @param iindex the index to look at and return by. > + * @return the codepoint found, 0 if @p buf or @p iindex are NULL > * @since 1.1.0 > */ > -static inline Eina_Unicode eina_unicode_utf8_get_next(const char *buf, > int *iindex) EINA_ARG_NONNULL(1, 2); > +EAPI Eina_Unicode eina_unicode_utf8_get_next(const char *buf, int > *iindex) EINA_ARG_NONNULL(1, 2) EINA_DEPRECATED; > > /** > * Reads UTF8 bytes from @p buf, starting at @p iindex and returns > > Modified: trunk/elementary/src/lib/elm_entry.c > =================================================================== > --- trunk/elementary/src/lib/elm_entry.c 2013-01-21 22:51:26 UTC > (rev 83047) > +++ trunk/elementary/src/lib/elm_entry.c 2013-01-22 02:00:55 UTC > (rev 83048) > @@ -2220,7 +2220,7 @@ > { > int prev_pos = pos; > Eina_Unicode tmp = > - eina_unicode_utf8_get_next(sd->append_text_left, &pos); > + eina_unicode_utf8_next_get(sd->append_text_left, &pos); > > if (esc_start == -1) > { > > Modified: trunk/terminology/src/bin/termpty.c > =================================================================== > --- trunk/terminology/src/bin/termpty.c 2013-01-21 22:51:26 UTC (rev 83047) > +++ trunk/terminology/src/bin/termpty.c 2013-01-22 02:00:55 UTC (rev 83048) > @@ -203,7 +203,7 @@ > > if (buf[i]) > { > - g = eina_unicode_utf8_get_next(buf, &i); > + g = eina_unicode_utf8_next_get(buf, &i); > /* i = evas_string_char_next_get(buf, i, &g); */ > if (i < 0) break; > // DBG("(%i) %02x '%c'", j, g, g); > > > > ------------------------------------------------------------------------------ > Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS > and more. Get SQL Server skills now (including 2012) with LearnDevNow - > 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. > SALE $99.99 this month only - learn more at: > http://p.sf.net/sfu/learnmore_122512 > _______________________________________________ > enlightenment-svn mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
