ObjFW  Check-in [6c20d8bff4]

Overview
Comment:of_asprintf: Work around Win32 breaking C99 standard length modifiers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6c20d8bff4ded7a82f826470c8bff4cff1c8c50779064212d72dc50e0a6e1ff2
User & Date: js on 2011-06-16 01:05:48
Other Links: manifest | tags
Context
2011-06-16
02:14
Add -[rotateWithVector:angle:] to OFFloatMatrix. check-in: 91f446cfd8 user: js tags: trunk
01:05
of_asprintf: Work around Win32 breaking C99 standard length modifiers. check-in: 6c20d8bff4 user: js tags: trunk
2011-06-15
21:38
We need OFObject.h in macros.h now for of_{point,dimension,rectangle}_t. check-in: 674acc5082 user: js tags: trunk
Changes

Modified src/OFDate.m from [4de08470c1] to [88ef3a2c1c].

357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
	[element addAttributeWithName: @"class"
			  stringValue: [self className]];

	[element addChild:
	    [OFXMLElement elementWithName: @"seconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" PRId64, seconds]]];
	[element addChild:
	    [OFXMLElement elementWithName: @"microseconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" PRIu32, microseconds]]];

	[pool release];

	return element;
}

- (uint32_t)microsecond







|




|







357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
	[element addAttributeWithName: @"class"
			  stringValue: [self className]];

	[element addChild:
	    [OFXMLElement elementWithName: @"seconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" @PRId64, seconds]]];
	[element addChild:
	    [OFXMLElement elementWithName: @"microseconds"
				namespace: OF_SERIALIZATION_NS
			      stringValue: [OFString stringWithFormat:
					       @"%" @PRIu32, microseconds]]];

	[pool release];

	return element;
}

- (uint32_t)microsecond

Modified src/of_asprintf.m from [e2f58222ca] to [0950c4780b].

168
169
170
171
172
173
174

175
176




177
178
179
180
181
182
183
184
185
186
187
188

189
190




191
192
193
194
195
196
197
			ctx->lengthModifier = LENGTH_MODIFIER_H;
		}

		break;
	case 'l': /* and also ll */
		if (ctx->formatLen > ctx->i + 1 &&
		    ctx->format[ctx->i + 1] == 'l') {

			if (!appendSubformat(ctx, ctx->format + ctx->i, 2))
				return false;





			ctx->i++;
			ctx->lengthModifier = LENGTH_MODIFIER_LL;
		} else {
			if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
				return false;

			ctx->lengthModifier = LENGTH_MODIFIER_L;
		}

		break;
	case 'j':

		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;





		ctx->lengthModifier = LENGTH_MODIFIER_J;

		break;
	case 'z':
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;







>


>
>
>
>












>


>
>
>
>







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
			ctx->lengthModifier = LENGTH_MODIFIER_H;
		}

		break;
	case 'l': /* and also ll */
		if (ctx->formatLen > ctx->i + 1 &&
		    ctx->format[ctx->i + 1] == 'l') {
#ifndef _WIN32
			if (!appendSubformat(ctx, ctx->format + ctx->i, 2))
				return false;
#else
			if (!appendSubformat(ctx, "I64", 3))
				return false;
#endif

			ctx->i++;
			ctx->lengthModifier = LENGTH_MODIFIER_LL;
		} else {
			if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
				return false;

			ctx->lengthModifier = LENGTH_MODIFIER_L;
		}

		break;
	case 'j':
#ifndef _WIN32
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;
#else
		if (!appendSubformat(ctx, "I64", 3))
			return false;
#endif

		ctx->lengthModifier = LENGTH_MODIFIER_J;

		break;
	case 'z':
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;
209
210
211
212
213
214
215















216
217
218
219
220
221
222
	case 'L':
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;

		ctx->lengthModifier = LENGTH_MODIFIER_CAPITAL_L;

		break;















	default:
		ctx->i--;

		break;
	}

	ctx->state = STATE_FORMAT_CONVERSION_SPECIFIER;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
	case 'L':
		if (!appendSubformat(ctx, ctx->format + ctx->i, 1))
			return false;

		ctx->lengthModifier = LENGTH_MODIFIER_CAPITAL_L;

		break;
#ifdef _WIN32
	case 'I': /* win32 strangeness (I64 instead of ll or j) */
		if (ctx->formatLen > ctx->i + 2 &&
		    ctx->format[ctx->i + 1] == '6' &&
		    ctx->format[ctx->i + 2] == '4') {
			if (!appendSubformat(ctx, ctx->format + ctx->i, 3))
				return false;

			ctx->i += 2;
			ctx->lengthModifier = LENGTH_MODIFIER_LL;
		} else
			ctx->i--;

		break;
#endif
	default:
		ctx->i--;

		break;
	}

	ctx->state = STATE_FORMAT_CONVERSION_SPECIFIER;