Changeset 72955 in vbox for trunk/src/VBox/Runtime/common/misc
- Timestamp:
- Jul 7, 2018 7:06:09 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/json.cpp
r72954 r72955 167 167 /** The next token in the input stream (used for peeking). */ 168 168 PRTJSONTOKEN pTokenNext; 169 /** The tokenizer error state. */ 170 int rcTok; 169 171 } RTJSONTOKENIZER; 170 172 /** Pointer to a JSON tokenizer. */ … … 705 707 } 706 708 709 if (RT_FAILURE(rc)) 710 pTokenizer->rcTok = rc; 711 707 712 return rc; 708 713 } … … 728 733 pTokenizer->pTokenCurr = &pTokenizer->Token1; 729 734 pTokenizer->pTokenNext = &pTokenizer->Token2; 735 pTokenizer->rcTok = VINF_SUCCESS; 730 736 731 737 RT_ZERO(pTokenizer->achBuf); … … 763 769 DECLINLINE(int) rtJsonTokenizerGetToken(PRTJSONTOKENIZER pTokenizer, PRTJSONTOKEN *ppToken) 764 770 { 765 *ppToken = pTokenizer->pTokenCurr; 766 return VINF_SUCCESS; 771 if (RT_SUCCESS(pTokenizer->rcTok)) 772 { 773 *ppToken = pTokenizer->pTokenCurr; 774 return VINF_SUCCESS; 775 } 776 777 return pTokenizer->rcTok; 767 778 } 768 779 … … 795 806 PRTJSONTOKEN pToken = NULL; 796 807 int rc = rtJsonTokenizerGetToken(pTokenizer, &pToken); 797 AssertRC(rc); 798 799 if (pToken->enmClass == enmClass) 800 { 801 rtJsonTokenizerConsume(pTokenizer); 802 return true; 808 if (RT_SUCCESS(rc)) 809 { 810 if (pToken->enmClass == enmClass) 811 { 812 rtJsonTokenizerConsume(pTokenizer); 813 return true; 814 } 803 815 } 804 816 … … 958 970 && pToken->enmClass == RTJSONTOKENCLASS_STRING) 959 971 { 960 char *pszName = pToken->Class.String.pszStr; 972 char *pszName = pToken->Class.String.pszStr; /* We can consume this string as it was allocated. */ 961 973 962 974 rtJsonTokenizerConsume(pTokenizer);
Note:
See TracChangeset
for help on using the changeset viewer.