ObjFW  Check-in [5eada9f7b0]

Overview
Comment:of_asprintf: Change %C to %k.

In Cocoa, %C means unichar, which is unsigned short and thus compilers
expect %C to be unichar when the language is set to ObjC. It would be
hard to let compilers detect whether %C should be unichar or
of_unichar_t, especially when mixing ObjFW and Cocoa code, thus the
change to %k.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5eada9f7b0059101f155b138fb694c5ccbf1eba66861c7bac696b04779d37bcf
User & Date: js on 2013-11-23 03:24:43
Other Links: manifest | tags
Context
2013-11-23
17:28
OF(Mutable)String_UTF8: Code simplification. check-in: f177032b43 user: js tags: trunk
03:24
of_asprintf: Change %C to %k. check-in: 5eada9f7b0 user: js tags: trunk
03:02
of_asprintf: Don't accept length modifiers for %@. check-in: 0232e0c975 user: js tags: trunk
Changes

Modified src/OFMutableString.h from [b71605a981] to [8ef9ff62cf].

83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107







-
+









-
+







	     encoding: (of_string_encoding_t)encoding
	       length: (size_t)cStringLength;

/*!
 * @brief Appends a formatted string to the OFMutableString.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A format string which generates the string to append
 */
- (void)appendFormat: (OFConstantString*)format, ...;

/*!
 * @brief Appends a formatted string to the OFMutableString.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A format string which generates the string to append
 * @param arguments The arguments used in the format string
 */
- (void)appendFormat: (OFConstantString*)format
	   arguments: (va_list)arguments;

Modified src/OFStream.h from [0895acb1d9] to [72c5abcbb8].

983
984
985
986
987
988
989
990

991
992
993
994
995
996
997
998
999
1000
1001

1002
1003
1004
1005
1006
1007
1008
983
984
985
986
987
988
989

990
991
992
993
994
995
996
997
998
999
1000

1001
1002
1003
1004
1005
1006
1007
1008







-
+










-
+







- (size_t)writeLine: (OFString*)string
	   encoding: (of_string_encoding_t)encoding;

/*!
 * @brief Writes a formatted string into the stream.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A string used as format
 * @return The number of bytes written
 */
- (size_t)writeFormat: (OFConstantString*)format, ...;

/*!
 * @brief Writes a formatted string into the stream.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A string used as format
 * @param arguments The arguments used in the format string
 * @return The number of bytes written
 */
- (size_t)writeFormat: (OFConstantString*)format
	    arguments: (va_list)arguments;

Modified src/OFString.h from [5833b2a141] to [ddf9f2532e].

261
262
263
264
265
266
267
268

269
270
271
272
273
274
275
261
262
263
264
265
266
267

268
269
270
271
272
273
274
275







-
+







			       length: (size_t)length
			    byteOrder: (of_byte_order_t)byteOrder;

/*!
 * @brief Creates a new OFString from a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A string used as format to initialize the OFString
 * @return A new autoreleased OFString
 */
+ (instancetype)stringWithFormat: (OFConstantString*)format, ...;

/*!
490
491
492
493
494
495
496
497

498
499
500
501
502
503
504
505
506
507
508

509
510
511
512
513
514
515
490
491
492
493
494
495
496

497
498
499
500
501
502
503
504
505
506
507

508
509
510
511
512
513
514
515







-
+










-
+







	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder;

/*!
 * @brief Initializes an already allocated OFString with a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A string used as format to initialize the OFString
 * @return An initialized OFString
 */
- initWithFormat: (OFConstantString*)format, ...;

/*!
 * @brief Initializes an already allocated OFString with a format string.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects and %C for of_unichar_t.
 * specifier for objects and %k for of_unichar_t.
 *
 * @param format A string used as format to initialize the OFString
 * @param arguments The arguments used in the format string
 * @return An initialized OFString
 */
- initWithFormat: (OFConstantString*)format
       arguments: (va_list)arguments;

Modified src/of_asprintf.m from [7dd06b0a1f] to [3466f7d906].

315
316
317
318
319
320
321
322

323
324
325
326
327
328
329
315
316
317
318
319
320
321

322
323
324
325
326
327
328
329







-
+







				    "(nil)");
		} @catch (id e) {
			free(ctx->buffer);
			@throw e;
		}

		break;
	case 'C':
	case 'k':
		if (ctx->lengthModifier != LENGTH_MODIFIER_NONE)
			return false;

		ctx->subformat[ctx->subformatLen - 1] = 's';

		{
			char buffer[5];

Modified utils/OFZIP.m from [7a27c4516e] to [88cae8bac8].

90
91
92
93
94
95
96
97

98
99
100
101
102
103
104
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104







-
+








			mode = option;
			break;
		case 'h':
			help(of_stdout, true, 0);
			break;
		default:
			[of_stderr writeFormat: @"%@: Unknown option: -%C\n",
			[of_stderr writeFormat: @"%@: Unknown option: -%k\n",
						[OFApplication programName],
						[optionsParser lastOption]];
			[OFApplication terminateWithStatus: 1];
		}
	}

	remainingArguments = [optionsParser remainingArguments];