Combination of Gray code and phase-shifting is the most practical and advanced approach for the structured light 3-D measurement so far, which is able to measure objects with complex and discontinuous surface. However, for the traditional combination of the Gray code and phase-shifting, the captured Gray code images are not always sharp cut-off in the black-white conversion boundaries, which may lead to wrong decoding analog code orders. Moreover, during the actual measurement, there also exists local decoding error for the wrapped analog code obtained with the phase-shifting approach. Therefore, for the traditional approach, the wrong analog code orders and the local decoding errors will consequently introduce the errors which are equivalent to a fringe period when the analog code is unwrapped. In order to avoid one-fringe period errors, we propose an approach which combines Gray code with phase-shifting according to unequal period. With theoretical analysis, we build the measurement model of the proposed approach, determine the applicable condition and optimize the Gray code encoding period and phase-shifting fringe period. The experimental results verify that the proposed approach can offer a reliable unwrapped analog code, which can be used in 3-D shape measurement.